improver.cube_combiner module¶
Module containing plugin for CubeCombiner.
-
class
improver.cube_combiner.
CubeCombiner
(operation, warnings_on=False)[source]¶ Bases:
object
Plugin for combining cubes.
-
__init__
(operation, warnings_on=False)[source]¶ Create a CubeCombiner plugin
Parameters: operation (str) – Operation (+, - etc) to apply to the incoming cubes. Keyword Arguments: warnings_on (bool) – If True output warnings for mismatching metadata. Raises: ValueError
– Unknown operation.
-
static
combine
(cube1, cube2, operation)[source]¶ Combine cube data
Parameters: - cube1 (iris.cube.Cube) – Cube containing data to be combined.
- cube2 (iris.cube.Cube) – Cube containing data to be combined.
- operation (str) – Operation (+, - etc) to apply to the incoming cubes)
Returns: Cube containing the combined data.
Return type: result (iris.cube.Cube)
Raises: ValueError
– Unknown operation.
-
static
expand_bounds
(result_cube, cubelist, coord, point)[source]¶ Alter a coord such that bounds are expanded to cover the entire range of the input cubes.
For example, in the case of time cubes if the input cubes have bounds of [0000Z, 0100Z] & [0100Z, 0200Z] then the output cube will have bounds of [0000Z,0200Z]
Parameters: - result_cube (iris.cube.Cube) – A cube with metadata for the results.
- cubelist (iris.cube.CubeList) – The list of cubes with coordinates to be combined
- coord (str) – The coordinate to be combined.
- point (str) –
The method of calculating the new point for the coordinate. Currently accepts:
’mid’ - halfway between the bounds’upper’ - equal to the upper bound
Returns: Cube with coord expanded.
n.b. If argument point == ‘mid’ then python will convert result.coord(‘coord’).points[0] to a float UNLESS the coord units contain ‘seconds’. This is to ensure that midpoints are not rounded down, for example when times are in hours.
Return type: result (iris.cube.Cube)
-
process
(cube_list, new_diagnostic_name, revised_coords=None, revised_attributes=None, expanded_coord=None)[source]¶ Create a combined cube.
Parameters: - cube_list (iris.cube.CubeList) – Cube List contain the cubes to combine.
- new_diagnostic_name (str) – New name for the combined diagnostic.
Keyword Arguments: Returns: Cube containing the combined data.
Return type: result (iris.cube.Cube)
-