Skip to content

Commit

Permalink
Fixing nctools.ncGetTimes
Browse files Browse the repository at this point in the history
  • Loading branch information
wcarthur committed Sep 7, 2018
1 parent 3c2b1d9 commit c0e96a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Utilities/nctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def ncGetTimes(ncobj, name='time'):
calendar = times.calendar
else:
calendar = 'standard'

dates = num2date(times[:], units, calendar)
#import pdb; pdb.set_trace()
dates = num2date(times[:].data, units, calendar)

return np.array(dates, dtype=datetime)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_nctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,15 @@ def test_ncReadFile(self):
self.numpyAssertEqual(temp_check, temp[nrec])
ncobj.close()

@unittest.skip("Raises value error in netCDF4 v1.4")
#@unittest.skip("Raises value error in netCDF4 v1.4")
def test_ncGetTimes(self):
"""Test ncGetTimes returns datetime objects"""
ncobj = netCDF4.Dataset(self.ncfile)
times = nctools.ncGetTimes(ncobj)
ncobj.close()
self.assertEqual(type(times[0]), datetime)

@unittest.skip("Raises value error in netCDF4 v1.4")
#@unittest.skip("Raises value error in netCDF4 v1.4")
def test_ncGetTimeValues(self):
"""Test ncGetTimes returns correct time values"""
ncobj = netCDF4.Dataset(self.ncfile)
Expand Down

0 comments on commit c0e96a7

Please sign in to comment.