MintPy icon indicating copy to clipboard operation
MintPy copied to clipboard

Load ARIA-tools generated ionosphere stack from the template file

Open ehavazli opened this issue 11 months ago • 2 comments

  • 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

ehavazli avatar Mar 05 '25 02:03 ehavazli

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

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

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

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Mar 05 '25 02:03 sourcery-ai[bot]

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

ehavazli avatar Apr 02 '25 20:04 ehavazli