StaMPS-PyRefactor

StaMPS 持久散射体 InSAR 处理链的 Python 移植与重构

GPL-3.0
在 GitHub 查看
本项目基于 StaMPS(Stanford Method for Persistent Scatterers)翻译重构,遵循 GPL-3.0。使用或分发时请保留许可证并引用适当的 StaMPS 文献。本项目非官方 StaMPS 发行版。

概述

StaMPS-PyRefactor 将 MATLAB StaMPS 处理链翻译为 Python 实现,聚焦 ISCE/ISCE2 栈输出的 PS-InSAR 与 SLC 原生 Small Baseline 工作流。中间产物基于 HDF5,参数文件使用 JSON,支持 snaphu 解缠与 GeoPackage/Shapefile 导出。本项目为独立重构,非官方 StaMPS 发行版。

功能特性

ISCE2 直接预处理

prep_isce.py 可直接读取 ISCE2 merged 目录,无需 MATLAB parms.mat。

Steps 1-8 完整实现

从初始加载、gamma 估计、PS 选取、weeding、相位校正、snaphu 解缠到 SCLA/SCN 滤波。

PS 与 SB 双工作流

支持 PS-InSAR 与 SLC 原生 Small Baseline 流程,含 define_sb_pairs 与 build_sb_phase。

HDF5 + JSON 参数

parms.json / localparms.json 替代 MATLAB .mat,优先级 localparms > parms > 代码默认值。

矢量导出

export_results.py 导出速度(mm/yr)与位移时序(mm),默认 GeoPackage,可选 Shapefile。

性能优化

Step 3 gamma 重估计、Step 4/5 合并等关键路径已针对大规模 HDF5 读写优化。

系统架构

ISCE2 merged
prep_isce.py
stamps_main.py (Steps 1-8)
export_results.py

典型 PS 流程:prep_isce 准备补丁与候选点 → stamps_main 执行 Steps 1-8 → export_results 导出 GeoPackage。SB 流程额外使用 define_sb_pairs 与 build_sb_phase 构建 SB 相位。

工作流

  1. prep_isce.py 读取 ISCE2 merged 栈
  2. stamps_main.py Steps 1-8
  3. export_results.py 导出 GeoPackage
python stamps_python/prep_isce.py path/to/merged \
  --output runs/prep_ps \
  --reference-date 20200101 \
  --bootstrap-metadata \
  --range-patches 8 --azimuth-patches 2 \
  --write-step1

python stamps_python/stamps_main.py --start 1 --end 8 --config runs/prep_ps

已完成功能

  • ISCE2 merged 直接预处理与 Python 元数据引导
  • StaMPS Steps 1-8 Python 实现与 snaphu 集成
  • 真实 ISCE2 栈全链 Step 8 验证
  • PS 与 SB 双工作流与 GeoPackage 导出
  • Step 3/4/5 性能优化与 incidence 角提取

已知限制

  • SB 工作流仍需更多跨数据集验证
  • MATLAB 绘图 GUI 未移植
  • TRAIN 对流层校正未端到端移植
  • 尚未正式打包为可安装 Python 包
  • 自动化测试覆盖仍有限

系统要求

  • Python 3.10+(已在 Windows Python 3.11 验证)
  • snaphu 已安装并在 PATH 中可用(Step 6 解缠)
  • ISCE2 merged 栈目录(含 SLC/、geom_reference/、baselines/)
  • pip install -r requirements.txt

快速开始

  1. 1. 安装依赖

    git clone 仓库后执行 pip install -r requirements.txt

  2. 2. PS 预处理

    python stamps_python/prep_isce.py path/to/merged --output runs/prep --reference-date YYYYMMDD --bootstrap-metadata --write-step1

  3. 3. 运行 Steps 1-8

    python stamps_python/stamps_main.py --start 1 --end 8 --config runs/prep

  4. 4. 导出结果

    python stamps_python/export_results.py --input-path runs/prep --output-dir runs/prep/export --format gpkg --correction v-dso

下载

StaMPS-PyRefactor v0.20

2026年6月26日
源码发布

当前版本仅提供源码包,请 clone 仓库后 pip install -r requirements.txt

更新说明

StaMPS-PyRefactor v0.20 adds the first validated Small Baseline (SBAS) workflow support on top of the existing PS-InSAR Python refactor.

Highlights

  • Added SLC-native Small Baseline pair definition with define_sb_pairs.py.
  • Added split SB preprocessing support in prep_isce.py, including SB candidate preparation without immediate phase extraction.
  • Added build_sb_phase.py to build wrapped SB phase samples from co-registered ISCE2 SLC pairs and write Python-native Step-1 HDF5 products.
  • Extended Step 1-8 processing paths for SB projects, including SB-aware merge, unwrapping, SCLA/SCN handling, and export behavior.
  • Updated GeoPackage/Shapefile export so SB time series can be exported through the Python pipeline.
  • Expanded README and operation manual with the recommended Small Baseline workflow and command examples.
  • Added a synthetic regression check for split SB preparation plus SLC-native SB phase building.

Validation

  • Syntax checks passed for the modified Python modules and new SB scripts.
  • stamps_python/tests/prep_isce_sb_split_check.py passed on the synthetic ISCE2 SB fixture.
  • git diff --check passed, with only local LF/CRLF conversion warnings from Git on Windows.

Known limitations

  • SBAS support is now available, but broader numerical equivalence against every MATLAB StaMPS SB branch still needs more datasets.
  • TRAIN/tropospheric correction integrations remain outside this release.
  • The project is still a development refactor, not a packaged Python distribution.

This project is an independent GPL-3.0 refactor and is not the official StaMPS distribution.

StaMPS-PyRefactor v0.10

2026年6月21日
源码发布

当前版本仅提供源码包,请 clone 仓库后 pip install -r requirements.txt

更新说明

StaMPS-PyRefactor v0.10 is the first public development release of the Python refactor of the StaMPS PS-InSAR workflow.

Highlights

  • Python implementation of the PS-InSAR processing chain from Step 1 through Step 8.
  • Direct preprocessing of ISCE2 SLC stack outputs with prep_isce.py.
  • Python-native HDF5 intermediate products and JSON parameter files.
  • SNAPHU integration for phase unwrapping.
  • Improved Step 6 grid construction, Goldstein filtering, look-angle error estimation, and 3D_FULL unwrapping behavior.
  • Deramped velocity and displacement time-series export.
  • GeoPackage output by default, with Shapefile output retained as an option.
  • Windows-focused validation with cross-platform Python code paths.

Validation

  • The full PS-InSAR chain has been run through Step 8 on real ISCE2 SLC stack data.
  • ISCE2 metadata bootstrap and candidate preparation have been validated without requiring MATLAB parameter files.
  • Synthetic regression checks cover small-baseline preparation and core Step 6 grid/unwrapping behavior.

Known limitations

  • The Small Baseline workflow is not yet fully validated end to end.
  • TRAIN/tropospheric correction integrations are not ported end to end.
  • Numerical equivalence with every MATLAB StaMPS branch and optional mode is still being validated.
  • The project is not yet packaged as an installable Python distribution.

This project is an independent GPL-3.0 refactor and is not the official StaMPS distribution.