-
Notifications
You must be signed in to change notification settings - Fork 32
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
ENH: Add option to resample between two dates using slice_mode
#162
Comments
It seems this feature is already available on xclim (see Ouranosinc/xclim#1069) but I couldn't find the documentation for that. I think it is quite new and that might be why the doc is not yet there. It was introduced by the xclim handles all the cases of slice_mode:
The implementation for "between 2 dates" I did in /enh/in_between_years_season branch (see 1ab7c6a) is not finished but I was going in somewhat the same path as xclim's one by converting dates to their day_of_year and filtering the data between those two d.o.y values. I believe xclim devs did a better job than I by handling different calendars. The best approach now is probably to leave only time_bounds creation in icclim (maybe even try to back-port it to xclim) and parse Besides, I think it's better to hide both |
For info there is already this generic function as well. https://xclim.readthedocs.io/en/stable/indices.html?highlight=aggregate_between#xclim.indices.generic.aggregate_between_dates |
@bzah I thought I would just add that maybe the biggest difference/benefit of the generic |
Oh! I didn't catch that, thank you Travis for clarifying it, that's very interesting indeed. I think it would make sense to integrate it in icclim, as a |
Yes I think it is a very interesting concept (and very useful) to have a different start and end date depending on the gridpoint. I agree that already including that in a user_index operator is very appealing, in all cases. Regarding ECA&D indices, by default I think they assume the same start and end date for all gridpoints (and the same could be said for thresholds like in SU), even in their strict definitions it could be possible to have this spatial variations (they only consider time series in their definitions). This could wait for xclim indicator implementation as there is no urgency to have this spatial variation for the current work. Scientifically it would be quite useful to have this feature of having different start and end date possible depending on the gridpoint, and also the same for thresholds on field values (not percentiles). "Just" need to have proper metadata ........ |
I'm migrating these discussions about aggregate between dates to a dedicated issue: #170 |
Description
The upcoming indices that will be implemented for meteo france will need to be computed between two exact dates.
For example:
Pandas/Xarray resampling feature does not natively accepts two dates as a valid input.
However, we can use something like
da.resample(time="60D")
to resample blocks of 60 days.We can also use xclim
indexer
withdate_bounds=("06-15", "08-25")
. However, this will need some specific development in xclim to enable the feature.So to enable this feature we must:
Remarks:
This will probably be a hassle to handle, so we should just raise a warning when the 29th is in between the two dates.
For now,done in Fix/slice mode on seasons #168slice_mode
custom resampler algo is sub-optimal because for example on custom season we resample to month, we compute the index, then we filter out the unnecessary months. It would be great to have a better implementation when working on this new feature.The text was updated successfully, but these errors were encountered: