当前位置: 首页>>代码示例>>Python>>正文


Python _data_manager.DataManager类代码示例

本文整理汇总了Python中iris._data_manager.DataManager的典型用法代码示例。如果您正苦于以下问题:Python DataManager类的具体用法?Python DataManager怎么用?Python DataManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DataManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_real_with_real

 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)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例2: test_with_real_array

 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())
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例3: Test__propagate_masked_data_fill_value

class Test__propagate_masked_data_fill_value(tests.IrisTest):
    def setUp(self):
        self.real_array = np.array(0)
        self.mask_array = ma.array(0)
        np_fill_value = ma.array(0, dtype=self.mask_array.dtype).fill_value
        assert np_fill_value == self.mask_array.fill_value
        self.np_fill_value = np_fill_value
        self.dm = DataManager(self.mask_array)
        self.dm.fill_value = None

    def test_nop__with_real_array(self):
        fill_value = 1234
        dm = DataManager(self.real_array)
        dm.fill_value = 1234
        self.assertEqual(dm.fill_value, fill_value)
        dm._propagate_masked_data_fill_value()
        self.assertEqual(dm.fill_value, fill_value)

    def test_clear_fill_value__with_np_default(self):
        fill_value = 1234
        self.dm.fill_value = fill_value
        self.assertEqual(self.dm.fill_value, fill_value)
        self.dm._propagate_masked_data_fill_value()
        self.assertIsNone(self.dm.fill_value)

    def test_set_fill_value(self):
        fill_value = 1234
        self.assertIsNone(self.dm.fill_value)
        self.dm._real_array.fill_value = fill_value
        self.dm._propagate_masked_data_fill_value()
        self.assertEqual(self.dm.fill_value, fill_value)
开发者ID:cpelley,项目名称:iris,代码行数:31,代码来源:test_DataManager.py

示例4: test_fill_value_overflow

 def test_fill_value_overflow(self):
     fill_value = np.float(1e+20)
     data = np.array([0], dtype=np.int32)
     dm = DataManager(data)
     emsg = 'Fill value of .* invalid for dtype'
     with self.assertRaisesRegexp(ValueError, emsg):
         dm.fill_value = fill_value
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例5: test_zero_ndim_lazy_with_zero_ndim_real

 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)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例6: test_lazy_array__fill_value_clearance

 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)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例7: test_zero_ndim_real_with_scalar_float

 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))
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例8: test_zero_ndim_lazy_to_scalar_1d_real_promote

 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)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例9: test_nop__with_real_array

 def test_nop__with_real_array(self):
     fill_value = 1234
     dm = DataManager(self.real_array)
     dm.fill_value = 1234
     self.assertEqual(dm.fill_value, fill_value)
     dm._propagate_masked_data_fill_value()
     self.assertEqual(dm.fill_value, fill_value)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例10: test_lazy_with_lazy

 def test_lazy_with_lazy(self):
     dm = DataManager(as_lazy_data(self.real_array))
     data = as_lazy_data(self.real_array) * 10
     result = dm._deepcopy(self.memo, data=data)
     expected = DataManager(data)
     self.assertEqual(result, expected)
     self.assertIs(result._lazy_array, data)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例11: test_zero_ndim_lazy_to_scalar_1d_lazy_promote

 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())
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例12: test__clear_fill_value_masked

 def test__clear_fill_value_masked(self):
     fill_value = 1234
     dm = DataManager(np.array(0), fill_value=fill_value)
     self.assertEqual(dm.fill_value, fill_value)
     data = ma.masked_array(1, fill_value=4321)
     dm.replace(data)
     self.assertIsNone(dm.fill_value)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例13: test_zero_ndim_lazy_with_zero_ndim_lazy

 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())
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例14: test_mask_array__with_fill_value

 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)
开发者ID:cpelley,项目名称:iris,代码行数:7,代码来源:test_DataManager.py

示例15: test

 def test(self):
     dm = DataManager(np.array(0))
     kwargs = dict(data=self.data, fill_value='none', realised_dtype='none')
     with mock.patch(self.method) as mocker:
         mocker.return_value = self.return_value
         result = dm.copy(data=self.data)
         mocker.assert_called_once_with(self.memo, **kwargs)
     self.assertIs(result, self.return_value)
开发者ID:cpelley,项目名称:iris,代码行数:8,代码来源:test_DataManager.py


注:本文中的iris._data_manager.DataManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。