{ "cells": [ { "cell_type": "markdown", "id": "8b314df6-c4b9-4be5-9a34-2ab5236f072b", "metadata": {}, "source": [ "# Combine habitat types and climate zones\n", "To split the protected areas into habitat types and climate zones, it's best to dissolve the habitat type/climate zone geometries into a single dataset, and then intersect on protected areas. \n", "\n", "To do so, we combine the data to get distinct geometries for each habitat type + climate zone combonation. " ] }, { "cell_type": "code", "execution_count": null, "id": "baa63640-33a7-4b99-a4aa-46125beb5976", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "from combine 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": "5000eb46-1e51-49e3-bd2d-3230e829628f", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "%%time \n", "#Wall time: 3h 48min 41s\n", "# prior to running, I simplified each vector by 10 meters. \n", "data1_url = 's3://public-ca30x30/CBN/Habitat/dissolved_geoms/CWHR13_dissolved_geoms_simplify10m.parquet'\n", "data2_url = 's3://public-ca30x30/CBN/Climate_zones/dissolved_geoms/Climate_zones_dissolved_geoms_simplify10m.parquet'\n", "result = combine_habitat_and_climate(data1_url, data2_url, con)\n", "\n", "new_url = 's3://public-ca30x30/CBN/Habitat/dissolved_geoms/CWHR13_climate_dissolved_geoms_simplify10m.parquet'\n", "result.to_parquet(new_url)" ] } ], "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 }