This is the ‘miscellaneous’ section - a collection of useful functions that don’t fit anywhere else.

Meteorographica.utils.cube_order_dimensions(cube, dims_list)[source]

Reshape the data in an iris.cube.Cube by re-ordering the dimensions.

If the cube interface is not doing what I want, and I need to access the internal data array directly, then the exact shape of the array starts to matter, and a [latitude,longitude] array is not the same as a [longitude,latitude] one. This function sets the exact shape of the data array by specifying the order of the dimensions of the cube. Note that it does not modify the input cube, it returns a new one.

  • cube (iris.cube.Cube) – The cube to have its data re-ordered.
  • dims_list (list of str) – Dimension names in desired order (e.g. “(‘Latitude’,’Longitude’,’member’)”).

A new cube with the dimensions in the specified order.

Return type:



StandardError – Names in the dims_list do not match the names of the vector dimensions of the cube.