-
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
Calendar conversion #426
Calendar conversion #426
Conversation
Pull Request Test Coverage Report for Build 1788
💛 - Coveralls |
@Zeitsperre Working on the xarray failures this morning. Unless you already had some insight on them? Also any idea on the "connection failures" ones? |
xarray@master is failing because of pydata/xarray#4009, not our fault! |
Should I start with this before sdba? |
@tlogan2000 Yes! If this is ok, I would like to use it in |
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.
I think this will need additional documentation to clarify the options to drop and add days.
xclim/core/calendar.py
Outdated
Only converts the individual timestamps, does not modify any data excpet in dropping invalid/surplus dates. | ||
|
||
If the source and target calendars are either no_leap, all_leap or standard, only the type of the time array is modified. | ||
When converting to a leap year from a non-leap year, the 29th of february is simply removed from the array. |
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.
When converting to a leap year from a non-leap year, the 29th of february is simply removed from the array. | |
When converting to a leap year from a non-leap year, the 29th of February is simply removed from the array. |
Co-Authored-By: David Huard <huard.david@ouranos.ca>
En fait, the '360_day' behaviour I coded might not be the best.
|
Definitely not option 3 I would think. Option 2 not great ... so I think I prefer option 1 Question though could nn interp be a better choice depending on variable? Anyways I would go with linear for now and we can see if we add a nn interp as a user option at a later date |
Sorry I missed option 4. This seems ok I guess but should not be the default... Is this all coded already? Sorry haven't had time to look at the PR yet. Anyways, people already have trouble understanding the 360_day calendar so asking them to provide missing is likely to be an 'expert' only option |
No, only 1 is coded. But to be clear : I am talking of interpolating the time coordinate only not the data. Right now, |
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.
Could only give a brief look, but nothing to comment on.
Pull Request Checklist:
bumpversion (minor / major / patch)
has been called on this branchgit push --tags
)Adds the new
convert_calendar
andinterp_calendar
methods (and some other utilities) toxclim.core.calendar
to help in conversion of data between calendars.convert_calendar
simply modifies the type of the timestamps, not touching the data, unless invalid dates are found (like 29th of Feb on a "noleap" cal). In that case the timeslices (and data) are simply removed. This goes in the sense of #419 as it is completely agnostic of the data frequency.interp_calendar
interpolates the data while converting to the new calendar. While the other accepts named calendars, this one needs the target time coordinate. Interpolation is made on the "decimal year" basis, so the decimal number representing the date as a number of years since 1-01-01 AD. As such, it only gives something useful with daily data or coarser.Yes, I only kept references to calendars available in cftime (+ 'standard'). So I removed "no_leap" (use "noleap") and "uniform30day" (use "360_day").