Skip to content

Load ARIA-tools generated ionosphere stack from the template file #1328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ehavazli
Copy link
Contributor

@ehavazli ehavazli commented Mar 5, 2025

  • Add the --iono option to load_data.py arguments so when ionosphere file is given in the template, the load_data step will read the ionoStack.vrt.
  • Fix a bug in prep_aria.py which was causing the script to skip loading to ionStack.h5

Summary by Sourcery

Adds the ability to load ARIA-tools generated ionosphere stack from the template file using the --iono option in load_data.py. Fixes a bug in prep_aria.py that prevented loading to ionStack.h5.

New Features:

  • Adds the --iono option to load_data.py arguments so when ionosphere file is given in the template, the load_data step will read the ionoStack.vrt.

Bug Fixes:

  • Fixes a bug in prep_aria.py which was causing the script to skip loading to ionStack.h5

Copy link
Contributor

sourcery-ai bot commented Mar 5, 2025

Reviewer's Guide by Sourcery

This pull request introduces the ability to load ionosphere data from a template file using the --iono option in load_data.py. It also fixes a bug in prep_aria.py that was preventing the ionosphere stack from being loaded correctly.

Sequence diagram for loading ionosphere data with load_data.py

sequenceDiagram
  participant User
  participant load_data.py
  participant mintpy.load.ionUnwFile

  User->>load_data.py: Executes load_data.py with --iono option
  load_data.py->>mintpy.load.ionUnwFile: Reads ionosphere data from file specified by --iono
  mintpy.load.ionUnwFile-->>load_data.py: Returns ionosphere data
  load_data.py-->>User: Completes data loading
Loading

Sequence diagram for loading ionosphere stack with prep_aria.py

sequenceDiagram
  participant prep_aria.py
  participant writefile.layout_hdf5

  prep_aria.py->>writefile.layout_hdf5: Writes ionosphere stack to ionStack.h5
  writefile.layout_hdf5-->>prep_aria.py: Completes writing
Loading

File-Level Changes

Change Details Files
Added the --iono option to load_data.py to enable reading the ionoStack.vrt file when specified in the template.
  • Added the --iono argument to the ARG2OPT_DICT dictionary, mapping it to the mintpy.load.ionUnwFile option.
src/mintpy/load_data.py
Fixed a bug in prep_aria.py that prevented loading to ionStack.h5.
  • Moved the definition of outname outside of the if statement to ensure it's always defined.
  • Updated the out_file argument in the run_or_skip function call to use the outname variable.
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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

Overall Comments:

  • Consider adding a unit test for the new --iono option in load_data.py.
  • The bug fix in prep_aria.py looks good, but could benefit from a brief comment explaining the original issue.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@ehavazli ehavazli requested review from yunjunz and sssangha March 5, 2025 02:22
@ehavazli
Copy link
Contributor Author

ehavazli commented Apr 2, 2025

Here is additional context for the bug fix in prep_aria.py:

The issue arises when smallbaselineApp.py is run directly with a template that includes ionoStack.vrt from an ARIA GUNW stack. By default, smallbaselineApp.py calls prep_aria.py with the --update flag, which causes it to skip loading certain files if their output already exists. Since ionStack.h5 is formatted the same as ifgramStack.h5, the prep_aria.py call assumes the output file name as ifgramStack.h5 and skips loading.

However, since ionStack.h5 is never created, the workflow fails at the correct_ionosphere step due to the missing file with TypeError: sequence item 7: expected str instance, NoneType found. This fix reorders the logic to define out_name before the run_or_skip() call, ensuring the conditional correctly considers ionStack.h5 and triggers its loading if needed.

@yunjunz I don't see a specific ARIA test under the tests folder. Please let me know if I should add a tests/test_load_data.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.

2 participants