{ "cells": [ { "cell_type": "markdown", "id": "d0e4ad58-9eeb-43c4-811a-9c701321afe1", "metadata": {}, "source": [ "# Compute zonal stats for protected areas with vector data " ] }, { "cell_type": "code", "execution_count": null, "id": "b756f206-651f-459e-8977-1fb99afeab27", "metadata": {}, "outputs": [], "source": [ "from vector_utils import *\n", "import os\n", "import sys\n", "base_dir = os.path.abspath(os.path.join(os.getcwd(), '..'))\n", "if base_dir not in sys.path:\n", " sys.path.insert(0, base_dir)\n", " \n", "from minio_utils import * \n", "con, _ = connect_minio()" ] }, { "cell_type": "code", "execution_count": null, "id": "d1d692e2-a5bb-4c1d-b679-48af858d5853", "metadata": {}, "outputs": [], "source": [ "%%time \n", "# run for all metrics, files, and gap codes \n", "metric = 'overlap'\n", "label = 'gap1'\n", "index = 0\n", "\n", "vector_stats, save_url = get_vector_stats(con, index, label, metric)\n", "vector_stats.to_parquet(save_url)" ] }, { "cell_type": "code", "execution_count": null, "id": "fc1dedcd-6823-41fd-a8da-2d118a33ca70", "metadata": {}, "outputs": [], "source": [ "from IPython.lib.display import Audio\n", "import numpy as np\n", "\n", "framerate = 4410\n", "play_time_seconds = 1\n", "\n", "t = np.linspace(0, play_time_seconds, framerate*play_time_seconds)\n", "audio_data = np.sin(2*np.pi*300*t) + np.sin(2*np.pi*240*t)\n", "Audio(audio_data, rate=framerate, autoplay=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "212e9d19-caf1-429a-a42c-a5377b9e7b05", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }