improver.standardise module
Plugin to standardise metadata
- class StandardiseMetadata[source]
Bases:
BasePlugin
Plugin to standardise cube metadata
- _abc_impl = <_abc_data object>
- static _collapse_scalar_dimensions(cube)[source]
Demote any scalar dimensions (excluding “realization”) on the input cube to auxiliary coordinates.
- static _discard_redundant_cell_methods(cube)[source]
Removes cell method “point”: “time” from cube if present.
- Return type:
- static _remove_scalar_coords(cube, coords_to_remove)[source]
Removes named coordinates from the input cube.
- Return type:
- static _rm_air_temperature_status_flag(cube)[source]
Remove air_temperature status_flag coord by applying as NaN to cube data.
See https://github.com/metoppv/improver/pull/1839 for further details.
- Return type:
- static _standardise_dtypes_and_units(cube)[source]
Modify input cube in place to conform to mandatory dtype and unit standards.
- process(cube, new_name=None, new_units=None, coords_to_remove=None, attributes_dict=None)[source]
Perform compulsory and user-configurable metadata adjustments. The compulsory adjustments are:
to collapse any scalar dimensions apart from realization (which is expected always to be a dimension);
to cast the cube data and coordinates into suitable datatypes;
to convert time-related metadata into the required units
to remove cell method (“point”: “time”).
- Parameters:
cube (
Cube
) – Input cube to be standardisednew_units (
Optional
[str
]) – Optional unit conversion for output cubecoords_to_remove (
Optional
[List
[str
]]) – Optional list of scalar coordinates to remove from output cubeattributes_dict (
Optional
[Dict
[str
,Any
]]) – Optional dictionary of required attribute updates. Keys are attribute names, and values are the required changes. See improver.metadata.amend.amend_attributes for details.
- Return type:
- Returns:
The processed cube