MintPy icon indicating copy to clipboard operation
MintPy copied to clipboard

Modified asc_desc2horz_vert.py to specify different dataset for each input files

Open bjmarfito opened this issue 4 months ago • 1 comments

Description of proposed changes

Modified asc_desc2horz_vert.py to specify different dataset other than the same dataset for the two input files when decomposing to horizontal and vertical displacement/velocity.

Reminders

  • [ ] Fix #xxxx
  • [ ] 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

Allow users to specify a different dataset name for each input file when converting ascending/descending measurements to horizontal and vertical components

New Features:

  • Accept multiple dataset names via the -d/--dset CLI option to map one dataset per input file
  • Use each provided dataset name when reading attributes and data for its corresponding file instead of assuming a single common dataset

Enhancements:

  • Maintain backward compatibility by falling back to the original single-dataset behavior if only one name is given

bjmarfito avatar Aug 27 '25 06:08 bjmarfito

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Enable per-file dataset selection by converting the --dset/ ds_name parameter to a list, updating the CLI to accept multiple dataset names, and adjusting internal logic to read attributes and LOS data using the corresponding dataset entry for each input file.

Class diagram for updated input parameter handling in asc_desc2horz_vert.py

classDiagram
    class Inps {
        file: list[str]
        ds_name: list[str]  // now supports multiple dataset names
        geom_file: list[str]
    }
    class run_asc_desc2horz_vert {
        +run_asc_desc2horz_vert(inps: Inps)
    }
    Inps <.. run_asc_desc2horz_vert: uses

Flow diagram for per-file dataset selection in asc_desc2horz_vert.py

flowchart TD
    A[Start] --> B[Parse CLI arguments]
    B --> C{Are multiple datasets specified?}
    C -- Yes --> D[Assign each ds_name to corresponding file]
    C -- No --> E[Use single ds_name for both files]
    D --> F[Read attributes and data per file/dataset]
    E --> F
    F --> G[Continue processing]

File-Level Changes

Change Details Files
Extend CLI to accept multiple dataset names for input files
  • Change --dset parser to use nargs='+' and produce a list of dataset names
  • Update ds_name parameter type to list of strings
src/mintpy/cli/asc_desc2horz_vert.py
Update dataset handling in asc_desc2horz_vert.py to support per-file datasets
  • Use ds_name[0] for overlap attribute calculation
  • Introduce dataset_order = len(ds_name) for conditional logic
  • Branch LOS data read: iterate per file index to pick ds_name[i], fallback to original ds_name for single entry
src/mintpy/asc_desc2horz_vert.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

  • 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 Aug 27 '25 06:08 sourcery-ai[bot]