Пример #1
0
 def test_set_lazy_bounds(self):
     # Setting new lazy bounds.
     coord = AuxCoord(self.pts_real, bounds=self.bds_real)
     new_bounds = self.bds_lazy + 102.3
     coord.bounds = new_bounds
     result = coord.core_bounds()
     self.assertEqualLazyArraysAndDtypes(result, new_bounds)
Пример #2
0
 def test_set_lazy_bounds(self):
     # Setting new lazy bounds.
     coord = AuxCoord(self.pts_real, bounds=self.bds_real)
     new_bounds = self.bds_lazy + 102.3
     coord.bounds = new_bounds
     result = coord.core_bounds()
     self.assertEqualLazyArraysAndDtypes(result, new_bounds)
Пример #3
0
 def test_remove_bounds(self):
     coord = AuxCoord(points=[0, 1],
                      bounds=[[0, 1], [1, 2]],
                      units='days since 1970-01-01',
                      climatological=True)
     coord.bounds = None
     self.assertFalse(coord.climatological)
Пример #4
0
 def test_set_real_bounds(self):
     # Setting new real bounds does not make a copy.
     coord = AuxCoord(self.pts_real, bounds=self.bds_real)
     new_bounds = self.bds_real + 102.3
     coord.bounds = new_bounds
     result = coord.core_bounds()
     self.assertArraysShareData(
         result, new_bounds,
         'Bounds do not share data with the assigned array.')
Пример #5
0
 def test_set_real_bounds(self):
     # Setting new real bounds does not make a copy.
     coord = AuxCoord(self.pts_real, bounds=self.bds_real)
     new_bounds = self.bds_real + 102.3
     coord.bounds = new_bounds
     result = coord.core_bounds()
     self.assertArraysShareData(
         result, new_bounds,
         'Bounds do not share data with the assigned array.')
Пример #6
0
 def test_set_bounds_with_lazy_points(self):
     # Setting bounds does not change lazy points.
     coord = AuxCoord(self.pts_lazy, bounds=self.bds_real)
     new_bounds = self.bds_real + 102.3
     coord.bounds = new_bounds
     self.assertTrue(coord.has_lazy_points())
Пример #7
0
 def test_fail_bad_shape(self):
     # Setting real points requires matching shape.
     coord = AuxCoord(self.pts_real, bounds=self.bds_real)
     msg = 'must be compatible with points shape'
     with self.assertRaisesRegexp(ValueError, msg):
         coord.bounds = np.array([1.0, 2.0, 3.0])
Пример #8
0
 def test_set_bounds_with_lazy_points(self):
     # Setting bounds does not change lazy points.
     coord = AuxCoord(self.pts_lazy, bounds=self.bds_real)
     new_bounds = self.bds_real + 102.3
     coord.bounds = new_bounds
     self.assertTrue(coord.has_lazy_points())
Пример #9
0
 def test_fail_bad_shape(self):
     # Setting real points requires matching shape.
     coord = AuxCoord(self.pts_real, bounds=self.bds_real)
     msg = 'must be compatible with points shape'
     with self.assertRaisesRegexp(ValueError, msg):
         coord.bounds = np.array([1.0, 2.0, 3.0])