-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!--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 - [x] Tests for the changes have been added (for bug fixes / features) - [x] (If applicable) Documentation has been added / updated (for bug fixes / features) - [x] 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? New `stack_periods` and it's reverse `unstack_periods`. The basic idea is to have `da.rolling(time=window).construct(dim, stride=stride)`, but with `window` and `stride` given as a multiple of a given `freq`, allowing the use of non-uniform temporal periods (like years or months). And to have a reverse method to go back to the linear timeseries. We had `sdba.construct_moving_yearly_window`, this is the generalization of that logic for: - other frequencies than 'YS' - periods of different lengths (MS, QS) - non-uniform calendars Of course, the two latter points will generate an output where the "fake" time axis makes no sense at all, so this is to be use with precaution. ### Does this PR introduce a breaking change? Yes. `sdba.construct_moving_yearly_window` is transparently sent to `stack_periods` with a warning. `sdba.unpack_moving_yearly_window` also warns and calls `unstack_periods` but the `append_ends` argument is not available on the latter. The behaviour is that same as `append_ends=True`.
- Loading branch information
Showing
7 changed files
with
432 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.