本文整理汇总了Python中iris.coords.AuxCoord._discontiguity_in_bounds方法的典型用法代码示例。如果您正苦于以下问题:Python AuxCoord._discontiguity_in_bounds方法的具体用法?Python AuxCoord._discontiguity_in_bounds怎么用?Python AuxCoord._discontiguity_in_bounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iris.coords.AuxCoord
的用法示例。
在下文中一共展示了AuxCoord._discontiguity_in_bounds方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_2d_contiguous_both_dirs
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_contiguous_both_dirs(self):
coord = AuxCoord(self.points_3by3, bounds=self.lon_bounds_3by3)
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertTrue(contiguous)
self.assertTrue(not diffs_along_x.any())
self.assertTrue(not diffs_along_y.any())
示例2: test_2d_discontiguous_along_y
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_discontiguous_along_y(self):
coord = AuxCoord(self.points_3by3[::2, :],
bounds=self.lat_bounds_3by3[::2, :, :])
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertFalse(contiguous)
self.assertTrue(not diffs_along_x.any())
self.assertArrayEqual(diffs_along_y, np.array([[True, True, True]]))
示例3: test_2d_discontiguous_along_x
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_discontiguous_along_x(self):
coord = AuxCoord(self.points_3by3[:, ::2],
bounds=self.lon_bounds_3by3[:, ::2, :])
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertFalse(contiguous)
self.assertArrayEqual(diffs_along_x,
np.array([True, True, True]).reshape(3, 1))
self.assertTrue(not diffs_along_y.any())
示例4: test_2d_one_cell_along_y
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_one_cell_along_y(self):
# Test a 2D coord with a single cell along the y axis, where the coord
# has shape (1, 2).
coord = AuxCoord(self.points_3by3[:1, :],
bounds=self.lon_bounds_3by3[:1, :, :])
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertTrue(contiguous)
self.assertTrue(not diffs_along_x.any())
self.assertTrue(not diffs_along_y.any())
示例5: test_2d_one_cell_along_x
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_one_cell_along_x(self):
# Test a 2D coord with a single cell along the x axis, where the coord
# has shape (2, 1).
coord = AuxCoord(self.points_3by3[:, :1],
bounds=self.lat_bounds_3by3[:, :1, :])
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertTrue(contiguous)
self.assertTrue(not diffs_along_x.any())
self.assertArrayEqual(diffs_along_y, np.array([0, 0]).reshape(2, 1))
示例6: test_2d_one_cell
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_one_cell(self):
# Test a 2D coord with a single cell, where the coord has shape (1, 1).
coord = AuxCoord(self.points_3by3[:1, :1],
bounds=self.lon_bounds_3by3[:1, :1, :])
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
expected_diffs = np.array([], dtype=np.int64)
self.assertTrue(contiguous)
self.assertArrayEqual(diffs_along_x, expected_diffs.reshape(1, 0))
self.assertArrayEqual(diffs_along_y, expected_diffs.reshape(0, 1))
示例7: test_2d_contiguous_along_x_atol
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_contiguous_along_x_atol(self):
coord = AuxCoord(self.points_3by3[:, ::2],
bounds=self.lon_bounds_3by3[:, ::2, :])
# Set a high atol that allows small discontiguities.
contiguous, diffs = coord._discontiguity_in_bounds(atol=5)
diffs_along_x, diffs_along_y = diffs
self.assertTrue(contiguous)
self.assertArrayEqual(diffs_along_x,
np.array([False, False, False]).reshape(3, 1))
self.assertTrue(not diffs_along_y.any())
示例8: test_2d_discontiguous_along_x_and_y
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_discontiguous_along_x_and_y(self):
coord = AuxCoord(np.array([[1, 5], [3, 5]]),
bounds=np.array([[[0, 2, 2, 0], [4, 6, 6, 4]],
[[2, 4, 4, 2], [4, 6, 6, 4]]]))
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
exp_x_diffs = np.array([True, False]).reshape(2, 1)
exp_y_diffs = np.array([True, False]).reshape(1, 2)
self.assertFalse(contiguous)
self.assertArrayEqual(diffs_along_x, exp_x_diffs)
self.assertArrayEqual(diffs_along_y, exp_y_diffs)
示例9: test_2d_discontiguous_mod_360
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_discontiguous_mod_360(self):
# Test that longitude coordinates are adjusted by the 360 modulus when
# calculating the discontiguities in contiguous bounds.
coord = AuxCoord(
[[175, -175], [175, -175]], standard_name='longitude',
bounds=np.array([[[170, 180, 180, 170], [10, 20, 20, 10]],
[[170, 180, 180, 170], [10, 20, 20, 10]]]))
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertFalse(contiguous)
self.assertArrayEqual(diffs_along_x, np.array([[True], [True]]))
self.assertTrue(not diffs_along_y.any())
示例10: test_2d_discontiguous_mod_360_not_longitude
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import _discontiguity_in_bounds [as 别名]
def test_2d_discontiguous_mod_360_not_longitude(self):
# Test that non-longitude coordinates are not adjusted by the 360
# modulus when calculating the discontiguities in discontiguous bounds.
coord = AuxCoord(
[[-150, 350], [-150, 350]], standard_name='height',
bounds=np.array([[[-400, 100, 100, -400], [200, 600, 600, 200]],
[[-400, 100, 100, -400], [200, 600, 600, 200]]])
)
contiguous, diffs = coord._discontiguity_in_bounds()
diffs_along_x, diffs_along_y = diffs
self.assertFalse(contiguous)
self.assertArrayEqual(diffs_along_x, np.array([[True], [True]]))
self.assertTrue(not diffs_along_y.any())