-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 use_cftime option to open_dataset #2759
Conversation
xarray/coding/times.py
Outdated
if calendar in _STANDARD_CALENDARS: | ||
warnings.warn( | ||
'Unable to decode time axis into full ' | ||
'numpy.datetime64 objects, continuing using dummy ' |
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.
maybe not call them 'dummy' anymore?
'numpy.datetime64 objects, continuing using dummy ' | |
'numpy.datetime64 objects, continuing using ' |
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.
Yes, that's a good idea.
Let me suggest a slight variation: let's make the behavior of
|
As of #2516 this is already the default behavior :) |
OK, great! Maybe we should just update the description of |
Good idea! See my update in 52866a8. |
xarray/coding/times.py
Outdated
@@ -397,15 +407,17 @@ def encode(self, variable, name=None): | |||
|
|||
return Variable(dims, data, attrs, encoding) | |||
|
|||
def decode(self, variable, name=None): | |||
def decode(self, variable, name=None, use_cftime=None): |
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.
Should we keep this option on the __init__
method instead? That’s what we’ve done for other coder objects.
I think that is a little nicer since it makes it more obvious how to use coders.
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.
Agreed. That is nicer.
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.
Looks good to me. Feel free to merge this if you're happy with it!
Ok merging now! Thanks @shoyer for your initial design suggestion. |
* upstream/master: Rework whats-new for 0.12 Add whats-new for 0.12.1 Release 0.12.0 enable loading remote hdf5 files (pydata#2782) Push back finalizing deprecations for 0.12 (pydata#2809) Drop failing tests writing multi-dimensional arrays as attributes (pydata#2810) some docs updates (pydata#2746) Add support for cftime.datetime coordinates with coarsen (pydata#2778) Don't use deprecated np.asscalar() (pydata#2800) Improve name concat (pydata#2792) Add `Dataset.drop_dims` (pydata#2767) Quarter offset implemented (base is now latest pydata-master). (pydata#2721) Add use_cftime option to open_dataset (pydata#2759) Bugfix/reduce no axis (pydata#2769) 'standard' now refers to 'gregorian' in cftime_range (pydata#2771)
Based on @shoyer's suggestion in #2754 (comment).
whats-new.rst
for all changes andapi.rst
for new API