From 32c8496861b9a3932309e8af0e3f242b98a9474c Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Tue, 22 Oct 2019 09:27:35 -0600 Subject: [PATCH 1/5] fix for issue #126 --- cftime/_cftime.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cftime/_cftime.pyx b/cftime/_cftime.pyx index 046af25a..24fee02d 100644 --- a/cftime/_cftime.pyx +++ b/cftime/_cftime.pyx @@ -183,7 +183,7 @@ def date2num(dates,units,calendar='standard'): ismasked = True times = [] for date in dates.flat: - if getattr(date, 'tzinfo') is not None: + if getattr(date, 'tzinfo',None) is not None: date = date.replace(tzinfo=None) - date.utcoffset() if ismasked and not date: From f3da471e6bea21f088e10d0c4619a87410649ba6 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Tue, 22 Oct 2019 09:33:38 -0600 Subject: [PATCH 2/5] add regression test --- test/test_cftime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/test_cftime.py b/test/test_cftime.py index 9b48abef..c978cb92 100644 --- a/test/test_cftime.py +++ b/test/test_cftime.py @@ -711,7 +711,10 @@ def test_tz_naive(self): assert(cftime.date2num(cftime.datetime(1, 12, 1, 0, 0, 0, 0, -1, 1), units='days since 01-01-01',calendar='noleap') == 334.0) assert(cftime.date2num(cftime.num2date(1.0,units='days since 01-01-01',calendar='noleap'),units='days since 01-01-01',calendar='noleap') == 1.0) assert(cftime.date2num(cftime.DatetimeNoLeap(1980, 1, 1, 0, 0, 0, 0, 6, 1),'days since 1970-01-01','noleap') == 3650.0) - + # issue #126 + d = cftime.DatetimeProlepticGregorian(1, 1, 1) + assert(cftime.date2num(d, 'days since 0001-01-01',\ + 'proleptic_gregorian') == 0.0) class TestDate2index(unittest.TestCase): From 9e3aab84e0868f48922fe32565ab0beeb4cb32d8 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Tue, 22 Oct 2019 09:46:00 -0600 Subject: [PATCH 3/5] bump version number --- cftime/_cftime.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cftime/_cftime.pyx b/cftime/_cftime.pyx index 24fee02d..c46251d4 100644 --- a/cftime/_cftime.pyx +++ b/cftime/_cftime.pyx @@ -43,7 +43,7 @@ cdef int[13] _spm_366day = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 33 _rop_lookup = {Py_LT: '__gt__', Py_LE: '__ge__', Py_EQ: '__eq__', Py_GT: '__lt__', Py_GE: '__le__', Py_NE: '__ne__'} -__version__ = '1.0.4' +__version__ = '1.0.4.1' # Adapted from http://delete.me.uk/2005/03/iso8601.html # Note: This regex ensures that all ISO8601 timezone formats are accepted - but, due to legacy support for other timestrings, not all incorrect formats can be rejected. From ee028df3e693842a206b4f59f4cd6f44c6a327cd Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Tue, 22 Oct 2019 09:49:49 -0600 Subject: [PATCH 4/5] add GPL to license (issue #116) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c8c2fb80..70edac54 100644 --- a/setup.py +++ b/setup.py @@ -119,4 +119,4 @@ def description(): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering', - 'License :: OSI Approved']) + 'License :: OSI Approved :: GNU Genereal Public License V3 (GPLV3)']) From 68d7bce90ba157d569f3b9129cf4831bde2d5a39 Mon Sep 17 00:00:00 2001 From: Jeff Whitaker Date: Tue, 22 Oct 2019 09:56:28 -0600 Subject: [PATCH 5/5] fix typo --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 70edac54..532754d0 100644 --- a/setup.py +++ b/setup.py @@ -119,4 +119,4 @@ def description(): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering', - 'License :: OSI Approved :: GNU Genereal Public License V3 (GPLV3)']) + 'License :: OSI Approved :: GNU General Public License V3 (GPLV3)'])