# bsingh88/pygmtsar architecture

> Architecture diagram of the GitHub repository bsingh88/pygmtsar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bsingh88/pygmtsar
- Repository: https://github.com/bsingh88/pygmtsar

## Overview

PyGMTSAR is a Python Sentinel-1 InSAR processing library. Its principal workflow takes users from scene and auxiliary-data retrieval through stack preparation, interferogram generation, time-series analysis, and mapped or 3D outputs. The graph preserves the README’s stated capabilities—including SBAS/PSI, DEM and orbit retrieval, and visualization—and includes shared raster I/O and grid utilities. Source excerpts are partial, so edges mainly reflect README-documented workflow; unsampled implementation links are omitted rather than inferred.

Main entry points: [`pygmtsar/pygmtsar/Stack.py`](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack.py) (Stack workflow), [`pygmtsar/pygmtsar/Stack_sbas.py`](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_sbas.py) (SBAS analysis), [`pygmtsar/pygmtsar/ASF.py`](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/ASF.py) (ASF scene retrieval), [`pygmtsar/pygmtsar/S1.py`](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/S1.py) (Sentinel-1 tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Data acquisition"]
  node_asf["ASF scene retrieval<br/>[ASF.py]"]
  node_s1["Sentinel-1 tools<br/>[S1.py]"]
  node_aws["AWS data access<br/>[AWS.py]"]
end

subgraph group_stack["Stack preparation"]
  node_stack_entry["Stack workflow<br/>[Stack.py]"]
  node_stack_base["Stack state and I/O<br/>[Stack_base.py]"]
  node_alignment["Scene alignment<br/>[Stack_align.py]"]
  node_dem_processing["DEM and landmask<br/>[Stack_dem.py]"]
  node_prm["Radar parameters<br/>[PRM.py]"]
end

subgraph group_analysis["Interferometric analysis"]
  node_phase["Interferograms<br/>[Stack_phasediff.py]"]
  node_unwrap["Phase unwrapping<br/>[Stack_unwrap.py]"]
  node_sbas["SBAS analysis<br/>[Stack_sbas.py]"]
  node_detrend["Trend correction<br/>[Stack_detrend.py]"]
  node_least_squares["Time-series inversion<br/>[Stack_lstsq.py]"]
  node_ps["PSI analysis<br/>[Stack_ps.py]"]
  node_tidal["Tidal correction<br/>[Stack_tidal.py]"]
end

subgraph group_output["Geospatial outputs"]
  node_geocode["Geocoding<br/>[Stack_geocode.py]"]
  node_incidence["Incidence angles<br/>[Stack_incidence.py]"]
  node_export["Data export<br/>[Stack_export.py]"]
  node_vtk["3D visualization<br/>[NCubeVTK.py]"]
end

subgraph group_runtime["Processing foundations"]
  node_io["Raster I/O<br/>[IO.py]"]
  node_grid["Grid operations<br/>[datagrid.py]"]
  node_progress["Dask progress<br/>[tqdm_dask.py]"]
  node_joblib_progress["Joblib progress<br/>[tqdm_joblib.py]"]
end

node_user(("InSAR user"))
node_sentinel[("Sentinel-1 scenes")]
node_dem[("DEM and masks")]
node_orbit_service[("Orbit data service")]

node_user -->|"runs workflow"| node_stack_entry
node_asf -->|"retrieves scenes"| node_sentinel
node_s1 -->|"retrieves orbits"| node_orbit_service
node_stack_entry -->|"loads scenes"| node_asf
node_stack_entry -->|"gets orbits"| node_s1
node_stack_entry -->|"prepares DEM"| node_dem_processing
node_dem_processing -->|"uses elevation data"| node_dem
node_stack_entry -->|"prepares stack"| node_alignment
node_stack_entry -->|"computes interferograms"| node_phase
node_phase -->|"unwraps phase"| node_unwrap
node_stack_entry -->|"runs SBAS"| node_sbas
node_stack_entry -->|"supports PSI"| node_ps
node_sbas -.->|"solves time series"| node_least_squares
node_sbas -.->|"corrects trends"| node_detrend
node_stack_entry -.->|"supports corrections"| node_tidal
node_stack_entry -->|"geocodes results"| node_geocode
node_stack_entry -->|"exports results"| node_export
node_stack_entry -->|"visualizes in 3D"| node_vtk
node_stack_entry -.->|"computes angles"| node_incidence
node_stack_entry -.->|"reads raster data"| node_io
node_stack_entry -.->|"uses radar parameters"| node_prm
node_stack_entry -.->|"accesses cloud data"| node_aws
node_io -->|"uses grid utilities"| node_grid
node_stack_entry -.->|"tracks computation"| node_progress
node_stack_entry -.->|"tracks parallel tasks"| node_joblib_progress

click node_asf "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/ASF.py"
click node_s1 "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/S1.py"
click node_aws "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/AWS.py"
click node_stack_entry "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack.py"
click node_stack_base "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_base.py"
click node_alignment "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_align.py"
click node_dem_processing "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_dem.py"
click node_prm "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/PRM.py"
click node_phase "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_phasediff.py"
click node_unwrap "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_unwrap.py"
click node_sbas "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_sbas.py"
click node_detrend "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_detrend.py"
click node_least_squares "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_lstsq.py"
click node_ps "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_ps.py"
click node_tidal "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_tidal.py"
click node_geocode "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_geocode.py"
click node_incidence "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_incidence.py"
click node_export "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_export.py"
click node_vtk "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/NCubeVTK.py"
click node_io "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/IO.py"
click node_grid "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/datagrid.py"
click node_progress "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/tqdm_dask.py"
click node_joblib_progress "https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/tqdm_joblib.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_asf,node_s1,node_aws,node_user toneBlue
class node_stack_entry,node_stack_base,node_alignment,node_dem_processing,node_prm,node_sentinel,node_dem,node_orbit_service toneAmber
class node_phase,node_unwrap,node_sbas,node_detrend,node_least_squares,node_ps,node_tidal toneMint
class node_geocode,node_incidence,node_export,node_vtk toneRose
class node_io,node_grid,node_progress,node_joblib_progress toneIndigo
```

## Components

### Data acquisition

- [ASF scene retrieval](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/ASF.py): `pygmtsar/pygmtsar/ASF.py`
- [Sentinel-1 tools](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/S1.py): `pygmtsar/pygmtsar/S1.py`
- [AWS data access](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/AWS.py): `pygmtsar/pygmtsar/AWS.py`

### Stack preparation

- [Stack workflow](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack.py): `pygmtsar/pygmtsar/Stack.py`
- [Stack state and I/O](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_base.py): `pygmtsar/pygmtsar/Stack_base.py`
- [Scene alignment](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_align.py): `pygmtsar/pygmtsar/Stack_align.py`
- [DEM and landmask](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_dem.py): `pygmtsar/pygmtsar/Stack_dem.py`
- [Radar parameters](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/PRM.py): `pygmtsar/pygmtsar/PRM.py`

### Interferometric analysis

- [Interferograms](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_phasediff.py): `pygmtsar/pygmtsar/Stack_phasediff.py`
- [Phase unwrapping](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_unwrap.py): `pygmtsar/pygmtsar/Stack_unwrap.py`
- [SBAS analysis](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_sbas.py): `pygmtsar/pygmtsar/Stack_sbas.py`
- [Trend correction](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_detrend.py): `pygmtsar/pygmtsar/Stack_detrend.py`
- [Time-series inversion](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_lstsq.py): `pygmtsar/pygmtsar/Stack_lstsq.py`
- [PSI analysis](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_ps.py): `pygmtsar/pygmtsar/Stack_ps.py`
- [Tidal correction](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_tidal.py): `pygmtsar/pygmtsar/Stack_tidal.py`

### Geospatial outputs

- [Geocoding](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_geocode.py): `pygmtsar/pygmtsar/Stack_geocode.py`
- [Incidence angles](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_incidence.py): `pygmtsar/pygmtsar/Stack_incidence.py`
- [Data export](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/Stack_export.py): `pygmtsar/pygmtsar/Stack_export.py`
- [3D visualization](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/NCubeVTK.py): `pygmtsar/pygmtsar/NCubeVTK.py`

### Processing foundations

- [Raster I/O](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/IO.py): `pygmtsar/pygmtsar/IO.py`
- [Grid operations](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/datagrid.py): `pygmtsar/pygmtsar/datagrid.py`
- [Dask progress](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/tqdm_dask.py): `pygmtsar/pygmtsar/tqdm_dask.py`
- [Joblib progress](https://github.com/bsingh88/pygmtsar/blob/pygmtsar2/pygmtsar/pygmtsar/tqdm_joblib.py): `pygmtsar/pygmtsar/tqdm_joblib.py`

### Other components

- **InSAR user**
- **Sentinel-1 scenes**
- **DEM and masks**
- **Orbit data service**

## Connections

- InSAR user → Stack workflow: runs workflow
- ASF scene retrieval → Sentinel-1 scenes: retrieves scenes
- Sentinel-1 tools → Orbit data service: retrieves orbits
- Stack workflow → ASF scene retrieval: loads scenes
- Stack workflow → Sentinel-1 tools: gets orbits (evidence: `pygmtsar/pygmtsar/Stack.py`)
- Stack workflow → DEM and landmask: prepares DEM
- DEM and landmask → DEM and masks: uses elevation data
- Stack workflow → Scene alignment: prepares stack
- Stack workflow → Interferograms: computes interferograms
- Interferograms → Phase unwrapping: unwraps phase
- Stack workflow → SBAS analysis: runs SBAS
- Stack workflow → PSI analysis: supports PSI
- SBAS analysis → Time-series inversion: solves time series
- SBAS analysis → Trend correction: corrects trends (evidence: `pygmtsar/pygmtsar/Stack_sbas.py`)
- Stack workflow → Tidal correction: supports corrections
- Stack workflow → Geocoding: geocodes results
- Stack workflow → Data export: exports results (evidence: `pygmtsar/pygmtsar/Stack.py`)
- Stack workflow → 3D visualization: visualizes in 3D
- Stack workflow → Incidence angles: computes angles
- Stack workflow → Raster I/O: reads raster data
- Stack workflow → Radar parameters: uses radar parameters (evidence: `pygmtsar/pygmtsar/Stack.py`)
- Stack workflow → AWS data access: accesses cloud data
- Raster I/O → Grid operations: uses grid utilities (evidence: `pygmtsar/pygmtsar/IO.py`)
- Stack workflow → Dask progress: tracks computation
- Stack workflow → Joblib progress: tracks parallel tasks
