diff --git a/OpenDataCube/GeoBox_Folium.ipynb b/OpenDataCube/GeoBox_Folium.ipynb new file mode 100644 index 0000000..fac13be --- /dev/null +++ b/OpenDataCube/GeoBox_Folium.ipynb @@ -0,0 +1,79 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "18270e42", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import folium\n", + "import xarray as xr\n", + "from numpy.random import uniform\n", + "from odc.geo.data import country_geom\n", + "from odc.geo.xr import rasterize\n", + "\n", + "# Make some sample images\n", + "def gen_sample(iso3, crs=\"epsg:3857\", res=60_000, vmin=0, vmax=1000):\n", + " xx = rasterize(country_geom(iso3, crs), res)\n", + " return xr.where(xx, uniform(vmin, vmax, size=xx.shape), float(\"nan\")).astype(\"float32\")\n", + "\n", + "aus, png, nzl = [gen_sample(iso3) for iso3 in [\"AUS\", \"PNG\", \"NZL\"]]\n", + "\n", + "# Create folium Map (ipyleaflet is also supported)\n", + "m = folium.Map()\n", + "\n", + "# Plot each sample image with different colormap\n", + "aus.odc.add_to(m, opacity=0.5)\n", + "png.odc.add_to(m, opacity=0.5, cmap=\"spring\", robust=True) # vmin=2%,vmax=98%\n", + "nzl.odc.add_to(m, opacity=0.5, cmap=\"jet\", vmin=0, vmax=800) # force vmin/vmax\n", + "\n", + "# Zoom map to Australia\n", + "m.fit_bounds(aus.odc.map_bounds())\n", + "display(m)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dd928dfe", + "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.10.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/OpenDataCube/GeoBox_Intro.ipynb b/OpenDataCube/GeoBox_Intro.ipynb new file mode 100644 index 0000000..c95b3c2 --- /dev/null +++ b/OpenDataCube/GeoBox_Intro.ipynb @@ -0,0 +1,58 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "452bef60", + "metadata": {}, + "source": [ + "## GeoBox by Geoscience Australia\n", + "### Kirill888 Kirill Kouzoubov & v0lat1le Gregory Raevski\n", + "\n", + "https://odc-geo.readthedocs.io/en/latest/" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3b326272", + "metadata": {}, + "outputs": [], + "source": [ + "from odc.geo.geobox import GeoBox\n", + "GeoBox.from_bbox(\n", + " (-2_000_000, -5_000_000,\n", + " 2_250_000, -1_000_000),\n", + " \"epsg:3577\", resolution=1000)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8d4ec84b", + "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.10.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}