Ways To Resample Non-standard Cftimeindex Calendars (360-day, No-leap-year) With Xarray For Pandas Usage
#60198708 brought me to open this question as I've not found the nice solution yet. The issue I have downloaded several climate models from the EURO-CORDEX ensemble for daily preci
Solution 1:
Thanks for the detailed example! If a time series of monthly means is acceptable for your analysis, I think the cleanest approach would be to resample to "month-start" frequency and then harmonize the date types, e.g. for the datasets indexed by a CFTimeIndex
, something like:
resampled = ds.resample(time="MS").mean()
resampled["time"] = resampled.indexes["time"].to_datetimeindex()
This is basically your second bullet point, but with a minor change. Resampling to month-start frequency gets around the issue that a 360-day calendar contains month ends that do not exist in a standard calendar, e.g. February 30th.
Post a Comment for "Ways To Resample Non-standard Cftimeindex Calendars (360-day, No-leap-year) With Xarray For Pandas Usage"