improver.cube_combiner module

Module containing plugin for CubeCombiner.

class improver.cube_combiner.CubeCombiner(operation, warnings_on=False)[source]

Bases: improver.BasePlugin

Plugin for combining cubes.

COMBINE_OPERATORS = {'*': <ufunc 'multiply'>, '+': <ufunc 'add'>, '-': <ufunc 'subtract'>, 'add': <ufunc 'add'>, 'max': <ufunc 'maximum'>, 'mean': <ufunc 'add'>, 'min': <ufunc 'minimum'>, 'multiply': <ufunc 'multiply'>, 'subtract': <ufunc 'subtract'>}
__init__(operation, warnings_on=False)[source]

Create a CubeCombiner plugin

Parameters
  • operation (str) – Operation (+, - etc) to apply to the incoming cubes.

  • warnings_on (bool) – If True output warnings for mismatching metadata.

Raises

ValueError – Unknown operation.

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 213
_abc_registry = <_weakrefset.WeakSet object>
static _check_dimensions_match(cube_list)[source]

Check all coordinate dimensions on the input cubes are equal

Parameters

cube_list (iris.cube.CubeList or list) – List of cubes to compare

Raises

ValueError – If dimension coordinates do not match

process(cube_list, new_diagnostic_name, coords_to_expand=None)[source]

Create a combined cube.

Parameters
  • cube_list (iris.cube.CubeList or list) – List of cubes to combine.

  • new_diagnostic_name (str) – New name for the combined diagnostic.

  • coords_to_expand (dict or None) – Coordinates to be expanded as a key, with the value indicating whether the upper or mid point of the coordinate should be used as the point value, e.g. {‘time’: ‘upper’}.

Returns

Cube containing the combined data.

Return type

iris.cube.Cube

Raises

ValueError – If the cubelist contains only one cube.