Skip to content
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

Rolling statistics #1643

Merged
merged 10 commits into from
Feb 19, 2024
Merged

Rolling statistics #1643

merged 10 commits into from
Feb 19, 2024

Conversation

RondeauG
Copy link
Contributor

@RondeauG RondeauG commented Feb 13, 2024

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGES.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Adds xclim.indices.select_rolling_resample_op that acts in a way similar to select_resample_op, but with a rolling window beforehand.

Does this PR introduce a breaking change?

Other information:

@RondeauG RondeauG requested a review from aulemahal February 13, 2024 19:34
@RondeauG
Copy link
Contributor Author

I've done it as a separate index for now, but we could also just add the window argumwents directly in select_resample_op and disable them by default.

xclim/indices/generic.py Outdated Show resolved Hide resolved
tests/test_generic.py Outdated Show resolved Hide resolved
@Zeitsperre Zeitsperre added the priority Immediate priority label Feb 14, 2024
@RondeauG
Copy link
Contributor Author

Just so the info is here on GitHub, an issue affecting this PR is that units on a rolling sum are handled wrong, with for example m3 s-1 becoming d m3 s-1 instead of something like m3.

@Zeitsperre Zeitsperre modified the milestone: v0.48.0 Feb 15, 2024
@aulemahal
Copy link
Collaborator

I added the last asserton the third test. This now requires #1649 to pass.

@Zeitsperre Zeitsperre mentioned this pull request Feb 19, 2024
5 tasks
@RondeauG
Copy link
Contributor Author

@aulemahal Anything missing from this PR?

Copy link
Collaborator

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My approval.

@github-actions github-actions bot added the approved Approved for additional tests label Feb 19, 2024
@coveralls
Copy link

Coverage Status

coverage: 90.191% (+0.004%) from 90.187%
when pulling 318ae06 on rolling_stats
into 7de95fa on master.

@RondeauG RondeauG merged commit 3acb019 into master Feb 19, 2024
26 checks passed
@RondeauG RondeauG deleted the rolling_stats branch February 19, 2024 16:24
Zeitsperre added a commit that referenced this pull request Feb 19, 2024
### What kind of change does this PR introduce?

* Prepares the next release (v0.48.0)

### Does this PR introduce a breaking change?

No.

### Other information:

This is waiting on pull requests #1566 and #1643
RondeauG added a commit that referenced this pull request Dec 10, 2024
<!--Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [ ] This PR addresses an already opened issue (for bug fixes /
features)
    - This PR fixes #xyz
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] (If applicable) Documentation has been added / updated (for bug
fixes / features)
- [ ] CHANGELOG.rst has been updated (with summary of main changes)
- [ ] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added

### What kind of change does this PR introduce?

* The function was added in #1643, but I just realized that I forgot to
expose it in the `__all__`. Thus, it does not appear anywhere in the
xclim documentation.

### Does this PR introduce a breaking change?


### Other information:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests priority Immediate priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a rolling_statistics
4 participants