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

num2date only_use_cftime_datetimes argument not working as expected #165

Closed
mommebutenschoen opened this issue Apr 17, 2020 · 2 comments
Closed

Comments

@mommebutenschoen
Copy link

According to the docstring of the num2date function, with the option only_use_cftime_datetimes=False the function should return python datetime instances where possible:

**`only_use_cftime_datetimes`**: if False, python datetime.datetime
objects are returned from num2date where possible; if True dates which
subclass cftime.datetime are returned for all calendars. Default `True`.

However, this doesn't seem to be the case:

In [1]: from cftime import num2date,num2pydate

In [2]: num2date(0,units="seconds since 2000-01-01 00:00:00",only_use_cftime_datetimes=False)
Out[2]: cftime.DatetimeGregorian(2000-01-01 00:00:00)

In [3]: num2pydate(0,units="seconds since 2000-01-01 00:00:00")
Out[3]: datetime.datetime(2000, 1, 1, 0, 0)

cftime version 1.1.1.2
python 3.7.6
Linux 3.10.0-957.el7.x86_64

jswhit added a commit that referenced this issue Apr 17, 2020
@jswhit
Copy link
Collaborator

jswhit commented Apr 17, 2020

Confirmed - potential fix in PR #166

jswhit added a commit that referenced this issue Apr 18, 2020
@jswhit
Copy link
Collaborator

jswhit commented Apr 18, 2020

closed by PR #166

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

No branches or pull requests

2 participants