improver.utilities.mask module

Contents

improver.utilities.mask module#

Module for applying mask to a cube.

apply_mask(*cubes, mask_name, invert_mask=False)[source]#

Apply a provided mask to a cube. If invert_mask is True, the mask will be inverted.

Parameters:
  • cubes (Union[CubeList, Cube]) – A list of iris cubes that should contain exactly two cubes: a mask and a cube to apply the mask to. The cubes should have the same dimensions.

  • mask_name (str) – The name of the mask cube. It should match with exactly one of the cubes in the input cubelist.

  • invert_mask (bool) – If True, the mask will be inverted before it is applied.

Return type:

Cube

Returns:

A cube with a mask applied to the data.

Raises: ValueError: If the number of cubes provided is not equal to 2. ValueError: If the input cube and mask cube have different dimensions.