{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "(quick_overview)=\n", "\n", "# Quick Overview\n", "\n", "This tutorial will help you get started with basic usage of the FanInSAR library. We will cover the following topics:\n", "\n", "- How to initialize a dataset\n", "- How to query values from dataset by given points/bounding boxes/polygons\n", "- How to operate time series processing (e.g., unwrapping error correction, NSBAS inversion, etc.)\n", "- How to save the processed results into tiff/kml(kmz) files\n", "\n", "## Imports\n", "\n", "Customarily, we import FanInSAR as follows:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "\n", "import numpy as np\n", "\n", "import faninsar as fis\n", "from faninsar import NSBAS, cmaps, datasets, query" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load InSAR datasets\n", "\n", "FanInSAR provides a series of [datasets](#geo_datasets) to load well-known InSAR products. Here we will use the [HyP3S1](#faninsar.datasets.HyP3S1) for example, which is used to load the HyP3 Sentinel-1 frame dataset. \n", "\n", "::: {tip}\n", "If [datasets](#geo_datasets) provided by FanInSAR do not meet your requirements, you can also create your own dataset class following the \n", "tutorial: [Custom Datasets](#custom_datasets)\n", ":::\n", "\n", "\n", "### Initialize a dataset\n", "\n", "To initialize the [HyP3S1](#faninsar.datasets.HyP3S1) class, you only need to provide the root directory of the HyP3 data. All unwrapped interferogram and coherence files stored in the root directory, including the subdirectories, will be automatically scanned. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "root_dir = Path(\"/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/\")\n", "ds_unw = datasets.HyP3S1(root_dir, fill_nodata=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ":::{tip}\n", "- You can also directly provide the ``paths_unw`` and ``paths_coh`` arguments to specify the paths of the unwrapped and coherence files. In this case, the ``root_dir`` argument will be ignored. \n", "- Only common pairs of the unwrapped interferogram and coherence files will be used. The rest of the files will be ignored automatically.\n", ":::\n", "\n", "\n", ":::{admonition} More initialization parameters\n", ":class: dropdown\n", "\n", "Below are the common parameters to initialize a dataset:\n", "\n", "- **crs, res, resampling**: \n", " - If the dataset files are not aligned with the specified `crs` (Coordinate Reference System) or `res` (resolution), the warp process, such as resampling and reprojection, will be performed to align the dataset files with the specified `crs` and `res` automatically. ([Warping upon loading](#warping_upon_loading) section provides some examples of usage)\n", " - The `resampling` parameter is employed to define the resampling algorithm used in the warp process. The default value is `Resampling.nearest`. More resampling algorithms can be found [here](#rasterio.enums.Resampling).\n", "- **fill_nodata**: If `True`, the nodata values in raster files will be interpolated using inverse distance weighting method provided by the [rasterio.fill.fillnodata()](#rasterio.fill.fillnodata).\n", "- **roi**: region of interest, which defines the specific area to be loaded from the dataset. If left as `None`, the combined boundary of all files within the dataset will be utilized.\n", "- **verbose**: Enabling `verbose=True` will display the dataset processing information. To suppress this output, set the parameter to `False`.\n", ":::\n", "\n", "### Interferogram dataset\n", "\n", "[HyP3S1](#faninsar.datasets.HyP3S1) is a subclass of [RasterDataset](#faninsar.datasets.RasterDataset) and provides the same functionalities/properties as [RasterDataset](#faninsar.datasets.RasterDataset). You can view interferogram file by directly calling `files` property. The file paths and whether the file is valid or not will be displayed in the DataFrame format." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "int64", "type": "integer" }, { "name": "paths", "rawType": "object", "type": "unknown" }, { "name": "valid", "rawType": "bool", "type": "boolean" } ], "ref": "048be11b-5998-4cfc-b803-baddec6fa2ce", "rows": [ [ "0", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20151206T232631_VVP024_INT40_G_ueF_9F90/S1AA_20151112T232631_20151206T232631_VVP024_INT40_G_ueF_9F90_unw_phase.tif", "True" ], [ "1", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20151230T232630_VVP048_INT40_G_ueF_B24D/S1AA_20151112T232631_20151230T232630_VVP048_INT40_G_ueF_B24D_unw_phase.tif", "True" ], [ "2", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160123T232629_VVP072_INT40_G_ueF_22AF/S1AA_20151112T232631_20160123T232629_VVP072_INT40_G_ueF_22AF_unw_phase.tif", "True" ], [ "3", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160216T232628_VVP096_INT40_G_ueF_FA45/S1AA_20151112T232631_20160216T232628_VVP096_INT40_G_ueF_FA45_unw_phase.tif", "True" ], [ "4", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160311T232628_VVP120_INT40_G_ueF_EA9E/S1AA_20151112T232631_20160311T232628_VVP120_INT40_G_ueF_EA9E_unw_phase.tif", "True" ], [ "5", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160404T232629_VVP144_INT40_G_ueF_097A/S1AA_20151112T232631_20160404T232629_VVP144_INT40_G_ueF_097A_unw_phase.tif", "True" ], [ "6", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160428T232630_VVP168_INT40_G_ueF_7079/S1AA_20151112T232631_20160428T232630_VVP168_INT40_G_ueF_7079_unw_phase.tif", "True" ], [ "7", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160522T232634_VVP192_INT40_G_ueF_1B34/S1AA_20151112T232631_20160522T232634_VVP192_INT40_G_ueF_1B34_unw_phase.tif", "True" ], [ "8", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160615T232636_VVP216_INT40_G_ueF_8FD3/S1AA_20151112T232631_20160615T232636_VVP216_INT40_G_ueF_8FD3_unw_phase.tif", "True" ], [ "9", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151112T232631_20160709T232632_VVP240_INT40_G_ueF_BFB1/S1AA_20151112T232631_20160709T232632_VVP240_INT40_G_ueF_BFB1_unw_phase.tif", "True" ], [ "10", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20151230T232630_VVP024_INT40_G_ueF_F1D0/S1AA_20151206T232631_20151230T232630_VVP024_INT40_G_ueF_F1D0_unw_phase.tif", "True" ], [ "11", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160123T232629_VVP048_INT40_G_ueF_7020/S1AA_20151206T232631_20160123T232629_VVP048_INT40_G_ueF_7020_unw_phase.tif", "True" ], [ "12", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160216T232628_VVP072_INT40_G_ueF_19B6/S1AA_20151206T232631_20160216T232628_VVP072_INT40_G_ueF_19B6_unw_phase.tif", "True" ], [ "13", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160311T232628_VVP096_INT40_G_ueF_FF6A/S1AA_20151206T232631_20160311T232628_VVP096_INT40_G_ueF_FF6A_unw_phase.tif", "True" ], [ "14", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160404T232629_VVP120_INT40_G_ueF_EF6D/S1AA_20151206T232631_20160404T232629_VVP120_INT40_G_ueF_EF6D_unw_phase.tif", "True" ], [ "15", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160428T232630_VVP144_INT40_G_ueF_89F0/S1AA_20151206T232631_20160428T232630_VVP144_INT40_G_ueF_89F0_unw_phase.tif", "True" ], [ "16", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160522T232634_VVP168_INT40_G_ueF_3666/S1AA_20151206T232631_20160522T232634_VVP168_INT40_G_ueF_3666_unw_phase.tif", "True" ], [ "17", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160709T232632_VVP216_INT40_G_ueF_A3E3/S1AA_20151206T232631_20160709T232632_VVP216_INT40_G_ueF_A3E3_unw_phase.tif", "True" ], [ "18", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151206T232631_20160802T232639_VVP240_INT40_G_ueF_FC74/S1AA_20151206T232631_20160802T232639_VVP240_INT40_G_ueF_FC74_unw_phase.tif", "True" ], [ "19", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160216T232628_VVP048_INT40_G_ueF_46D7/S1AA_20151230T232630_20160216T232628_VVP048_INT40_G_ueF_46D7_unw_phase.tif", "True" ], [ "20", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160311T232628_VVP072_INT40_G_ueF_F724/S1AA_20151230T232630_20160311T232628_VVP072_INT40_G_ueF_F724_unw_phase.tif", "True" ], [ "21", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160404T232629_VVP096_INT40_G_ueF_51F0/S1AA_20151230T232630_20160404T232629_VVP096_INT40_G_ueF_51F0_unw_phase.tif", "True" ], [ "22", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160428T232630_VVP120_INT40_G_ueF_99F6/S1AA_20151230T232630_20160428T232630_VVP120_INT40_G_ueF_99F6_unw_phase.tif", "True" ], [ "23", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160522T232634_VVP144_INT40_G_ueF_5371/S1AA_20151230T232630_20160522T232634_VVP144_INT40_G_ueF_5371_unw_phase.tif", "True" ], [ "24", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160615T232636_VVP168_INT40_G_ueF_5E4E/S1AA_20151230T232630_20160615T232636_VVP168_INT40_G_ueF_5E4E_unw_phase.tif", "True" ], [ "25", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160709T232632_VVP192_INT40_G_ueF_9DFD/S1AA_20151230T232630_20160709T232632_VVP192_INT40_G_ueF_9DFD_unw_phase.tif", "True" ], [ "26", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160802T232639_VVP216_INT40_G_ueF_D0A2/S1AA_20151230T232630_20160802T232639_VVP216_INT40_G_ueF_D0A2_unw_phase.tif", "True" ], [ "27", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20151230T232630_20160826T232640_VVP240_INT40_G_ueF_BCE1/S1AA_20151230T232630_20160826T232640_VVP240_INT40_G_ueF_BCE1_unw_phase.tif", "True" ], [ "28", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160216T232628_VVP024_INT40_G_ueF_2CDF/S1AA_20160123T232629_20160216T232628_VVP024_INT40_G_ueF_2CDF_unw_phase.tif", "True" ], [ "29", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160311T232628_VVP048_INT40_G_ueF_989D/S1AA_20160123T232629_20160311T232628_VVP048_INT40_G_ueF_989D_unw_phase.tif", "True" ], [ "30", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160404T232629_VVP072_INT40_G_ueF_08B1/S1AA_20160123T232629_20160404T232629_VVP072_INT40_G_ueF_08B1_unw_phase.tif", "True" ], [ "31", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160428T232630_VVP096_INT40_G_ueF_467A/S1AA_20160123T232629_20160428T232630_VVP096_INT40_G_ueF_467A_unw_phase.tif", "True" ], [ "32", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160522T232634_VVP120_INT40_G_ueF_48AD/S1AA_20160123T232629_20160522T232634_VVP120_INT40_G_ueF_48AD_unw_phase.tif", "True" ], [ "33", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160615T232636_VVP144_INT40_G_ueF_F9E0/S1AA_20160123T232629_20160615T232636_VVP144_INT40_G_ueF_F9E0_unw_phase.tif", "True" ], [ "34", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160709T232632_VVP168_INT40_G_ueF_C0E1/S1AA_20160123T232629_20160709T232632_VVP168_INT40_G_ueF_C0E1_unw_phase.tif", "True" ], [ "35", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160802T232639_VVP192_INT40_G_ueF_701B/S1AA_20160123T232629_20160802T232639_VVP192_INT40_G_ueF_701B_unw_phase.tif", "True" ], [ "36", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160826T232640_VVP216_INT40_G_ueF_15B8/S1AA_20160123T232629_20160826T232640_VVP216_INT40_G_ueF_15B8_unw_phase.tif", "True" ], [ "37", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160123T232629_20160919T232640_VVP240_INT40_G_ueF_EF91/S1AA_20160123T232629_20160919T232640_VVP240_INT40_G_ueF_EF91_unw_phase.tif", "True" ], [ "38", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160311T232628_VVP024_INT40_G_ueF_331F/S1AA_20160216T232628_20160311T232628_VVP024_INT40_G_ueF_331F_unw_phase.tif", "True" ], [ "39", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160404T232629_VVP048_INT40_G_ueF_40AC/S1AA_20160216T232628_20160404T232629_VVP048_INT40_G_ueF_40AC_unw_phase.tif", "True" ], [ "40", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160428T232630_VVP072_INT40_G_ueF_7E9F/S1AA_20160216T232628_20160428T232630_VVP072_INT40_G_ueF_7E9F_unw_phase.tif", "True" ], [ "41", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160522T232634_VVP096_INT40_G_ueF_7DA5/S1AA_20160216T232628_20160522T232634_VVP096_INT40_G_ueF_7DA5_unw_phase.tif", "True" ], [ "42", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160615T232636_VVP120_INT40_G_ueF_A8AA/S1AA_20160216T232628_20160615T232636_VVP120_INT40_G_ueF_A8AA_unw_phase.tif", "True" ], [ "43", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160709T232632_VVP144_INT40_G_ueF_8E1D/S1AA_20160216T232628_20160709T232632_VVP144_INT40_G_ueF_8E1D_unw_phase.tif", "True" ], [ "44", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160802T232639_VVP168_INT40_G_ueF_B6E1/S1AA_20160216T232628_20160802T232639_VVP168_INT40_G_ueF_B6E1_unw_phase.tif", "True" ], [ "45", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160826T232640_VVP192_INT40_G_ueF_8CFD/S1AA_20160216T232628_20160826T232640_VVP192_INT40_G_ueF_8CFD_unw_phase.tif", "True" ], [ "46", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160216T232628_20160919T232640_VVP216_INT40_G_ueF_4E46/S1AA_20160216T232628_20160919T232640_VVP216_INT40_G_ueF_4E46_unw_phase.tif", "True" ], [ "47", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AB_20160216T232628_20161007T232559_VVP234_INT40_G_ueF_2BC2/S1AB_20160216T232628_20161007T232559_VVP234_INT40_G_ueF_2BC2_unw_phase.tif", "True" ], [ "48", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160311T232628_20160404T232629_VVP024_INT40_G_ueF_37E7/S1AA_20160311T232628_20160404T232629_VVP024_INT40_G_ueF_37E7_unw_phase.tif", "True" ], [ "49", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/nearest_connection/S1AA_20160311T232628_20160428T232630_VVP048_INT40_G_ueF_FC06/S1AA_20160311T232628_20160428T232630_VVP048_INT40_G_ueF_FC06_unw_phase.tif", "True" ] ], "shape": { "columns": 2, "rows": 2750 } }, "text/html": [ "
| \n", " | paths | \n", "valid | \n", "
|---|---|---|
| 0 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 1 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 2 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 3 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 4 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| ... | \n", "... | \n", "... | \n", "
| 2745 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 2746 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 2747 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 2748 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
| 2749 | \n", "/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... | \n", "True | \n", "
2750 rows × 2 columns
\n", " Pairs \n",
" primary secondary\n",
"0 2015-11-12 2015-12-06\n",
"1 2015-11-12 2015-12-30\n",
"2 2015-11-12 2016-01-23\n",
"3 2015-11-12 2016-02-16\n",
"4 2015-11-12 2016-03-11\n",
"... ... ...\n",
"2745 2023-03-23 2023-08-14\n",
"2746 2023-03-23 2023-09-07\n",
"2747 2023-04-04 2023-08-14\n",
"2748 2023-04-04 2023-09-07\n",
"2749 2023-08-14 2023-09-07\n",
"\n",
"[2750 rows x 2 columns] Pairs \n",
" primary secondary\n",
"0 2015-11-12 2015-12-06\n",
"1 2015-11-12 2015-12-30\n",
"2 2015-11-12 2016-01-23\n",
"3 2015-11-12 2016-02-16\n",
"4 2015-11-12 2016-03-11\n",
"... ... ...\n",
"2745 2023-03-23 2023-08-14\n",
"2746 2023-03-23 2023-09-07\n",
"2747 2023-04-04 2023-08-14\n",
"2748 2023-04-04 2023-09-07\n",
"2749 2023-08-14 2023-09-07\n",
"\n",
"[2750 rows x 2 columns]