-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
cftime.datetime returns an object of type cftime._cftime.datetime, which cannot be added to or subtracted from using a timedelta. Based on its calendar keyword argument, I would expect it to return a subclass such as DatetimeJulian which has arithmetic defined.
Python 3.7.4 (default, Aug 13 2019, 15:17:50)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cftime
>>> dt = cftime.datetime(2020, 1, 1, calendar="julian")
>>> from datetime import timedelta
>>> dt += timedelta(hours=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +=: 'cftime._cftime.datetime' and 'datetime.timedelta'
>>> cftime.__version__
'1.2.1'
Metadata
Metadata
Assignees
Labels
No labels