improver.cli.standardise module

Script to standardise a NetCDF file by updating metadata and demoting float64 data to float32

process(cube, *, attributes_config=None, coords_to_remove=None, coord_modification=None, new_name=None, new_units=None)[source]

Standardise a source cube. Available options are renaming, converting units, updating attributes and removing named scalar coordinates. Remaining scalar coordinates are collapsed, CellMethod(“point”: “time”) is discarded, and data are cast to IMPROVER standard datatypes and units.

Deprecated behaviour: Translates metadata relating to the grid_id attribute from StaGE version 1.1.0 to StaGE version 1.2.0. Cubes that have no “grid_id” attribute are not recognised as v1.1.0 and are not changed.

Parameters:
  • cube (iris.cube.Cube) – Source cube to be standardised

  • attributes_config (dict) – Dictionary containing required changes that will be applied to the attributes.

  • coords_to_remove (list) – List of names of scalar coordinates to remove.

  • coord_modification (dict) – A dictionary allowing the direct modification of scalar coordinate values in the original units of the coordinate. To be used with extreme caution. For example this might be: {“height”: 1.5} to set the height coordinate to have a value of 1.5m (assuming original units of m). Type is inferred, so providing a value of 2 will result in an integer type, whilst a value of 2.0 will result in a float type (where this is not modified by type enforcement).

  • new_name (str) – Name of output cube.

  • new_units (str) – Units to convert to.

Returns:

iris.cube.Cube