{ "cells": [ { "cell_type": "markdown", "id": "68cd13a8-3eb1-461c-b5e1-4f8a356abfeb", "metadata": {}, "source": [ "# Compute zonal stats for protected areas with raster data " ] }, { "cell_type": "code", "execution_count": null, "id": "1852e008-906d-40e5-826f-a8fa92d9fceb", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from raster_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": "d91efb56-e6e9-4cb6-8ce6-54d318e62534", "metadata": {}, "outputs": [], "source": [ "%%time \n", "# run for all metrics, files, and gap codes \n", "metric = 'overlap'\n", "label = 'gap1'\n", "index = 0\n", "\n", "get_raster_stats(con, label, name, raster, metric, index)" ] }, { "cell_type": "code", "execution_count": null, "id": "1da6f99d-ba7f-44ed-8100-cc3371966693", "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)" ] } ], "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 }