本文整理汇总了Python中iris._data_manager.DataManager.data方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager.data方法的具体用法?Python DataManager.data怎么用?Python DataManager.data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iris._data_manager.DataManager
的用法示例。
在下文中一共展示了DataManager.data方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mask_array__with_fill_value
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_mask_array__with_fill_value(self):
dm = DataManager(np.array(0))
self.assertIsNone(dm.fill_value)
fill_value = 1234
data = ma.array(1, fill_value=fill_value)
dm.data = data
self.assertEqual(dm.fill_value, fill_value)
示例2: test_lazy_array__fill_value_clearance
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_lazy_array__fill_value_clearance(self):
fill_value = 1234
dm = DataManager(as_lazy_data(np.array(0)),
fill_value=fill_value)
self.assertEqual(dm.fill_value, fill_value)
dm.data = as_lazy_data(np.array(1))
self.assertIsNone(dm.fill_value)
示例3: test_zero_ndim_lazy_to_scalar_1d_lazy_promote
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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())
示例4: test_zero_ndim_lazy_to_scalar_1d_real_promote
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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)
示例5: test_zero_ndim_lazy_with_zero_ndim_lazy
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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())
示例6: test_zero_ndim_lazy_with_zero_ndim_real
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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)
示例7: test_zero_ndim_real_with_scalar_float
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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_nd_real_to_nd_real
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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)
示例9: test_coerce_to_ndarray
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_coerce_to_ndarray(self):
shape = (2, 3)
size = np.prod(shape)
real_array = np.arange(size).reshape(shape)
matrix = np.matrix(real_array)
dm = DataManager(real_array)
dm.data = matrix
self.assertIsInstance(dm._real_array, np.core.ndarray)
self.assertIsInstance(dm.data, np.core.ndarray)
self.assertArrayEqual(dm.data, real_array)
示例10: test_nd_lazy_to_nd_lazy
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import 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())
示例11: test_realised_dtype_none
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_realised_dtype_none(self):
shape = (2, 3, 4)
size = np.prod(shape)
mask_array = ma.arange(size).reshape(shape)
dtype = mask_array.dtype
lazy_array = as_lazy_data(mask_array)
dm = DataManager(lazy_array, realised_dtype=dtype)
self.assertIsNone(dm._realised_dtype)
self.assertEqual(dm.dtype, dtype)
dm.data = mask_array
self.assertIs(dm.data, mask_array)
self.assertIsNone(dm._realised_dtype)
self.assertEqual(dm.dtype, dtype)
示例12: test_mask_array__default_fill_value
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_mask_array__default_fill_value(self):
dm = DataManager(np.array(0))
self.assertIsNone(dm.fill_value)
data = ma.array(1)
dm.data = data
self.assertIsNone(dm.fill_value)
示例13: test_real_array__fill_value_clearance
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_real_array__fill_value_clearance(self):
fill_value = 1234
dm = DataManager(np.array(0), fill_value=fill_value)
self.assertEqual(dm.fill_value, fill_value)
dm.data = np.array(1)
self.assertIsNone(dm.fill_value)
示例14: test_scalar_1d_to_zero_ndim_fail
# 需要导入模块: from iris._data_manager import DataManager [as 别名]
# 或者: from iris._data_manager.DataManager import data [as 别名]
def test_scalar_1d_to_zero_ndim_fail(self):
dm = DataManager(np.array([123]))
emsg = 'Require data with shape \(1,\), got \(\).'
with self.assertRaisesRegexp(ValueError, emsg):
dm.data = 456