{ "cells": [ { "cell_type": "markdown", "id": "c165ac4d", "metadata": {}, "source": [ "# Processing geocoded data\n", "\n", "In this notebook, we demonstrate the H/A/Alpha decomposition on a geocoded dataset." ] }, { "cell_type": "code", "execution_count": null, "id": "99920dfb", "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import os\n", "\n", "from pathlib import Path\n", "from polsarpro.io import open_netcdf_beam\n", "from polsarpro.decompositions import h_a_alpha\n", "# optional import for progress bar\n", "from dask.diagnostics import ProgressBar\n", "\n", "# change to your data paths\n", "# original dataset\n", "input_alos_geo = Path(\"/data/psp/test_files/SAN_FRANCISCO_ALOS1_geocoded_T3_7_look_az.nc\")" ] }, { "cell_type": "markdown", "id": "e6f10073", "metadata": {}, "source": [ "## Open the dataset" ] }, { "cell_type": "code", "execution_count": null, "id": "14bc0335", "metadata": {}, "outputs": [], "source": [ "T3 = open_netcdf_beam(input_alos_geo)" ] }, { "cell_type": "markdown", "id": "fea64661", "metadata": {}, "source": [ "## Apply the decomposition" ] }, { "cell_type": "code", "execution_count": null, "id": "cb995ca2", "metadata": {}, "outputs": [], "source": [ "with ProgressBar():\n", " res = h_a_alpha(T3, boxcar_size=[3 ,3])" ] }, { "cell_type": "markdown", "id": "d1136116", "metadata": {}, "source": [ "## Display an output" ] }, { "cell_type": "code", "execution_count": null, "id": "4f91a5d8", "metadata": {}, "outputs": [], "source": [ "res.entropy.plot.imshow()" ] }, { "cell_type": "markdown", "id": "5f9ee44e", "metadata": {}, "source": [ "## Export an output as a GeoTIFF" ] }, { "cell_type": "code", "execution_count": null, "id": "744ba4d0", "metadata": {}, "outputs": [], "source": [ "import rioxarray as riox\n", "res.entropy.rio.to_raster(\"/data/psp/entropy_geo.tif\")" ] }, { "cell_type": "markdown", "id": "d6c8891d", "metadata": {}, "source": [ "The resulting file may be opened in a GIS software." ] } ], "metadata": { "kernelspec": { "display_name": "psp", "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.11" } }, "nbformat": 4, "nbformat_minor": 5 }