-
-
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
Timedelta64 data cannot be round-tripped to netCDF files without a warning #10099
Comments
+1 this warning has also exploded across my code base and would be a major breaking change if the deprecation cycle is finished. |
Sorry for adding this warning somewhat hastily—I'm not surprised it is coming up frequently. To the extent that anyone is relying on the existing way of decoding / encoding |
That particular |
What is your issue?
We added a future warning about not decoding time units to timedelta64 in #9966 (cc @spencerkclark, @kmuehlbauer).
Unfortunately, this warning is raised by default when reading timedelta64 serialized data to disk. This makes it much harder to use this dtype (which is quite useful for storing the "lead time" dimension in weather forecasts), and means that if we ever do finalize this deprecation warning it will break a lot of users.
I would love to see special handling of
timedelta64
data, similar to what I described here: #1621 (comment). In particular, we could write adtype='timedelta64'
attribute (possibly also with a specified precision) when writing a dataset to disk, which could be interpreted as np.timedelta64 data when reading the data with Xarray. This would allow us to at least ensure that datasets with timedelta64 data that are written to Zarr/netCDF now will always be able to be read faithfullly in the future.To reproduce:
This issues:
FutureWarning: In a future version of xarray decode_timedelta will default to False rather than None. To silence this warning, set decode_timedelta to True, False, or a 'CFTimedeltaCoder' instance.
The text was updated successfully, but these errors were encountered: