Skip to content

Commit

Permalink
Merge 68d7bce into 08d1caa
Browse files Browse the repository at this point in the history
  • Loading branch information
jswhit committed Oct 22, 2019
2 parents 08d1caa + 68d7bce commit 064ceb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cftime/_cftime.pyx
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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 General Public License V3 (GPLV3)'])
5 changes: 4 additions & 1 deletion test/test_cftime.py
Expand Up @@ -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):

Expand Down

0 comments on commit 064ceb7

Please sign in to comment.