Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@yunjunz
Copy link
Member

@yunjunz yunjunz commented Jun 2, 2025

Description of proposed changes

  • add timeseries2velocity.py --rm-timfun / --remove-time-functions option to specify the time function components to be removed from the residual file, for customized TS clean up, like GNSS time series.

  • add timefun_names2ds_names() to translate the spcified time function names to the corresponding dataset names/index in the design matrix, to facilitate the customized TS clean up.

  • set default output vel/res filenames for --rm-timefun options

  • .circleci/config.yml: show total num of integration tests for more informative status

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.

+ add `timeseries2velocity.py --rm-timfun / --remove-time-functions` option to specify the time function components to be removed from the residual file, for customized TS clean up, like GNSS time series.

+ add timefun_names2ds_names() to translate the spcified time function names to the corresponding dataset names/index in the design matrix, to facilitate the customized TS clean up.

+ set default output vel/res filenames for --rm-timefun options

+ `.circleci/config.yml`: show total num of integration tests for more informative status
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 2, 2025

Reviewer's Guide

This PR introduces a new --rm-timefun option to the timeseries2velocity workflow, enabling selective removal of specified time-function components from residuals. It adds a helper to map time-function names to design-matrix indices, augments the CLI for argument parsing and default filename logic, and refines console output. Additionally, the CI configuration is updated to enumerate integration tests more informatively.

Sequence Diagram for Residual Calculation with --rm-timefun

sequenceDiagram
    participant CLI as timeseries2velocity.py CLI
    participant RTS2TF as run_timeseries2time_func
    participant TFN2DSN as timefun_names2ds_names

    CLI->>RTS2TF: invoke with parsed inputs (inps)
    RTS2TF->>RTS2TF: Check inps.rm_timefuns
    alt 'all' in inps.rm_timefuns
        RTS2TF->>RTS2TF: Calculate ts_res = ts_data - np.dot(G, m) (all functions removed)
    else Specific time functions provided
        RTS2TF->>TFN2DSN: call timefun_names2ds_names(inps.rm_timefuns, ds_dict.keys())
        TFN2DSN-->>RTS2TF: return rm_ds_names, rm_ds_inds (indices for specified functions)
        RTS2TF->>RTS2TF: Calculate ts_res = ts_data - np.dot(G[:, rm_ds_inds], m[rm_ds_inds, :]) (specific functions removed)
    end
    RTS2TF->>RTS2TF: Write ts_res to inps.res_file
    RTS2TF-->>CLI: Return output filepath
Loading

Class Diagram for Updated timeseries2velocity Modules

classDiagram
    class mintpy_timeseries2velocity {
        <<Python Module: src/mintpy/timeseries2velocity.py>>
        +run_timeseries2time_func(inps) : string
        +timefun_names2ds_names(timefun_names, all_ds_names) : tuple
    }
    class mintpy_cli_timeseries2velocity {
        <<Python Module: src/mintpy/cli/timeseries2velocity.py>>
        +create_parser(subparsers) : ArgumentParser
        +cmd_line_parse(iargs) : Namespace
    }

    mintpy_cli_timeseries2velocity ..> mintpy_timeseries2velocity : uses
    %% mintpy_timeseries2velocity.run_timeseries2time_func calls mintpy_timeseries2velocity.timefun_names2ds_names
Loading

File-Level Changes

Change Details Files
Selective removal of time-function components in residual computation
  • Added conditional logic in run_timeseries2time_func to branch on --rm-timefun values
  • Compute residuals using full design matrix when all is specified or subset of columns when specific functions are removed
  • Inserted status prints for calculating residuals and listing removed functions
src/mintpy/timeseries2velocity.py
Implementation of timefun_names2ds_names helper
  • Filter out non-inverted dataset names
  • Define mapping from time-function names to dataset name patterns (with wildcard support)
  • Match patterns against available datasets and compute their indices
src/mintpy/timeseries2velocity.py
CLI enhancements to support --rm-timefun and default naming
  • Added --rm-timefun argument with choices and default behavior
  • Capture original argv to detect manual options
  • Compute output velocity and residual filenames based on specified time functions and print them
src/mintpy/cli/timeseries2velocity.py
Improved console output for user feedback
  • Print messages when calculating residuals begins
  • Print chosen output filenames when custom suffixes apply
src/mintpy/timeseries2velocity.py
src/mintpy/cli/timeseries2velocity.py
Update CircleCI test labels for clarity
  • Renamed integration test steps to include test counts (e.g., '1/6')
.circleci/config.yml

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 @yunjunz - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 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.

yunjunz and others added 5 commits June 2, 2025 15:16
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@yunjunz yunjunz merged commit c1953bf into insarlab:main Jun 2, 2025
7 checks passed
@yunjunz yunjunz deleted the ts2vel_rm_timefunc branch June 2, 2025 08:12
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