Skip to content

support HyP3 INSAR_GAMMA Sentinel-1D#1496

Open
Alex-Lewandowski wants to merge 2 commits into
mainfrom
feature/HyP3_Sentinel-1D_support
Open

support HyP3 INSAR_GAMMA Sentinel-1D#1496
Alex-Lewandowski wants to merge 2 commits into
mainfrom
feature/HyP3_Sentinel-1D_support

Conversation

@Alex-Lewandowski

@Alex-Lewandowski Alex-Lewandowski commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description of proposed changes

Currently, attempting to load a HyP3 INSAR_GAMMA interferogram generated using a reference and/or secondary Sentinel-1D SLC causes a ValueError: Failed to parse product name from filename: S1DD_*_unw_phase.tif

This PR adds Sentinel-1D support.

Reminders

  • Pass Pre-commit check (green)
  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

Summary by Sourcery

Add support for parsing HyP3 INSAR_GAMMA products generated from Sentinel-1D data.

New Features:

  • Recognize Sentinel-1D HyP3 INSAR_GAMMA product filenames when extracting product name and type.

Tests:

  • Extend prep_hyp3 tests with a case covering Sentinel-1D INSAR_GAMMA filenames.

@sourcery-ai

sourcery-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extends HyP3 INSAR_GAMMA product filename parsing and tests to support Sentinel-1D (S1D*) products by broadening the Sentinel-1 mission code pattern and adding a regression test.

Flow diagram for updated INSAR_GAMMA filename parsing

flowchart TD
    A[Input filename] --> B{matches INSAR_ISCE_SINGLE?}
    B -- yes --> C[set job_type INSAR_ISCE_SINGLE]
    B -- no --> D{matches INSAR_ISCE_MULTI_BURST?}
    D -- yes --> E[set job_type INSAR_ISCE_MULTI_BURST]
    D -- no --> F{matches S1ABCD_INSAR_GAMMA_pattern?}
    F -- yes --> G[set job_type INSAR_GAMMA]
    F -- no --> H[raise ValueError]

    subgraph S1ABCD_INSAR_GAMMA_pattern
        I("pattern S1[ABCD]{2}(_\d{8}T\d{6}){2}_(VV|HH)[PRO]\d{3,4}_INT\d{2}_G_[uw][ec][123F]_[0-9A-F]{4}")
    end

    F -. uses .-> I
Loading

File-Level Changes

Change Details Files
Extend INSAR_GAMMA filename parsing to accept Sentinel-1D mission identifiers and add test coverage.
  • Broaden regular expression mission code character class from [ABC]{2} to [ABCD]{2} when matching INSAR_GAMMA product filenames.
  • Add a new unit test case verifying that a Sentinel-1CD INSAR_GAMMA filename parses to the expected product name and type.
src/mintpy/prep_hyp3.py
tests/test_prep_hyp3.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The updated regex now allows D in both character positions after S1 (i.e., S1[ABCD]{2}), but only the first character represents the platform while the second encodes mode/beam; consider tightening this to the actual allowed values for the second character or adding a brief comment explaining why D is valid there as well.
  • Since INSAR_GAMMA filenames can have suffixes like _unw_phase_clip.tif, it might be clearer to explicitly anchor the regex at the start (^) and rely on the absence of $ to document that only the prefix is validated rather than the full filename.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The updated regex now allows `D` in both character positions after `S1` (i.e., `S1[ABCD]{2}`), but only the first character represents the platform while the second encodes mode/beam; consider tightening this to the actual allowed values for the second character or adding a brief comment explaining why `D` is valid there as well.
- Since INSAR_GAMMA filenames can have suffixes like `_unw_phase_clip.tif`, it might be clearer to explicitly anchor the regex at the start (`^`) and rely on the absence of `$` to document that only the prefix is validated rather than the full filename.

## Individual Comments

### Comment 1
<location path="tests/test_prep_hyp3.py" line_range="23-28" />
<code_context>
         'S1BC_20210807T053645_20250729T053630_VVP1452_INT80_G_weF_9C74_unw_phase_clip.tif'
     ) == ('S1BC_20210807T053645_20250729T053630_VVP1452_INT80_G_weF_9C74', 'INSAR_GAMMA')

+    assert _get_product_name_and_type(
+        'S1CD_20260605T013230_20260606T013240_VVR001_INT80_G_ueF_66F3_foo.tif'
+    ) == ('S1CD_20260605T013230_20260606T013240_VVR001_INT80_G_ueF_66F3', 'INSAR_GAMMA')
+

</code_context>
<issue_to_address>
**suggestion (testing):** Add a regression test that matches the originally failing S1DD *_unw_phase*.tif filename

The original failure was for `S1DD_*_unw_phase*.tif`, but this test uses an `S1CD_...foo.tif` name. Please add a test case with a realistic S1D unw phase filename (e.g. `S1DD_..._unw_phase_clip.tif` or `..._unw_phase.tif`, matching actual HyP3 output) and assert that `_get_product_name_and_type` returns the correct product name and `INSAR_GAMMA` type for it.

```suggestion
    assert _get_product_name_and_type(
        'S1CD_20260605T013230_20260606T013240_VVR001_INT80_G_ueF_66F3_foo.tif'
    ) == ('S1CD_20260605T013230_20260606T013240_VVR001_INT80_G_ueF_66F3', 'INSAR_GAMMA')

    # Regression test for original S1DD unw_phase failure (HyP3-style filename)
    assert _get_product_name_and_type(
        'S1DD_20210807T053645_20250729T053630_VVP1452_INT80_G_weF_9C74_unw_phase_clip.tif'
    ) == ('S1DD_20210807T053645_20250729T053630_VVP1452_INT80_G_weF_9C74', 'INSAR_GAMMA')


    # Old INSAR_ISCE_MULTI_BURST naming convention
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/test_prep_hyp3.py
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