Unidata/cftime

num2date only_use_cftime_datetimes argument not working as expected

mommebutenschoen opened this issue · 2 comments

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

Confirmed - potential fix in PR #166

closed by PR #166