本文整理汇总了Python中iris._data_manager.DataManager.has_lazy_data方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager.has_lazy_data方法的具体用法?Python DataManager.has_lazy_data怎么用?Python DataManager.has_lazy_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iris._data_manager.DataManager
的用法示例。
在下文中一共展示了DataManager.has_lazy_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_zero_ndim_lazy_with_zero_ndim_real
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_zero_ndim_lazy_with_zero_ndim_real(self):
real_array = np.array(456)
dm = DataManager(as_lazy_data(np.array(123)))
self.assertTrue(dm.has_lazy_data())
dm.data = real_array
self.assertFalse(dm.has_lazy_data())
self.assertArrayEqual(dm.data, real_array)
示例2: test_zero_ndim_lazy_to_scalar_1d_real_promote
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_zero_ndim_lazy_to_scalar_1d_real_promote(self):
real_array = np.array([456])
dm = DataManager(as_lazy_data(np.array(123)))
self.assertTrue(dm.has_lazy_data())
dm.data = real_array
self.assertFalse(dm.has_lazy_data())
self.assertArrayEqual(dm.data, real_array)
示例3: test_zero_ndim_lazy_with_zero_ndim_lazy
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_zero_ndim_lazy_with_zero_ndim_lazy(self):
lazy_array = as_lazy_data(np.array(456))
dm = DataManager(as_lazy_data(np.array(123)))
self.assertTrue(dm.has_lazy_data())
dm.data = lazy_array
self.assertTrue(dm.has_lazy_data())
self.assertArrayEqual(dm.data, lazy_array.compute())
示例4: test_real_with_real
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_real_with_real(self):
dm = DataManager(self.real_array * 10)
self.assertFalse(dm.has_lazy_data())
dm.replace(self.real_array)
self.assertFalse(dm.has_lazy_data())
self.assertIs(dm._real_array, self.real_array)
self.assertIs(dm.data, self.real_array)
示例5: test_zero_ndim_lazy_to_scalar_1d_lazy_promote
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_zero_ndim_lazy_to_scalar_1d_lazy_promote(self):
lazy_array = as_lazy_data(np.array([456]))
dm = DataManager(as_lazy_data(np.array(123)))
self.assertTrue(dm.has_lazy_data())
dm.data = lazy_array
self.assertTrue(dm.has_lazy_data())
self.assertArrayEqual(dm.data, lazy_array.compute())
示例6: test_with_real_array
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_with_real_array(self):
dm = DataManager(self.real_array)
self.assertFalse(dm.has_lazy_data())
result = dm.lazy_data()
self.assertFalse(dm.has_lazy_data())
self.assertEqual(result, self.lazy_array)
self.assertFalse(dm.has_lazy_data())
示例7: test_zero_ndim_real_with_scalar_float
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_zero_ndim_real_with_scalar_float(self):
value = 456.0
dm = DataManager(np.array(123))
self.assertFalse(dm.has_lazy_data())
dm.data = value
self.assertFalse(dm.has_lazy_data())
self.assertArrayEqual(dm.data, np.array(value))
示例8: test_lazy_with_lazy
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_lazy_with_lazy(self):
lazy_array = as_lazy_data(self.real_array)
dm = DataManager(lazy_array * 10)
self.assertTrue(dm.has_lazy_data())
dm.replace(lazy_array)
self.assertTrue(dm.has_lazy_data())
self.assertIs(dm._lazy_array, lazy_array)
self.assertArrayEqual(dm.data, self.real_array)
示例9: test_nd_real_to_nd_real
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_nd_real_to_nd_real(self):
shape = (2, 3, 4)
size = np.prod(shape)
real_array = np.arange(size).reshape(shape)
dm = DataManager(real_array * 10)
self.assertFalse(dm.has_lazy_data())
dm.data = real_array
self.assertFalse(dm.has_lazy_data())
self.assertArrayEqual(dm.data, real_array)
示例10: test_with_lazy_mask_array__masked
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_with_lazy_mask_array__masked(self):
dm = DataManager(self.lazy_mask_array_masked)
self.assertTrue(dm.has_lazy_data())
result = dm.data
self.assertFalse(dm.has_lazy_data())
self.assertIsInstance(result, ma.MaskedArray)
self.assertEqual(dm.dtype, self.dtype)
self.assertEqual(result.fill_value, self.fill_value)
self.assertArrayEqual(result, self.mask_array_masked)
示例11: test_nd_lazy_to_nd_lazy
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_nd_lazy_to_nd_lazy(self):
shape = (2, 3, 4)
size = np.prod(shape)
real_array = np.arange(size).reshape(shape)
lazy_array = as_lazy_data(real_array)
dm = DataManager(lazy_array * 10)
self.assertTrue(dm.has_lazy_data())
dm.data = lazy_array
self.assertTrue(dm.has_lazy_data())
self.assertArrayEqual(dm.data, lazy_array.compute())
示例12: test_with_lazy_mask_array__masked
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_with_lazy_mask_array__masked(self):
dm = DataManager(self.lazy_mask_array_masked,
realised_dtype=self.realised_dtype)
self.assertTrue(dm.has_lazy_data())
result = dm.data
self.assertFalse(dm.has_lazy_data())
self.assertIsInstance(result, ma.MaskedArray)
self.assertIsNone(dm._realised_dtype)
self.assertEqual(dm.dtype, self.realised_dtype)
self.assertArrayEqual(result, self.lazy_mask_array_masked.compute())
示例13: test_lazy_with_real__realised_dtype_none
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_lazy_with_real__realised_dtype_none(self):
mask_array = ma.arange(self.size).reshape(self.shape)
dtype = mask_array.dtype
lazy_array = as_lazy_data(mask_array)
dm = DataManager(lazy_array, realised_dtype=dtype)
self.assertTrue(dm.has_lazy_data())
self.assertIsNone(dm._realised_dtype, dtype)
self.assertEqual(dm.dtype, dtype)
dm.replace(mask_array)
self.assertFalse(dm.has_lazy_data())
self.assertIsNone(dm._realised_dtype)
self.assertEqual(dm.dtype, dtype)
self.assertIs(dm._real_array, mask_array)
self.assertIs(dm.data, mask_array)
示例14: test_real_with_lazy__realised_dtype_setter_none
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_real_with_lazy__realised_dtype_setter_none(self):
mask_array = ma.masked_array(self.real_array) * 10
dtype = mask_array.dtype
lazy_array = as_lazy_data(mask_array)
dm = DataManager(self.real_array)
self.assertFalse(dm.has_lazy_data())
self.assertIsNone(dm._realised_dtype)
self.assertEqual(dm.dtype, dtype)
dm.replace(lazy_array, realised_dtype=dtype)
self.assertTrue(dm.has_lazy_data())
self.assertIsNone(dm._realised_dtype)
self.assertEqual(dm.dtype, dtype)
self.assertIs(dm._lazy_array, lazy_array)
self.assertArrayEqual(dm.data, mask_array)
示例15: test_with_real_masked_constant
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import has_lazy_data [as 别名]
def test_with_real_masked_constant(self):
masked_data = ma.masked_array([666], mask=True, dtype=np.dtype('f8'))
masked_constant = masked_data[0]
dm = DataManager(masked_constant)
result = dm.data
self.assertFalse(dm.has_lazy_data())
self.assertIsInstance(result, ma.MaskedArray)
self.assertNotIsInstance(result, ma.core.MaskedConstant)
self.assertMaskedArrayEqual(result, masked_data)