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

Updates for cftime 1.5.0 #168

Merged
merged 11 commits into from
Jun 8, 2021
Merged

Updates for cftime 1.5.0 #168

merged 11 commits into from
Jun 8, 2021

Conversation

rcomer
Copy link
Member

@rcomer rcomer commented May 25, 2021

Closes #166. As well as the utime object, the julian date functions were also removed at Unidata/cftime#235 and the note in the changelog says they are replaced by toordinal and fromordinal.

Note that the first commit here is from #165, which was included in v2.1.5. I have then changed the default behaviour of the various num2date functions to return a cftime object, consistent with the cftime.num2date function. This goes some way to closing #161, though I have not here exposed the only_use_python_datetimes option. I agree that that would be desirable, but it would be easy to add in a separate PR and I think there is already more than enough here for the reviewer to wade through!

* make proper datetimes default

* replace cftime.utime.num2date with cftime.num2date

* attempt fixes

* pass both utime and Unit to _num2date_to_nearest_second

* revert _num2date_to_nearest_second calling sequence

* dummy commit to kick travis

* appease stickler

* license headers

* contain only_use_cftime_datetimes within utime object

* revert test__num2date_to_nearest_second.py

* actually pass flag to where it is needed

* reinstate type check

* Reinstate _num2date_to_nearest_second changes

This reverts commit 0b89777.

* reinstate test changes

* make sure option is passed down num2date
@coveralls
Copy link

coveralls commented May 25, 2021

Coverage Status

Coverage decreased (-0.03%) to 91.618% when pulling c8056ad on rcomer:remove-utime into 3a85094 on SciTools:master.

cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/__init__.py Outdated Show resolved Hide resolved
@trexfeathers trexfeathers self-assigned this Jun 7, 2021
@trexfeathers trexfeathers linked an issue Jun 7, 2021 that may be closed by this pull request
cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/__init__.py Outdated Show resolved Hide resolved
@rcomer rcomer linked an issue Jun 7, 2021 that may be closed by this pull request
Copy link
Collaborator

@trexfeathers trexfeathers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @rcomer, this is great work, and I'm very glad that someone as experienced as you with units has been working on this problem!

A few changes if you don't mind.

cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/__init__.py Outdated Show resolved Hide resolved
cf_units/tests/test_unit.py Outdated Show resolved Hide resolved
@rcomer
Copy link
Member Author

rcomer commented Jun 8, 2021

Thanks @trexfeathers for your thorough review. I think I've addressed everything.

@trexfeathers trexfeathers merged commit 2d18578 into SciTools:master Jun 8, 2021
@rcomer
Copy link
Member Author

rcomer commented Jun 8, 2021

Thanks @trexfeathers! 🎉

@rcomer rcomer deleted the remove-utime branch June 8, 2021 16:37
@rcomer rcomer added this to the v3.0.0 milestone Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop using cftime.utime Change of behaviour due to latest cftime Incompatibility of num2date
4 participants