improver.precipitation_type.snow_splitter module

Module to separate snow and rain contributions from a precipitation diagnostic

class SnowSplitter(output_is_rain)[source]

Bases: BasePlugin

A class to separate the contribution of rain or snow from the precipitation rate/accumulation. This is calculated using the probability of rain and snow at the surface to determine what fraction of the precipitation rate/accumulation is rain or snow.

__init__(output_is_rain)[source]

Sets up Class

Parameters:

output_is_rain (bool) – A boolean where True means the plugin will output rain and False means the output is snow.

_abc_impl = <_abc_data object>
process(cubes)[source]

Splits the precipitation cube data into a snow or rain contribution.

Whether the output is a rate or accumulation will depend on the precipitation_cube. output_is_rain will determine whether the outputted cube is a cube of snow or rain.

The probability of rain and snow at the surfaces should only contain 1’s where the phase is present at the surface and 0’s where the phase is not present at the surface. These cubes need to be consistent with each other such that both rain and snow can’t be present at the surface (e.g. at no grid square can both diagnostics have a probability of 1).

A grid of coefficients is calculated by an arbitrary function that maps (0,0) -> 0.5, (1,0) -> 1, (0,1) -> 0 where the first coordinate is the probability for the variable that will be outputted. This grid of coefficients is then multiplied by the precipitation rate/accumulation to split out the contribution of the desired variable.

Parameters:

cubes (CubeList) –

containing:
rain_cube:

Cube of the probability of rain at the surface.

snow_cube:

Cube of the probability of snow at the surface.

precip_cube:

Cube of either precipitation rate or precipitation accumulation.

Return type:

Cube

Returns:

Cube of rain/snow (depending on self.output_is_rain) rate/accumulation (depending on precipitation cube). The name will be an updated version of precip_cube.name(). “precipitation” will be replaced with “rainfall” or “snowfall” and “lwe_” will be removed for rain output.

Raises:
  • ValueError – If, at some grid square, both snow_cube and rain_cube have a probability of

  • 0

static separate_input_cubes(cubes)[source]

Separate the input cubelist into cubes of rain and snow.

Parameters:

cubes (CubeList) –

containing:
rain_cube:

Cube of the probability of rain at the surface.

snow_cube:

Cube of the probability of snow at the surface.

precip_cube:

Cube of either precipitation rate or precipitation accumulation.

Return type:

Tuple[Cube, Cube, Cube]

Returns:

A tuple of rain_cube,snow_cube and precip_cube in that order.