improver.psychrometric_calculations.precip_phase_probability module

Module for calculating the probability of specific precipitation phases.

class PrecipPhaseProbability[source]

Bases: BasePlugin

This plugin converts a falling-phase-change-level cube into the probability of a specific precipitation phase being found at the surface.

Consider the case in which a snow-falling-level diagnostic is given as input. For a deterministic snow-falling-level diagnostic (i.e. no percentile coordinate), these falling levels are compared directly to the altitudes of interest to determine the binary probability (0 or 1) of snow at these altitudes. A 0 is returned if the altitude is below the snow-falling-level and a 1 if the altitude if above the snow-falling-level. If a probabilistic snow-falling-level is provided, this plugin will seek to use the 80th percentile falling-level to compare with the altitudes. This provides a greater level of certainty that the phase is snow, and in conjunction with the percentile chosen for rain (see below), provides for a greater depth of sleet (mixed phase precipitation).

The plugin behaves in the same way for a rain-falling-level, but in the case of a probabalistic input, the 20th percentile is used. This lowers the falling-level within the atmosphere, providing for greater certainty that the phase is entirely rain.

The altitudes used in these comparisons may be provided as gridded orographies or as spot forecast ancillaries that contain an altitude coordinate. In the former case the phase probability will be determined at each grid point at the orographic altitude. In the latter case, the phase probability will be determined at each site’s specific altitude.

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

Separates the input list into the required cubes for this plugin, detects whether snow, rain from hail or rain are required from the input phase-level cube name, and as required, appropriately extracts the relevant percentile.

Converts units of falling_level_cube to that of orography_cube / site altitudes if necessary. Sets flag for snow, rain from hail or rain depending on name of falling_level_cube.

Parameters:

cubes (Union[CubeList, List[Cube]]) – Contains cubes of the altitude of the phase-change level (this can be snow->sleet, hail->rain or sleet->rain) and the altitude of the orography or sites. The name of the phase-change level cube must be “altitude_of_snow_falling_level”, “altitude_of_rain_from_hail_falling_level” or “altitude_of_rain_falling_level”. If a gridded orography is provided it must be named “surface_altitude”. If a spot forecast ancillary is provided it must be named “grid_neighbours”.

Raises:
  • ValueError – If cubes with the expected names cannot be extracted.

  • ValueError – If cubes does not have the expected length of 2.

  • ValueError – If a percentile cube does not contain the expected percentiles.

  • ValueError – If the extracted cubes do not have matching spatial coordinates.

Return type:

None

process(cubes)[source]

Derives the probability of a precipitation phase at the surface / site altitude. If the snow-sleet falling-level is supplied, this is the probability of snow at the surface / site altitude. If the sleet-rain falling-level is supplied, this is the probability of rain at the surface / site altitude. If the hail-rain falling-level is supplied, this is the probability of rain from hail at the surface / site altitude.

Parameters:

cubes (Union[CubeList, List[Cube]]) – Contains cubes of the altitude of the phase-change level (this can be snow->sleet, hail->rain or sleet->rain) and the altitude of the orography or a spot forecast ancillary that defines site altitudes.

Return type:

Cube

Returns:

Cube containing the probability of a specific precipitation phase reaching the surface orography or site altitude. If the falling_level_cube was snow->sleet, then this will be the probability of snow at the surface. If the falling_level_cube was sleet->rain, then this will be the probability of rain from sleet at the surface or site altitude. If the falling_level_cube was hail->rain, then this will be the probability of rain from hail at the surface or site altitude. The probabilities are categorical (1 or 0) allowing precipitation to be divided uniquely between snow, sleet and rain phases.