def test_Query_datetime1(self): d = cf.Data([[1., 5.], [6, 2]], 'days since 2000-12-29 21:00:00', calendar='standard') message = 'Diff =' + str( (d - cf.Data(cf.dt('2001-01-03 21:00:00', calendar='standard'))).array) self.assertTrue((d == cf.eq(cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[False, True], [False, False]]), verbose=2), message) self.assertTrue((d == cf.ne(cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[True, False], [True, True]])), message) self.assertTrue((d == cf.ge(cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[False, True], [True, False]])), message) self.assertTrue((d == cf.gt(cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[False, False], [True, False]])), message) self.assertTrue((d == cf.le(cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[True, True], [False, True]])), message) self.assertTrue((d == cf.lt(cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[True, False], [False, True]])), message) self.assertTrue((d == cf.wi(cf.dt('2000-12-31 21:00:00'), cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[False, True], [False, True]])), message) self.assertTrue((d == cf.wo(cf.dt('2000-12-31 21:00:00'), cf.dt('2001-01-03 21:00:00'))).equals( cf.Data([[True, False], [True, False]])), message) self.assertTrue((d == cf.set([ cf.dt('2000-12-31 21:00:00'), cf.dt('2001-01-03 21:00:00') ])).equals(cf.Data([[False, True], [False, True]])), message) _ = cf.seasons() [ cf.seasons(n, start) for n in [1, 2, 3, 4, 6, 12] for start in range(1, 13) ] with self.assertRaises(Exception): cf.seasons(13) with self.assertRaises(Exception): cf.seasons(start=8.456) _ = cf.mam() _ = cf.djf() _ = cf.jja() _ = cf.son()
print(b) print(b.array) b = a.collapse('area: mean', weights='area') print(b) b = a.collapse('area: mean', weights='area').collapse('T: maximum') print(b) print(b.array) b = a.collapse('area: mean T: maximum', weights='area') print(b.array) y = cf.Y(month=12) y b = a.collapse('T: maximum', group=y) print(b) b = a.collapse('T: maximum', group=6) print(b) b = a.collapse('T: maximum', group=cf.djf()) print(b) c = cf.seasons() c b = a.collapse('T: maximum', group=c) print(b) b = a.collapse('X: mean', group=cf.Data(180, 'degrees')) print(b) b = a.collapse('T: mean within years T: mean over years', within_years=cf.seasons(), weights='T') print(b) print(b.coordinate('T').bounds.datetime_array) b = a.collapse('T: minimum within years T: variance over years', within_years=cf.seasons(), weights='T')