improver.utilities.common_input_handle module

improver.utilities.common_input_handle module#

as_cube(*cube)[source]#

Standardise input handling of cube arguments.

The role of this function is to return a single cube object. Where more than one cube is provided, a cubelist merge is attempted.

Parameters:

cube (Union[Cube, CubeList]) – Input data provided in the form of a cube or cubelists. Any iterable is supported.

Returns:

A single cube.

Return type:

Cube

as_cubelist(*cubes)[source]#

Standardise input handling of cube/cubelist arguments.

The role of this function is to flatten the provided inputs and thereby return a single CubeList object.

Parameters:

cubes (Union[Cube, CubeList]) – Input data provided in the form of one or more cubes or cubelists (or mixture thereof). Any iterable is supported.

Returns:

A CubeList containing all the cubes provided as input.

Return type:

CubeList

as_iterable(obj)[source]#

Return obj as an iterable, or an empty list if obj is None.