-
-
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
split out CFDatetimeCoder, deprecate use_cftime as kwarg #9901
base: main
Are you sure you want to change the base?
Conversation
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 like this but since this is adding public API, can you open an issue and see if everyone is on board please
Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
for more information, see https://pre-commit.ci
Can you explicitely write how to change this in the deprecation warning? As is I don't find it obvious what users have to do. ('Use I am also a bit surprised that the CFDateTimeCoder does not imply Is the use of (Removing an arg is always nice but I use this a lot and its much more verbose...) |
@mathause Thanks for sharing your concerns and suggestions.
Yes, this is a bit sparse, how is it with: import xarray as xr
time_coder = xr.coders.CFDatetimeCoder(use_cftime=True)
ds = xr.open_dataset(decode_times=time_coder)
So the current state of affairs is: The default state of
As the current behaviour is preserved, we might skip the DeprecationWarning for now until all I'll rework the DeprecationWarning to more explicit in what to do, but we should decide whether we want to warn from now or postpone this until we have a clear way of how to do things. |
emit_user_level_warning( | ||
"Usage of 'use_cftime' as kwarg is deprecated. " | ||
"Please initialize it with CFDatetimeCoder and " | ||
"'decode_times' kwarg.", |
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.
"'decode_times' kwarg.", | |
"'decode_times' kwarg.\n", | |
"Example usage:\n", | |
" time_coder = xr.coders.CFDatetimeCoder(use_cftime=True)\n", | |
" ds = xr.open_dataset(decode_times=time_coder)\n", |
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.
@mathause Would that help in the DeprecationWarning?
whats-new.rst
api.rst
This makes something like this possible: