-
-
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
Fix datetime.timedelta casting bug in coding.times.infer_datetime_units #2128
Conversation
xarray/coding/times.py
Outdated
if unique_timedeltas.dtype == np.dtype('O'): | ||
# Convert to np.timedelta64 objects using pandas to work around a | ||
# NumPy casting bug: https://github.com/numpy/numpy/issues/11096 | ||
unique_timedeltas = pd.to_timedelta(unique_timedeltas).values |
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.
use pd.to_timedelta(unique_timedeltas, box=False)
instead of pd.to_timedelta(unique_timedeltas).values
.
@@ -21,4 +20,4 @@ dependencies: | |||
- rasterio | |||
- zarr | |||
- pip: | |||
- cftime | |||
- netcdf4 |
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.
Latest conda-forge netcdf4 does use cftime.
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.
Thanks @ocefpaf -- we need to use pip in this case only since we use this environment to test on the win-32 platform: conda-forge/cftime-feedstock#2.
Thanks @shoyer, it looks like things are green now. Let me know if you have any more comments. |
I can confirm the docs now build properly locally: