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

Further improvements to datetime roundtripping #225

Merged
merged 6 commits into from
Jan 25, 2021

Conversation

spencerkclark
Copy link
Collaborator

@spencerkclark spencerkclark commented Jan 23, 2021

I forget if there was a reason we did not do this before, but this applies an approach I took in xarray (pydata/xarray#4684) to improve the accuracy of roundtripping np.datetime64[ns] dates to cftime.datetime objects. The changes here would mean that we'd do our absolute best to retain an integer dtype when encoding times through date2num.

I've included a pretty challenging test that passes on my machine; however it may not be a valid test on 32-bit systems. Edit: I updated the PR for what I think should allow things to pass on Windows.

@spencerkclark
Copy link
Collaborator Author

I'm not sure why the tests take so long in CI (previous runs took 3+ hours!). The full test suite runs in about 25 seconds on my local machine.

@jswhit
Copy link
Collaborator

jswhit commented Jan 24, 2021

I have no idea why the tests are so slow all of a sudden - they run super fast on my machine too.

@jswhit
Copy link
Collaborator

jswhit commented Jan 24, 2021

I think it's the code coverage that's slowing down the CI tests. I just disabled it in the CI workflow in your branch.

@jswhit
Copy link
Collaborator

jswhit commented Jan 24, 2021

This is really nice @spencerkclark, now we are very close to microsecond roundtrip accuracy. I think all this needs is a Changelog entry.

@spencerkclark
Copy link
Collaborator Author

Ah, disabling the code coverage seemed to do it, thanks! I went ahead and added a Changelog entry. Let me know if you need anything else.

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.

2 participants