本文整理匯總了Python中iris.experimental.um.Field類的典型用法代碼示例。如果您正苦於以下問題:Python Field類的具體用法?Python Field怎麽用?Python Field使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Field類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _check_formats
def _check_formats(self,
old_lbpack, new_lbpack,
old_bacc=-6, new_bacc=-6,
absent_provider=False):
lookup_entry = mock.Mock(lbpack=old_lbpack, bacc=old_bacc)
provider = mock.Mock(lookup_entry=lookup_entry)
if absent_provider:
# Replace the provider with a simple array.
provider = np.zeros(2)
field = Field(list(range(45)), list(range(19)), provider)
return field._can_copy_deferred_data(new_lbpack, new_bacc)
示例2: test_not_equal_data
def test_not_equal_data(self):
field1 = Field(list(range(45)), list(range(19)), None)
field2 = Field(np.arange(45), np.arange(19), np.zeros(3))
self.assertTrue(field1.__ne__(field2))
示例3: test_not_equal_reals
def test_not_equal_reals(self):
field1 = Field(list(range(45)), list(range(19)), None)
field2 = Field(np.arange(45), np.arange(19, 38), None)
self.assertTrue(field1.__ne__(field2))
示例4: test_equal
def test_equal(self):
field1 = Field(list(range(45)), list(range(19)), None)
field2 = Field(np.arange(45), np.arange(19), None)
self.assertFalse(field1.__ne__(field2))
示例5: test_not_equal_ints
def test_not_equal_ints(self):
field1 = Field(list(range(45)), list(range(19)), None)
field2 = Field(np.arange(45, 90), np.arange(19), None)
self.assertFalse(field1.__eq__(field2))
示例6: test_not_equal_data
def test_not_equal_data(self):
field1 = Field(range(45), range(19), None)
field2 = Field(range(45), range(19), np.zeros(3))
self.assertFalse(field1.__eq__(field2))
示例7: test_provider
def test_provider(self):
provider = mock.Mock(read_data=lambda: mock.sentinel.DATA)
field = Field([], [], None)
field.set_data(provider)
self.assertIs(field.get_data(), mock.sentinel.DATA)
示例8: test_ndarray
def test_ndarray(self):
data = np.arange(12).reshape(3, 4)
field = Field([], [], data)
self.assertIs(field.get_data(), data)
示例9: test_None
def test_None(self):
data = np.arange(12).reshape(3, 4)
field = Field([], [], data)
field.set_data(None)
self.assertIsNone(field.get_data())
示例10: test_128
def test_128(self):
field = Field(list(range(45)), list(range(83)), None)
self.assertEqual(field.num_values(), 128)
示例11: test_not_equal_ints
def test_not_equal_ints(self):
field1 = Field(range(45), range(19), None)
field2 = Field(range(45, 90), range(19), None)
self.assertTrue(field1.__ne__(field2))
示例12: test_equal
def test_equal(self):
field1 = Field(range(45), range(19), None)
field2 = Field(range(45), range(19), None)
self.assertFalse(field1.__ne__(field2))
示例13: test_invalid
def test_invalid(self):
field1 = Field(range(45), range(19), None)
self.assertIs(field1.__eq__('foo'), NotImplemented)
示例14: test_invalid
def test_invalid(self):
field1 = Field(list(range(45)), list(range(19)), None)
self.assertIs(field1.__ne__('foo'), NotImplemented)
示例15: test_64
def test_64(self):
field = Field(list(range(45)), list(range(19)), None)
self.assertEqual(field.num_values(), 64)