Beispiel #1
0
 def test_lazy_bounds(self):
     # Getting lazy bounds realises them.
     coord = AuxCoord(self.pts_real, bounds=self.bds_lazy)
     self.assertTrue(coord.has_lazy_bounds())
     result = coord.bounds
     self.assertFalse(coord.has_lazy_bounds())
     self.assertEqualRealArraysAndDtypes(result, self.bds_real)
Beispiel #2
0
 def test_lazy_bounds(self):
     # Getting lazy bounds realises them.
     coord = AuxCoord(self.pts_real, bounds=self.bds_lazy)
     self.assertTrue(coord.has_lazy_bounds())
     result = coord.bounds
     self.assertFalse(coord.has_lazy_bounds())
     self.assertEqualRealArraysAndDtypes(result, self.bds_real)
Beispiel #3
0
 def test_masked_bds_real(self):
     data = self.masked_bds_real
     self.assertTrue(ma.isMaskedArray(data))
     self.assertTrue(ma.count_masked(data))
     coord = AuxCoord(self.pts_real, bounds=data)
     self.assertFalse(coord.has_lazy_bounds())
     self.assertTrue(ma.isMaskedArray(coord.bounds))
     self.assertTrue(ma.count_masked(coord.bounds))
Beispiel #4
0
 def test_no_masked_bds_lazy(self):
     data = self.no_masked_bds_lazy
     computed = data.compute()
     self.assertTrue(ma.isMaskedArray(computed))
     self.assertEqual(ma.count_masked(computed), 0)
     coord = AuxCoord(self.pts_real, bounds=data)
     self.assertTrue(coord.has_lazy_bounds())
     self.assertTrue(ma.isMaskedArray(coord.bounds))
     self.assertEqual(ma.count_masked(coord.bounds), 0)
Beispiel #5
0
 def test_preserves_lazy(self):
     test_bounds = np.array([[[11.0, 12.0], [12.0, 13.0], [13.0, 14.0]],
                             [[21.0, 22.0], [22.0, 23.0], [23.0, 24.0]]])
     test_points = np.array([[11.1, 12.2, 13.3], [21.4, 22.5, 23.6]])
     lazy_points = as_lazy_data(test_points)
     lazy_bounds = as_lazy_data(test_bounds)
     coord = AuxCoord(points=lazy_points, bounds=lazy_bounds, units='m')
     coord.convert_units('ft')
     self.assertTrue(coord.has_lazy_points())
     self.assertTrue(coord.has_lazy_bounds())
     test_points_ft = Unit('m').convert(test_points, 'ft')
     test_bounds_ft = Unit('m').convert(test_bounds, 'ft')
     self.assertArrayAllClose(coord.points, test_points_ft)
     self.assertArrayAllClose(coord.bounds, test_bounds_ft)
Beispiel #6
0
 def test_lazy_points_with_lazy_bounds(self):
     # Getting lazy points does not touch lazy bounds.
     coord = AuxCoord(self.pts_lazy, bounds=self.bds_lazy)
     coord.points
     self.assertTrue(coord.has_lazy_bounds())
Beispiel #7
0
 def test_lazy_core_realise(self):
     coord = AuxCoord(self.pts_real, bounds=self.bds_lazy)
     coord.bounds
     result = coord.has_lazy_bounds()
     self.assertFalse(result)
Beispiel #8
0
 def test_lazy_core(self):
     coord = AuxCoord(self.pts_real, bounds=self.bds_lazy)
     result = coord.has_lazy_bounds()
     self.assertTrue(result)
Beispiel #9
0
 def test_lazy_points_with_lazy_bounds(self):
     # Getting lazy points does not touch lazy bounds.
     coord = AuxCoord(self.pts_lazy, bounds=self.bds_lazy)
     coord.points
     self.assertTrue(coord.has_lazy_bounds())
Beispiel #10
0
 def test_lazy_core_realise(self):
     coord = AuxCoord(self.pts_real, bounds=self.bds_lazy)
     coord.bounds
     result = coord.has_lazy_bounds()
     self.assertFalse(result)
Beispiel #11
0
 def test_lazy_core(self):
     coord = AuxCoord(self.pts_real, bounds=self.bds_lazy)
     result = coord.has_lazy_bounds()
     self.assertTrue(result)