Sign inSign up

pechnikov/pygmtsar

By pechnikov

•Updated 8 days ago

PyGMTSAR (Python InSAR): Powerful and Accessible Satellite Interferometry

Image
Data science
3

8.1K

pechnikov/pygmtsar repository overview

View on GitHub Available on pypi DOI Support on Patreon

⁠PyGMTSAR (Python InSAR) - Powerful and Accessible Satellite Interferometry

Note: Previous builds available at https://hub.docker.com/r/mobigroup/pygmtsar⁠

Note: In case ASF authorization fails, you need to upgrade the ASF library as sudo pip3 install -U asf_search

Note: There are two kinds of tags used in the repo. Date-based tags include both major platform builds for AMD64 and ARM64 and are named as '2024-03-14' and the most recent one alias 'latest' means manually built and verified images. These are recommended for public use. Hash-based tags are separate for platforms '740a41a-dev-amd64‘ and the recent one alias 'latest-dev-amd64' are automatic ones created for every GitHub repository commit for development reasons. Use them only if you look for the most recent PyGMTSAR build.

PyGMTSAR (Python InSAR) is designed to meet the needs of both occasional users and experts in Sentinel-1 Satellite Interferometry. It offers a wide range of features, including SBAS, PSI, PSI-SBAS, and more. In addition to the examples provided below, I also share Jupyter notebook examples on Patreon⁠ and provide updates on its progress through my LinkedIn profile⁠.

⁠About PyGMTSAR

PyGMTSAR provides accessible, reproducible, and powerful Sentinel-1 interferometry that is available to everyone, regardless of their location. It encompasses a variety of interferometry approaches, including SBAS, PSI, PSI-SBAS, and time series and trend analysis, all integrated into a single Python package. Whether you're utilizing Google Colab, DockerHub, or any other platform, PyGMTSAR is ready to meet your needs.

One of the most in-demand features in PyGMTSAR (Python InSAR) is the combined analysis of Persistent Scatterers (PS or PSI) and the Small Baseline Subset (SBAS). Each method has its own unique advantages and drawbacks — SBAS typically performs better in rural areas, while PS is more suited to urban environments. My vision is to merge the benefits of both methods while mitigating their shortcomings through a unified PS-SBAS process. Additionally, PyGMTSAR offers weighted interferogram processing using an amplitude stability matrix, which emphasizes stable pixels. This approach enhances phase and coherence, improving the accuracy of results by maintaining high coherence, even in rural areas.

⁠PyGMTSAR Live Examples in Docker Image

Configure your Docker runtime (Preferences -> Resources tab for Docker Desktop) using the example configurations in the table below, or adjust it to fit your needs. The disk usage for the examples is shown in the table. To process all the examples, you will need a 120 GB Docker virtual disk limit (114 GB Docker container size in my tests, though I recommend allowing slightly more to be safe). You can check the Docker container’s disk usage with the following command:

docker ps -s

The examples are coded with different objectives in mind. Some notebooks are designed to provide easy-to-read educational content, while others are optimized for maximum execution efficiency. This variation in coding approaches is why an annual SBAS+PSI example can run on a system with 2GB RAM, whereas an SBAS analysis of a few interferograms may require 8GB RAM.

Some examples use complete Sentinel-1 SLC scenes, while others utilize Sentinel-1 bursts. PyGMTSAR can effectively process both, allowing you to choose the type of source data that best suits your needs.

Table: Processing Times for InSAR Analysis Example Notebooks on iMac 2021 (Apple M1, 8 CPU cores, 16 GB RAM, 2 TB SSD) Using Various Docker Configurations and Natively Without Docker

AnalysisNotebookScnBrstSubswthIntfTime (Native, no Docker)Time (4 CPUs, 8 GB RAM)Time (2 CPUs, 4 GB RAM)Time (1 CPUs, 2 GB RAM)Disk Usage, GB
SBAS and PSI AnalysesLake Sarez Landslides193817611 min17 min24 min38 min*22.2
Co-Seismic InterferogramCENTRAL Türkiye Earthquake41123115 min24 min33 min62 min*50.3
SBAS and PSI AnalysesGolden Valley Subsidence30301575 min7 min10 min18 min12.8
SBAS AnalysisImperial Valley Groundwater5196 min9 min12 min21 min5.5
Co-Seismic InterferogramIran–Iraq Earthquake3111 min2 min2 min3 min*6.4
Co-Seismic InterferogramLa Cumbre Volcano Eruption28211 min1 min1 min2 min2.4
Co-Seismic InterferogramPico do Fogo Volcano Eruption2111 min1 min1 min2 min*2.1
Flooding MapKalkarindji3121 min1 min1 min2 min*5.3
Elevation MapErzincan, Türkiye2115 min7 min9 min16 min*5.3

Note: Download time is excluded. The reported times reflect the complete notebook run time when all data has already been downloaded in a previous run. For stable downloading of scenes and bursts with 2GB or 4GB RAM configurations, set the parameter n_jobs=1 for the ASF.download() function call. The default Docker Desktop 1GB swap is used, except for some examples on a 2GB RAM configuration that require a 2GB swap, indicated by an asterisk (*).

Download the Docker image (or build it yourself using the Dockerfile⁠ in the repository), and run the container while forwarding port 8888 to JupyterLab using these commands inside your command line terminal window:

docker pull pechnikov/pygmtsar
docker run -dp 8888:8888 --name pygmtsar docker.io/pechnikov/pygmtsar
docker logs pygmtsar

See the output for the JupyterLab link and copy and past it into your web browser address line. Also, the donwloaded Docker image can be started in Docker Desktop app - press "RUN" button and define the container name and the port in the opened dialog window (see "Optional settings" for the port number input field) and click on the newly created container to launch it and see the output log with the clickable link.

System operations are available using password-less “sudo” command. To upgrade PyGMTSAR Python library, execute the command below in a notebook cell and restart the notebook:

import sys
!sudo {sys.executable} -m pip install -U pygmtsar

Alternatively, use the following terminal command in the Docker container's Terminal:

sudo --preserve-env=PATH sh -c "pip3 install -U pygmtsar"

⁠Build Docker images

The commands below build multi-architecture images using the Dockerfile⁠ from the project’s GitHub repository and push them to DockerHub in the ‘pechnikov’ repository with the tags ‘latest’ and the build date (e.g., ‘2024-01-21’):

docker buildx create --name pygmtsar
docker buildx use pygmtsar
docker buildx inspect --bootstrap
docker buildx build . -f pygmtsar.Dockerfile \
    --platform linux/amd64,linux/arm64 \
    --tag pechnikov/pygmtsar:$(date "+%Y-%m-%d") \
    --tag pechnikov/pygmtsar:latest \
    --pull --push --no-cache
docker buildx rm pygmtsar

For a local build, use the following command:

docker build . -f pygmtsar.Dockerfile -t pygmtsar:latest --no-cache

The only requirement for these builds is the Dockerfile⁠; there is no need to download the entire PyGMTSAR GitHub repository, as the build process will automatically retrieve all necessary files.

⁠Learn more

Tag summary

Content type

Image

Digest

sha256:d14304c73…

Size

2.6 GB

Last updated

8 days ago

docker pull pechnikov/pygmtsar:fde3774-dev-amd64