improver.psychrometric_calculations.significant_phase_mask module

Module for calculating the significant phase mask.

class SignificantPhaseMask(model_id_attr=None)[source]

Bases: BasePlugin

Derives a categorical field for the specified precipitation phase indicating whether that phase is the dominant phase at each point (1 where true, else 0) based on input snow-fraction data. The decision is: snow-fraction <= 0.01: Rain; snow-fraction >= 0.99: Snow; Sleet in between.

__init__(model_id_attr=None)[source]

Initialise the class

Parameters:

model_id_attr (Optional[str]) – Name of the attribute used to identify the source model for blending.

_abc_impl = <_abc_data object>
_rain_phase(snow_fraction_data)[source]

Calculates the rain_phase data

Return type:

ndarray

_sleet_phase(snow_fraction_data)[source]

Calculates the sleet_phase data

Return type:

ndarray

_snow_phase(snow_fraction_data)[source]

Calculates the snow_phase data

Return type:

ndarray

static _validate_snow_fraction(snow_fraction)[source]

Ensures that the input snow-fraction field has appropriate name (snow_fraction), units (1) and data (between 0 and 1 inclusive).

Parameters:

snow_fraction (Cube) –

Return type:

None

Raises
ValueError:

If any of the above are not True.

process(snow_fraction, phase)[source]

Make significant-phase-mask cube for the specified phase.

Parameters:
  • snow_fraction (Cube) – The input snow-fraction data to derive the phase mask from.

  • phase (str) – One of “rain”, “sleet” or “snow”. This is the phase mask that will be returned.

Return type:

Cube

Returns:

The requested phase mask containing 1 where that phase is dominant and 0 elsewhere. Dimensions will be identical to snow-fraction.