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
Returns

Cube of broadcast coordinate

Return type

iris.cube.Cube

aeolus.coord_utils.nearest_coord_value(cube, coord_name, val)[source]

Get the nearest value of a coordinate.

Parameters
Returns

element of the coordinate array closest to the given val

Return type

int or float

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

iris.cube.Cube

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

iris.coords.DimCoord

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.: