def test_Datetime_dt_vector(self): for v in (2000, [2000], [[2000]], "2000-01-1", ["2000-01-1"]): x = cf.dt_vector(v) self.assertIsInstance(x, np.ndarray) self.assertEqual(x[0], cf.dt(2000, 1, 1)) for v in ([2000, 2001], [[2000], [2001]]): x = cf.dt_vector(v) self.assertIsInstance(x, np.ndarray) self.assertEqual( x.tolist(), [cf.dt(2000, 1, 1), cf.dt(2001, 1, 1)]) for v in ([[2000, 1], [2001, 2]], ["2000-01-1", "2001-02-1"]): x = cf.dt_vector(v) self.assertIsInstance(x, np.ndarray) self.assertEqual( x.tolist(), [cf.dt(2000, 1, 1), cf.dt(2001, 2, 1)])
data = t.del_data() t.has_data() t.set_data(data) t.data d = cf.Data([1, 2, 3], units='days since 2004-2-28') print(d.array) print(d.datetime_array) e = cf.Data([1, 2, 3], units='days since 2004-2-28', calendar='360_day') print(d.array) print(d.datetime_array) date_time = cf.dt(2004, 2, 29) date_time d = cf.Data(date_time, calendar='gregorian') print(d.array) d.datetime_array date_times = cf.dt_vector(['2004-02-29', '2004-02-30', '2004-03-01'], calendar='360_day') print(date_times) e = cf.Data(date_times) print(e.array) print(e.datetime_array) d = cf.Data(['2004-02-29', '2004-02-30', '2004-03-01'], calendar='360_day') d.Units print(d.array) print(d.datetime_array) e = cf.Data(['2004-02-29', '2004-03-01', '2004-03-02'], dt=True) e.Units print(e.datetime_array) f = cf.Data(['2004-02-29', '2004-03-01', '2004-03-02']) print(f.array) f.Units try: