Skip to content

Pystamps#16

Merged
sirbastiano merged 4 commits intomainfrom
pystamps
Mar 16, 2026
Merged

Pystamps#16
sirbastiano merged 4 commits intomainfrom
pystamps

Conversation

@sirbastiano
Copy link
Copy Markdown
Collaborator

Summary

  • add a canonical sarpyx.snapflow.snap2stamps module for SNAP2StaMPS-style processing
  • keep snap2stamps_pipelines as a compatibility shim while moving package/docs/
    notebook imports to the canonical path
  • implement upstream-equivalent processing branches for TOPSAR and Stripmap, plus fix
    the follow-up API regressions around pair prep, named branch dispatch, and workflow
    execution contracts

What Changed

  • added a branch-aware processing registry for TOPSAR and Stripmap workflows
  • added run_processing_pipeline(...) for named pipeline dispatch
  • added selectors and metadata for pipeline and workflow input shapes
  • extended the SNAP engine with pairwise TOPSAR coregistration and related graph
    helpers
  • updated the notebook and user guide to use sarpyx.snapflow.snap2stamps
  • kept backward compatibility through sarpyx.snapflow.snap2stamps_pipelines

Regression Fixes

  • changed prepare_pair() to default to split-only preprocessing so TOPSAR
    coregistration receives valid burst-level inputs
  • made named topsar_coreg_ifg* dispatch honor the exact requested variant instead of
    silently reselecting from runtime parameters
  • separated single-input and pair-workflow execution so exported workflow names remain
    callable through the correct entrypoint

Verification

  • python3 -m py_compile sarpyx/snapflow/snap2stamps.py sarpyx/snapflow/init.py
    tests/test_snap2stamps_pipelines.py
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python3 -m pytest tests/
    test_snap2stamps_pipelines.py -q

Test result:

  • 16 passed in 1.56s

Notes

  • this PR is processing-only parity work; it does not attempt to recreate the upstream
    CLI/config runner or plotting scripts
  • the deprecated snap2stamps_pipelines path still re-exports the canonical API to
    avoid breaking existing imports

Add a canonical sarpyx.snapflow.snap2stamps module with upstream-equivalent TOPSAR and Stripmap processing branches.

Keep snap2stamps_pipelines as a compatibility shim, update package exports, refresh the notebook and guide imports, and expand tests around branch selection and dispatch.
Correct pair preparation defaults for TOPSAR coregistration, make named TOPSAR pipeline dispatch honor the requested variant, and separate single-input versus pair workflow execution.\n\nAdd regression coverage for the restored contracts and workflow input metadata.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b47a423260

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +978 to +981
pipeline_name = select_topsar_export_pipeline(
master_count=master_count,
external_dem_file=external_dem_file,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor explicit TOPSAR export pipeline selection

run_processing_pipeline is documented as a named dispatcher, but run_topsar_export immediately recomputes pipeline_name from master_count/external_dem_file instead of using the variant the caller requested. This means a call like topsar_export_mergeiw_subset_ext_dem can silently execute the non-_ext_dem branch (or vice versa) when arguments differ, producing a different DEM-processing path than requested and making results non-reproducible.

Useful? React with 👍 / 👎.

Comment on lines +776 to +779
if pipeline_name.startswith("stripmap_dem_assisted_coregistration"):
if pair is None:
raise ValueError(f"{pipeline_name} requires pair=PairProducts(...)")
return run_stripmap_coreg(pair=pair, **common, **kwargs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require external_dem_file for stripmap coreg ext-dem variant

The stripmap_dem_assisted_coregistration_ext_dem named branch is dispatched without checking that external_dem_file is provided, so callers can request the ext-DEM pipeline and still run with default DEM settings. This silently executes a different processing branch than the requested pipeline variant and can alter coregistration outputs.

Useful? React with 👍 / 👎.

Comment on lines +781 to +784
if pipeline_name.startswith("stripmap_interferogram_topophase"):
if source_product is None:
raise ValueError(f"{pipeline_name} requires source_product")
return run_stripmap_ifg(coreg_product=source_product, **common, **kwargs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require external_dem_file for stripmap IFG ext-dem variant

The stripmap_interferogram_topophase_ext_dem branch is also dispatched without enforcing external_dem_file, and run_stripmap_ifg then falls back to SRTM 1Sec HGT. In this case the _ext_dem pipeline name does not guarantee external-DEM processing, so users can unknowingly generate topophase results from the wrong DEM source.

Useful? React with 👍 / 👎.

Update the static docs generator and regenerate the inventory-driven site so sarpyx.snapflow.snap2stamps is documented as the canonical API path, with snap2stamps_pipelines kept as a deprecated compatibility alias.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ee3391060

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

snap_userdir=snap_userdir,
)
selected_pols = [polarisation] if polarisation else None
if select_topsar_split_pipeline(len(products)) == "topsar_assemble_split_applyorbit":
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Respect named TOPSAR split pipeline selection

run_topsar_split_apply_orbit recomputes the branch from len(source_products) and conditionally runs slice_assembly, so an explicit call to run_processing_pipeline("topsar_split_applyorbit", ...) can silently execute the assemble variant (and vice versa). This breaks the contract of named pipeline dispatch and can change preprocessing outputs depending on runtime list length instead of the requested pipeline name.

Useful? React with 👍 / 👎.

Comment on lines +776 to +779
if pipeline_name.startswith("stripmap_dem_assisted_coregistration"):
if pair is None:
raise ValueError(f"{pipeline_name} requires pair=PairProducts(...)")
return run_stripmap_coreg(pair=pair, **common, **kwargs)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject external DEM on stripmap non-ext coreg pipeline

The dispatcher sends both stripmap_dem_assisted_coregistration variants through the same call and forwards **kwargs unchanged, so if a caller selects the non-_ext_dem pipeline but passes external_dem_file (for example via shared config), run_stripmap_coreg still runs the External DEM path. That means the executed coregistration branch can differ from the explicitly requested pipeline name.

Useful? React with 👍 / 👎.

Pin Docker Buildx to a stable version to avoid transient default-image failures and restrict Docker and publish workflows to main-branch execution paths.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a72c0dffc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +761 to +762
if coreg_products is None or ifg_products is None:
raise ValueError(f"{pipeline_name} requires coreg_products and ifg_products")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept pair input for topsar_export dispatch

topsar_export is registered as input_kind="pair" and pipeline_requires_pair("topsar_export") therefore reports that callers should provide a pair, but this dispatcher branch ignores pair and raises unless coreg_products/ifg_products are passed. In practice, run_processing_pipeline("topsar_export", pair=PairProducts(...), ...) fails despite the pipeline metadata advertising a pair-based interface, which makes the helper contract inconsistent and breaks callers that validate inputs via the registry.

Useful? React with 👍 / 👎.

@sirbastiano sirbastiano merged commit 2add53a into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant