本文整理汇总了Python中iris.coords.AuxCoord.from_coord方法的典型用法代码示例。如果您正苦于以下问题:Python AuxCoord.from_coord方法的具体用法?Python AuxCoord.from_coord怎么用?Python AuxCoord.from_coord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iris.coords.AuxCoord
的用法示例。
在下文中一共展示了AuxCoord.from_coord方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct_new_coord_given_points
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import from_coord [as 别名]
def construct_new_coord_given_points(coord, points):
# Handle what was previously a DimCoord which may no longer be
# monotonic.
try:
return coord.copy(points)
except ValueError:
return AuxCoord.from_coord(coord).copy(points)
示例2: test_no_slider_from_aux
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import from_coord [as 别名]
def test_no_slider_from_aux(self):
coords = ('grid_longitude', 'grid_latitude')
self.cube.remove_coord('time')
fp = self.cube.coord('forecast_period')
self.cube.remove_coord('forecast_period')
aux = AuxCoord.from_coord(fp)
self.cube.add_aux_coord(aux, 0)
plot = Plot2D(self.cube, self.axes, coords=coords)
self.assertEqual(plot._slider_dim_by_name, {})
示例3: ok_bad
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import from_coord [as 别名]
def ok_bad(self, coord_name):
# Demotes the named DimCoord on `bad` to an AuxCoord.
ok = lat_lon_cube()
bad = lat_lon_cube()
coord = bad.coord(coord_name)
dims = bad.coord_dims(coord)
bad.remove_coord(coord_name)
aux_coord = AuxCoord.from_coord(coord)
bad.add_aux_coord(aux_coord, dims)
return ok, bad
示例4: demote_coord
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import from_coord [as 别名]
def demote_coord(coord_name):
bad = global_pp()
coord = bad.coord(coord_name)
dims = bad.coord_dims(coord)
bad.remove_coord(coord_name)
aux_coord = AuxCoord.from_coord(coord)
bad.add_aux_coord(aux_coord, dims)
with self.assertRaises(ValueError):
regrid(bad, ok)
with self.assertRaises(ValueError):
regrid(ok, bad)
示例5: _resample_coord
# 需要导入模块: from iris.coords import AuxCoord [as 别名]
# 或者: from iris.coords.AuxCoord import from_coord [as 别名]
def _resample_coord(self, sample_points, coord, coord_dims):
"""
Interpolate the given coordinate at the provided sample points.
"""
# NB. This section is ripe for improvement:
# - Internally self._points() expands coord.points to the same
# N-dimensional shape as the cube's data, but it doesn't
# collapse it again before returning so we have to do that
# here.
# - By expanding to N dimensions self._points() is doing
# unnecessary work.
data = self._points(sample_points, coord.points, coord_dims)
index = tuple(0 if dim not in coord_dims else slice(None)
for dim in range(self._src_cube.ndim))
new_points = data[index]
# Watch out for DimCoord instances that are no longer monotonic
# after the resampling.
try:
new_coord = coord.copy(new_points)
except ValueError:
aux_coord = AuxCoord.from_coord(coord)
new_coord = aux_coord.copy(new_points)
return new_coord