def test_lazy_points(self): # Getting lazy points realises them. coord = AuxCoord(self.pts_lazy) self.assertTrue(coord.has_lazy_points()) result = coord.points self.assertFalse(coord.has_lazy_points()) self.assertEqualRealArraysAndDtypes(result, self.pts_real)
def test_masked_pts_real(self): data = self.masked_pts_real self.assertTrue(ma.isMaskedArray(data)) self.assertTrue(ma.count_masked(data)) coord = AuxCoord(data) self.assertFalse(coord.has_lazy_points()) self.assertTrue(ma.isMaskedArray(coord.points)) self.assertTrue(ma.count_masked(coord.points))
def test_masked_pts_lazy(self): data = self.masked_pts_lazy computed = data.compute() self.assertTrue(ma.isMaskedArray(computed)) self.assertTrue(ma.count_masked(computed)) coord = AuxCoord(data) self.assertTrue(coord.has_lazy_points()) self.assertTrue(ma.isMaskedArray(coord.points)) self.assertTrue(ma.count_masked(coord.points))
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)
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())
def test_lazy_bounds_with_lazy_points(self): # Getting lazy bounds does not fetch the points. coord = AuxCoord(self.pts_lazy, bounds=self.bds_lazy) coord.bounds self.assertTrue(coord.has_lazy_points())
def test_lazy_core_realise(self): coord = AuxCoord(self.pts_lazy) coord.points result = coord.has_lazy_points() self.assertFalse(result)
def test_lazy_core(self): coord = AuxCoord(self.pts_lazy) result = coord.has_lazy_points() self.assertTrue(result)
def test_real_core(self): coord = AuxCoord(self.pts_real) result = coord.has_lazy_points() self.assertFalse(result)