From 28e82ff11d93687af233cd4ae1e8df5f1b2c4316 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Thu, 5 Nov 2020 07:20:43 -0700 Subject: [PATCH] switch default calendar in date2num to None --- Changelog | 6 +++--- cftime/_cftime.pyx | 11 +++++++---- test/test_cftime.py | 19 +++++++------------ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Changelog b/Changelog index 3ef52586..d8bf9006 100644 --- a/Changelog +++ b/Changelog @@ -7,9 +7,9 @@ version 1.3.0 (release tag v1.3.0rel) The calendar specific sub-classes are now deprecated, but remain for now as stubs that just instantiate the base class and override __repr__. * update regex in _cpdef _parse_date so reference years with more than four - digits can be handled. Allow 'calendar=None' inr cftime.date2num (calendar associated with first - input datetime object is used - we may want to change the default from 'standard' to None - in a future release). + digits can be handled. + * Change default calendar in cftime.date2num from 'standard' to None + (calendar associated with first input datetime object is used). version 1.2.1 (release tag v1.2.1rel) ===================================== diff --git a/cftime/_cftime.pyx b/cftime/_cftime.pyx index d473d3d9..b53d4b65 100644 --- a/cftime/_cftime.pyx +++ b/cftime/_cftime.pyx @@ -157,7 +157,7 @@ def _can_use_python_datetime(date,calendar): (calendar in ['gregorian','standard'] and date > gregorian and date.year <= MAXYEAR)) @cython.embedsignature(True) -def date2num(dates,units,calendar='standard'): +def date2num(dates,units,calendar=None): """ Return numeric time values given datetime objects. The units of the numeric time values are described by the **units** argument @@ -167,19 +167,22 @@ def date2num(dates,units,calendar='standard'): returned numeric values. **dates**: A datetime object or a sequence of datetime objects. - The datetime objects should not include a time-zone offset. + The datetime objects should not include a time-zone offset. They + can be either native python datetime instances (which use + the proleptic gregorian calendar) or cftime.datetime instances. **units**: a string of the form **