-
Notifications
You must be signed in to change notification settings - Fork 59
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
Stack and unstack periods #1558
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Co-authored-by: Éric Dupuis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job. I think this kind of logic could be useful to replace map_blocks/map_groups
operations if it can help some computations. Either to create arrays we directly work on, or to deduce time indices that can be used with the philosophy of groupies.
…sdba-better-names
…sdba-better-names
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
New
stack_periods
and it's reverseunstack_periods
.The basic idea is to have
da.rolling(time=window).construct(dim, stride=stride)
, but withwindow
andstride
given as a multiple of a givenfreq
, 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: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 tostack_periods
with a warning.sdba.unpack_moving_yearly_window
also warns and callsunstack_periods
but theappend_ends
argument is not available on the latter. The behaviour is that same asappend_ends=True
.