def test(self): coord = validity_time_coord(self.frt, self.fp) self.assertIsInstance(coord, DimCoord) self.assertEqual(coord.standard_name, 'time') self.assertEqual(coord.units, self.unit) self.assertEqual(coord.shape, (1,)) point = self.frt.points[0] + self.fp.points[0] self.assertEqual(coord.points[0], point) self.assertFalse(coord.has_bounds())
def test(self): coord = validity_time_coord(self.frt, self.fp) self.assertIsInstance(coord, DimCoord) self.assertEqual(coord.standard_name, 'time') self.assertEqual(coord.units, self.unit) self.assertEqual(coord.shape, (1, )) point = self.frt.points[0] + self.fp.points[0] self.assertEqual(coord.points[0], point) self.assertFalse(coord.has_bounds())
def test_bounded(self): self.fp.bounds = self.fp_test_bounds coord = validity_time_coord(self.frt, self.fp) self.assertIsInstance(coord, DimCoord) self.assertEqual(coord.standard_name, 'time') self.assertEqual(coord.units, self.unit) self.assertEqual(coord.shape, (1,)) point = self.frt.points[0] + self.fp.points[0] self.assertEqual(coord.points[0], point) self.assertTrue(coord.has_bounds()) bounds = self.frt.points[0] + self.fp_test_bounds self.assertArrayAlmostEqual(coord.bounds, bounds)
def test_bounded(self): self.fp.bounds = self.fp_test_bounds coord = validity_time_coord(self.frt, self.fp) self.assertIsInstance(coord, DimCoord) self.assertEqual(coord.standard_name, 'time') self.assertEqual(coord.units, self.unit) self.assertEqual(coord.shape, (1, )) point = self.frt.points[0] + self.fp.points[0] self.assertEqual(coord.points[0], point) self.assertTrue(coord.has_bounds()) bounds = self.frt.points[0] + self.fp_test_bounds self.assertArrayAlmostEqual(coord.bounds, bounds)
def test_fp_shape(self): frt = mock.Mock(shape=(1,)) fp = mock.Mock(shape=(2,)) emsg = 'scalar forecast period' with self.assertRaisesRegexp(ValueError, emsg): validity_time_coord(frt, fp)
def test_fp_shape(self): frt = mock.Mock(shape=(1, )) fp = mock.Mock(shape=(2, )) emsg = 'scalar forecast period' with self.assertRaisesRegexp(ValueError, emsg): validity_time_coord(frt, fp)