예제 #1
0
 def test_ncGetTimeValues(self):
     """Test ncGetTimes returns correct time values"""
     ncobj = netCDF4.Dataset(self.ncfile)
     times = nctools.ncGetTimes(ncobj)
     start = datetime.strptime(ncobj.variables['time'].units,
                               'hours since %Y-%m-%d %H:%M:%S')
     t = np.array([start + timedelta(hours=t) for t in range(self.nrecs)])
     self.numpyAssertEqual(t, times)
     ncobj.close()
예제 #2
0
 def test_ncGetTimeValues(self):
     """Test ncGetTimes returns correct time values"""
     ncobj = netCDF4.Dataset(self.ncfile)
     times = nctools.ncGetTimes(ncobj)
     start = datetime.strptime(ncobj.variables['time'].units,
                               'hours since %Y-%m-%d %H:%M:%S')
     t = np.array([start + timedelta(hours=t) for t in range(self.nrecs)])
     self.numpyAssertEqual(t, times)
     ncobj.close()
예제 #3
0
 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)
     #  Note: cftype.real_datetime inherits from datetime.datetime
     print(type(times[0]))
     self.assertTrue(issubclass(type(times[0]), datetime))
예제 #4
0
 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)
예제 #5
0
 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)