-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add temporal utilities and averaging functionalities #107
Conversation
31468f7
to
e587572
Compare
Codecov Report
@@ Coverage Diff @@
## main #107 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 8 9 +1
Lines 381 741 +360
==========================================
+ Hits 381 741 +360
Continue to review full report at Codecov.
|
4d26c8b
to
b3f28c1
Compare
83e1bd6
to
09ca9e5
Compare
5f1e0c7
to
daaeb7a
Compare
b13fadc
to
0a2699b
Compare
50ba587
to
c72ead8
Compare
47360f5
to
2f1712d
Compare
2f1712d
to
669f6fa
Compare
Thank you, Tom. |
ef28763
to
3e464af
Compare
No problem, glad to hear! Yes, adding |
5af1cef
to
eb18948
Compare
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.
Some minor review updates
@tomvothecoder this looks great, I wonder are all the various flavours of calendar managed by XCDAT? |
Thanks @durack1! Xarray uses https://xarray.pydata.org/en/stable/user-guide/time-series.html#creating-datetime64-data
|
Ok this is great, it seems all the So the calendar: describes the calendar used in the time calculations. All the values currently
defined in the [CF metadata convention](http://cfconventions.org/cf-conventions/cf-conventions#calendar)
are supported. Valid calendars ‘standard’, ‘gregorian’, ‘proleptic_gregorian’ ‘noleap’,
‘365_day’, ‘360_day’, ‘julian’, ‘all_leap’, ‘366_day’. Default is ‘standard’, which is a
mixed Julian/Gregorian calendar. Just as an FYI, dropping some PyDict_SetItemString(d, "error", PyCdtime_ErrorObject); /* export exception */
DefineLongConstant(d, "StandardCalendar", (long)cdStandard);
DefineLongConstant(d, "GregorianCalendar", (long)cdStandard);
DefineLongConstant(d, "JulianCalendar", (long)cdJulian);
DefineLongConstant(d, "MixedCalendar", (long)cdMixed);
DefineLongConstant(d, "NoLeapCalendar", (long)cdNoLeap);
DefineLongConstant(d, "Calendar360", (long)cd360);
DefineLongConstant(d, "ClimCalendar", (long)cdClim);
DefineLongConstant(d, "ClimLeapCalendar", (long)cdClimLeap);
DefineLongConstant(d, "DefaultCalendar", (long)cdMixed); /* initialize the default calendar */ Which calls #define cdStandardCal 0x11
#define cdClimCal 0x0
#define cdHasLeap 0x100
#define cdHasNoLeap 0x000
#define cd365Days 0x1000
#define cd360Days 0x0000
#define cdJulianCal 0x10000
#define cdMixedCal 0x20000
typedef enum cdCalenType {
cdStandard = ( cdStandardCal | cdHasLeap | cd365Days),
cdJulian = ( cdStandardCal | cdHasLeap | cd365Days | cdJulianCal),
cdNoLeap = ( cdStandardCal | cdHasNoLeap | cd365Days),
cd360 = ( cdStandardCal | cdHasNoLeap | cd360Days),
cdClim = ( cdClimCal | cdHasNoLeap | cd365Days),
cdClimLeap = ( cdClimCal | cdHasLeap | cd365Days),
cdClim360 = ( cdClimCal | cdHasNoLeap | cd360Days),
cdMixed = ( cdStandardCal | cdHasLeap | cd365Days | cdMixedCal)
} cdCalenType; |
Hey everyone, this PR is ready for a final round of review. Here are the associated validation notebooks that I mentioned on our email chain: xCDAT/xcdat-validation#28 @lee1043, @chengzhuzhang, and @pochedls -- feel free to try out the API and look through the notebooks I'm hoping to have this PR ready to be merged by our meeting next Wednesday. Thanks! |
Hi @tomvothecoder , My testing goes smoothly so far. Only have two high level comments:
|
Folks I just came across this, might be worth a quick look to see alternatives https://ncar.github.io/esds/posts/2021/yearly-averages-xarray/ |
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.
Rest of the code LGTM.
- Includes calculating time series averaging, climatology, and departures - Add `bottleneck` to `setup.py` and `conda-env/dev.yml` - Update fixtures for robust testing of edge cases
ac6ebab
to
d9492fa
Compare
- Rename class `TemporalAverageAccessor` to `TemporalAccessor` - Fix tests for centering time with `open_dataset()` and `open_mfdataset()`
- Add check for `self._time_bounds` attr
The requested changes have been made and doesn't require a re-review.
|
Sounds good! |
Description
This PR adds temporal averaging functionality, including calculating time series averaging, climatology, and departures.
Summary of Changes
Validation
If you are interested in the validation of this feature against CDAT, please checkout the notebooks found here: xCDAT/xcdat-validation#28
Future Enhancements
Feature Specification Documentation: https://docs.google.com/document/d/1klHh5LLYcmNSopvptSVYmcgtUVLFnLMueRhfCF6tbaU/edit#
MultiIndex
outputs for time series avg/climatology time coordinates withdatetime
#202Checklist
If applicable: