Skip to content

Conversation

@yunjunz
Copy link
Member

@yunjunz yunjunz commented Dec 13, 2025

Description of proposed changes

  • smallbaselineApp:

    • generate maskObs.h5, in addition to maskConnComp.h5 file, in reference_point step
    • use -m maskObs.h5 while plotting geometry at the end to get rid of the zero values in the incidence/azimuthAngle and lat/lon data for a more meaningful display
  • modify_network: print # of acquisitions to keep

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.

+ smallbaselineApp:
   - generate maskObs.h5, in addition to maskConnComp.h5 file, in reference_point step
   - use `-m maskObs.h5` while plotting geometry at the end to get rid of the zero values in the incidence/azimuthAngle and lat/lon data for a more meaningful display

+ modify_network: print # of acquisitions to keep
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 13, 2025

Reviewer's Guide

This PR teaches smallbaselineApp to generate a new observation mask from the geometry file and use it when plotting geometry products, and enhances modify_network to print the number of acquisitions kept, improving diagnostic output and visualization quality.

Sequence diagram for generating and using maskObs.h5 in smallbaselineApp

sequenceDiagram
    participant app as smallbaselineApp
    participant ut as ut
    participant gm as generate_mask
    participant ta as temporal_average
    participant viewer as view_command

    app->>ut: check_loaded_dataset(workDir, print_msg=False)
    ut-->>app: stack_file, geom_file

    app->>gm: main([stack_file, --nonzero, -o maskConnComp.h5, --update])
    app->>ta: main([stack_file, --dataset, phase, -o avgSpatialCoh.h5])
    app->>ta: main([stack_file, --dataset, phase, -o avgSpatialSNR.h5])

    app->>gm: main([geom_file, incidenceAngle, --nonzero, -o maskObs.h5, --update])

    app->>viewer: plot_result(print_aux=True)
    viewer->>viewer: relpath(stack_file, geom_file, maskObs.h5, maskTempCoh.h5)
    viewer->>viewer: build geometry view args [geom_file, -m, maskObs.h5]
    viewer-->>app: geometry plotted without zero valued observations
Loading

Updated class diagram for smallbaselineApp and modify_network

classDiagram
    class smallbaselineApp {
        workDir
        generate_ifgram_aux_file()
        run_reference_point(step_name)
        plot_result(print_aux)
    }

    class modify_network {
        get_date12_to_drop(inps)
    }

    smallbaselineApp : maskConnComp_h5
    smallbaselineApp : maskObs_h5
    smallbaselineApp : avgSpatialCoh_h5
    smallbaselineApp : avgSpatialSNR_h5
    smallbaselineApp : geo_dir
    smallbaselineApp : pic_dir

    modify_network : date_to_keep
    modify_network : date_to_drop

    modify_network : print number of acquisitions to remove
    modify_network : print number of acquisitions to keep
Loading

File-Level Changes

Change Details Files
Generate an observation mask (maskObs.h5) from the geometry file during auxiliary file generation and use it when plotting geometry to avoid zero-valued areas.
  • Update generate_ifgram_aux_file to retrieve both stack and geometry files from check_loaded_dataset
  • Rename the existing connected-component mask variable for clarity and add a new path for maskObs.h5
  • Invoke generate_mask on incidenceAngle in the geometry file to create maskObs.h5
  • In plot_result, add maskObs.h5 path handling (including relative path conversion) and pass it via -m when plotting the geometry dataset
src/mintpy/smallbaselineApp.py
Improve modify_network diagnostics by printing the number of acquisitions retained.
  • After computing date_to_keep, print the count and list of acquisitions to keep alongside the already-printed removals
src/mintpy/modify_network.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

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 there - I've reviewed your changes - here's some feedback:

  • In generate_ifgram_aux_file, you assume geom_file is present and contains an incidenceAngle dataset; consider guarding this block (e.g., check geom_file is not None and that incidenceAngle exists) to avoid runtime errors in workflows without geometry.
  • In plot_result, maskObs.h5 is always passed as -m to the geometry view command, but it may not exist if generate_ifgram_aux_file wasn’t run or geometry is missing; consider checking for the file’s existence and falling back to plotting without -m when it’s unavailable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `generate_ifgram_aux_file`, you assume `geom_file` is present and contains an `incidenceAngle` dataset; consider guarding this block (e.g., check `geom_file` is not None and that `incidenceAngle` exists) to avoid runtime errors in workflows without geometry.
- In `plot_result`, `maskObs.h5` is always passed as `-m` to the geometry view command, but it may not exist if `generate_ifgram_aux_file` wasn’t run or geometry is missing; consider checking for the file’s existence and falling back to plotting without `-m` when it’s unavailable.

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.

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