improver.utilities.expand_realization_dimension module#

Module containing plugin for generating extra realizations from a cube with fewer realizations than required.

class ExpandRealizationDimension(n_realizations_required)[source]#

Bases: BasePlugin

Plugin to expand the realization dimension of a cube to the required number of realizations.

__init__(n_realizations_required)[source]#
Parameters:

n_realizations_required (int) – The number of realizations required in the output cube.

_abc_impl = <_abc._abc_data object>#
process(cube)[source]#

Expand the realization dimension of a cube by repeating the existing realizations as necessary. E.g. if the input cube has 18 realizations and 24 are required, the first 18 realizations will be repeated and the first 6 of these will be used to create the additional 6 realizations needed to reach the required 24. Realization points will be renumbered from 0 to n_realizations_required - 1 in the output cube, regardless of the original realization points in the input cube.

Parameters:

cube (Cube) – A cube with a realization coordinate that has fewer realizations than required.

Return type:

Cube

Returns:

Expanded cube. Dimensions are the same as input cube, with the realization dimension expanded to the specified size.

Raises:

ValueError – if realization is not a dimension coordinate.