Quick Start#

This guide will help you get started with basic usage of the FanInSAR library.

Customarily, we import as follows:

from pathlib import Path
import faninsar as fis
from faninsar import datasets, NSBAS, query

Load InSAR data#

FanInSAR library provides a series of classes to load well-known InSAR products. Here we will use the HyP3 for example. To load the HyP3 data, you just need to provide the home directory of the HyP3 data and pass it to the HyP3 class.

home_dir = Path("/Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/descending_roi/")
ds_unw = datasets.HyP3(home_dir, verbose=True)

All unwrapped interferograms stored in the home directory will be automatically scanned. You can view them by calling files property of the HyP3 object. The file paths and whether the file is valid or not will be displayed in the DataFrame format.

ds_unw.files
paths valid
0 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
1 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
3 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
4 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
... ... ...
2745 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2746 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2747 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2748 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2749 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True

2750 rows × 2 columns

We keep the same API with rasterio, so you can use directly access the resolution, bounds, and other properties of the data just like using rasterio.

print(f" res: {ds_unw.res}\n bounds: {ds_unw.bounds}\n crs: {ds_unw.crs}\n dtype: {ds_unw.dtype}\n nodata: {ds_unw.nodata}")
 res: (40.0, 40.0)
 bounds: BoundingBox(left=443501.82025355106, bottom=4263758.21737383, right=536101.820253551, top=4335118.21737383, crs=EPSG:32647)
 crs: EPSG:32647
 dtype: float32
 nodata: 0.0

The coherence dataset can be accessed by calling coh_dataset property of the HyP3 object. The coherence dataset is also RasterDataset object, so you can access the properties of the coherence dataset just like the unwrapped interferograms.

ds_coh = ds_unw.coh_dataset
ds_coh.files
paths valid
0 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
1 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
3 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
4 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
... ... ...
2745 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2746 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2747 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2748 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True
2749 /Volumes/Data/GeoData/YNG/Sentinel1/Hyp3/desce... True

2750 rows × 2 columns