Skip to content

Comments

prep_aria: mask azimuthAngle with water mask#1465

Open
sssangha wants to merge 3 commits intomainfrom
prep_aria_watermsk
Open

prep_aria: mask azimuthAngle with water mask#1465
sssangha wants to merge 3 commits intomainfrom
prep_aria_watermsk

Conversation

@sssangha
Copy link
Contributor

@sssangha sssangha commented Feb 18, 2026

Apply water mask to azimuthAngle after applying conversion factor

Before:
Screenshot 2026-02-17 at 11 55 39 PM

After:
Screenshot 2026-02-17 at 11 55 13 PM

Summary by Sourcery

Bug Fixes:

  • Ensure azimuth angle values are nullified over water areas by applying the water mask after the conversion factor.

Apply water mask to azimuthAngle after applying conversion factor
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 18, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Masks the azimuthAngle dataset in the output HDF5 geometry file using the water mask after the conversion factor is applied, ensuring azimuth angles are zeroed out over water pixels.

Flow diagram for applying water mask to azimuthAngle in write_geometry

flowchart TD
    A[Start write_geometry] --> B[Read demFile]
    B --> C[Read incAngleFile]
    C --> D[Optionally read azAngleFile]
    D --> E[Read waterMaskFile]
    E --> F[Write waterMask dataset to HDF5 as waterMask]
    F --> G[Apply conversion factor to azimuthAngle]
    G --> H[Multiply azimuthAngle by waterMask]
    H --> I[Azimuth angles zeroed over water pixels]
    I --> J[Finish writing HDF5 outfile]
    J --> K[Return outfile]
Loading

File-Level Changes

Change Details Files
Apply the water mask to the azimuthAngle dataset after computing waterMask in the geometry writer.
  • After writing waterMask to the HDF5 file, multiply the azimuthAngle dataset in-place by the water mask so azimuth angles are masked over water
  • Keep existing logic for computing and writing waterMask unchanged, only extending it to also affect azimuthAngle
src/mintpy/prep_aria.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

@sssangha sssangha requested a review from mgovorcin February 18, 2026 07:56
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

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:

  • If the intent is to ensure this masking happens strictly after the azimuth angle conversion, consider moving this line adjacent to the conversion logic (or wrapping both in a small helper) rather than relying on a comment to enforce ordering.
  • Confirm that zeroing masked azimuth values is consistent with how other geometry layers are masked (e.g., using 0 vs NaN or a sentinel value), and adjust the masking operation if a different fill value is expected for water pixels.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If the intent is to ensure this masking happens strictly after the azimuth angle conversion, consider moving this line adjacent to the conversion logic (or wrapping both in a small helper) rather than relying on a comment to enforce ordering.
- Confirm that zeroing masked azimuth values is consistent with how other geometry layers are masked (e.g., using 0 vs NaN or a sentinel value), and adjust the masking operation if a different fill value is expected for water pixels.

## Individual Comments

### Comment 1
<location> `src/mintpy/prep_aria.py:300` </location>
<code_context>
             # write
             f['waterMask'][:,:] = water_mask

+            # apply mask to azimuthAngle after coversion factor
+            f['azimuthAngle'][:,:] *= water_mask
+
</code_context>

<issue_to_address>
**nitpick (typo):** Fix small typo in the new inline comment for clarity.

In the new comment, "coversion" should be "conversion" to keep the wording clear.

```suggestion
            # apply mask to azimuthAngle after conversion factor
```
</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.

yunjunz and others added 2 commits February 25, 2026 15:50
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@yunjunz yunjunz changed the title Mask azimuthAngle with water mask prep_aria: mask azimuthAngle with water mask Feb 25, 2026
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.

2 participants