Skip to content

Deprecate CalendarDateTime? #81

@spencerkclark

Description

@spencerkclark

CalendarDateTime served a purpose in the early days of nc-time-axis, but I now think it may not be needed anymore, particularly once #75 is addressed (#80). cftime.datetime instances now have a meaningful calendar attribute and their comparisons now check that calendars and datetime components are equal. Should we include a DeprecationWarning in the next release of nc-time-axis?

As an aside, reading some of the existing tests for CalendarDateTime makes me a little uneasy now that cftime.datetime objects have a default calendar of "gregorian" instead of None:

def test_cftime_CalendarDateTime(self):
val = CalendarDateTime(cftime.datetime(2014, 8, 12), "365_day")
result = NetCDFTimeConverter().convert(val, None, None)
expected = 5333.0
assert result == expected
assert np.isscalar(result)

Apparently these still pass despite the fact that the calendar of the datetime object does not match the calendar of the CalendarDateTime object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    New: IssueHighlight a new community raised "generic" issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions