Skip to content
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

Merged
merged 6 commits into from
May 14, 2018

Conversation

spencerkclark
Copy link
Member

@spencerkclark spencerkclark commented May 14, 2018

I can confirm the docs now build properly locally:

screen shot 2018-05-14 at 9 13 10 am

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
Copy link
Member

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
Copy link
Contributor

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.

Copy link
Member Author

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.

@spencerkclark
Copy link
Member Author

Thanks @shoyer, it looks like things are green now. Let me know if you have any more comments.

@shoyer shoyer merged commit 188141f into pydata:master May 14, 2018
@spencerkclark spencerkclark deleted the timedelta-conversion branch May 14, 2018 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants