-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Description
The description of cf_units.num2date() claims that it behaves the same as matplotlib.dates.num2date(), which is itself a call to datetime.datetime.fromordinal().
Comparing these calls for day 1,
from cf_units import Unit
from matplotlib.dates import num2date
from datetime import datetime
pg_unit = Unit('days since 001-01-01 00:00:00', calendar='proleptic_gregorian')
print("cfunits.num2date():", pg_unit.num2date(1))
print("matplotlib.dates.num2date():", num2date(1))
print("datetime.datetime.fromordinal():", datetime.fromordinal(1))cfunits.num2date(): 0001-01-02 00:00:00
matplotlib.dates.num2date(): 0001-01-01 00:00:00+00:00
datetime.datetime.fromordinal(): 0001-01-01 00:00:00
The easy answer would be to change the documentation, but I feel like naive use of num2date() should replicate the datetime behaviour.
Metadata
Metadata
Assignees
Labels
No labels