Cube coordinate functionality¶
-
aeolus.coord_utils.
coord_to_cube
(cube, coord)[source]¶ Convert coordinate points to a cube of the same dimension as the given cube.
- Parameters
cube (iris.cube.Cube) – Cube containing the coordinate to be broadcast.
coord (str or iris.coords.Coord) – Coordinate to be broadcast
- Returns
Cube of broadcast coordinate
- Return type
-
aeolus.coord_utils.
nearest_coord_value
(cube, coord_name, val)[source]¶ Get the nearest value of a coordinate.
- Parameters
cube (iris.cube.Cube) – Cube with the coordinate
coord_name (str or iris.coords.Coord) – Coordinate where to look the nearest point up
- Returns
element of the coordinate array closest to the given val
- Return type
-
aeolus.coord_utils.
ensure_bounds
(cube, coords=['latitude', 'longitude'])[source]¶ Auto-generate bounds for cube coordinates.
-
aeolus.coord_utils.
not_equal_coord_axes
(cube1, cube2)[source]¶ Given 2 cubes, return axes of unequal dimensional coordinates.
-
aeolus.coord_utils.
regrid_3d
(cube, target, vert_coord=None)[source]¶ Regrid a cube in the horizontal and in the vertical on to coordinates of the target cube.
Adapted from https://github.com/LSaffin/iris-extensions
- Parameters
cube (iris.cube.Cube) – The cube to be regridded.
target (iris.cube.Cube) – The cube to regrid to.
vert_coord (str or iris.coords.Coord, optional) – The coordinate for the vertical interpolation. If not given, the target’s z-axis iris.coord.DimCoord is used.
- Returns
- Return type
-
aeolus.coord_utils.
get_dim_coord
(cube, axis)[source]¶ Return a coordinate from a cube based on the axis it represents.
Uses
iris.util.guess_coord_axis()
to heuristically match a dimensional coordinate with the requested axis.Adapted from https://github.com/LSaffin/iris-extensions
- Parameters
cube (iris.cube.Cube) – Cube with the desired coordinate.
axis (str) – The co-ordinate axis to take from the cube. Must be one of X, Y, Z, T.
- Returns
The dimensional coordinate matching the requested axis on the given cube.
- Return type
- Raises
ArgumentError – If axis is not one of {X, Y, Z, T}.:
NotFoundError – If the cube does not contain a coord with the requested axis.: