本文整理汇总了Python中iris.coords.AuxCoord.copy方法的典型用法代码示例。如果您正苦于以下问题:Python AuxCoord.copy方法的具体用法?Python AuxCoord.copy怎么用?Python AuxCoord.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iris.coords.AuxCoord
的用法示例。
在下文中一共展示了AuxCoord.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_xy_dimensionality
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import copy [as 别名]
def test_xy_dimensionality(self):
u, v = uv_cubes()
# Replace 1d lat with 2d lat.
x = u.coord('grid_longitude').points
y = u.coord('grid_latitude').points
x2d, y2d = np.meshgrid(x, y)
lat_2d = AuxCoord(y2d, 'grid_latitude', units='degrees',
coord_system=u.coord('grid_latitude').coord_system)
for cube in (u, v):
cube.remove_coord('grid_latitude')
cube.add_aux_coord(lat_2d.copy(), (0, 1))
with self.assertRaisesRegexp(
ValueError,
'x and y coordinates must have the same number of dimensions'):
rotate_winds(u, v, iris.coord_systems.OSGB())
示例2: Test_is_compatible
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import copy [as 别名]
class Test_is_compatible(tests.IrisTest):
def setUp(self):
self.test_coord = AuxCoord([1.])
self.other_coord = self.test_coord.copy()
def test_noncommon_array_attrs_compatible(self):
# Non-common array attributes should be ok.
self.test_coord.attributes['array_test'] = np.array([1.0, 2, 3])
self.assertTrue(self.test_coord.is_compatible(self.other_coord))
def test_matching_array_attrs_compatible(self):
# Matching array attributes should be ok.
self.test_coord.attributes['array_test'] = np.array([1.0, 2, 3])
self.other_coord.attributes['array_test'] = np.array([1.0, 2, 3])
self.assertTrue(self.test_coord.is_compatible(self.other_coord))
def test_different_array_attrs_incompatible(self):
# Differing array attributes should make coords incompatible.
self.test_coord.attributes['array_test'] = np.array([1.0, 2, 3])
self.other_coord.attributes['array_test'] = np.array([1.0, 2, 777.7])
self.assertFalse(self.test_coord.is_compatible(self.other_coord))