improver.precipitation_type.shower_condition_probability module

Plugin to construct a shower conditions probability

class ShowerConditionProbability(cloud_threshold=0.8125, convection_threshold=0.8, model_id_attr=None)[source]

Bases: PostProcessingPlugin

Plugin to calculate the probability that conditions are such that precipitation, should it be present, will be showery, based on input cloud amounts and the convective ratio.

__init__(cloud_threshold=0.8125, convection_threshold=0.8, model_id_attr=None)[source]
Parameters:
  • cloud_threshold (float) – The fractional cloud coverage value at which to threshold the cloud data.

  • convection_threshold (float) – The convective ratio value at which to threshold the convective ratio data.

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

_abc_impl = <_abc_data object>
_create_shower_condition_cube(data, cube)[source]

Returns a shower condition cube, with coordinates and mandatory attributes based upon the provided cube. The threshold coordinate is modified to describe shower conditions, such that the probabilities describe the likelihood of conditions being showery. The arbitrary threshold value is 1.

Parameters:
  • data (ndarray) – The shower condition probabilities to populate the new cube.

  • cube (Cube) – The cube to use as a template, and from which to extract attributes for use in the new diagnostic cube.

Return type:

Cube

Returns:

A probability of shower conditions cube.

_extract_inputs(cubes)[source]

Extract the required input cubes from the input cubelist and check they are as required.

Parameters:

cubes (CubeList) – A cubelist containing a cube of cloud fraction and one of convective ratio.

Return type:

Tuple[Cube, Cube]

Returns:

The cloud and convection cubes extracted from the cubelist.

Raises:
  • ValueError – If the expected cubes are not within the cubelist.

  • ValueError – If the input cubes have different shapes, perhaps due to a missing realization in one and not the other.

process(cubes)[source]

Create a shower condition probability from cloud fraction and convective ratio fields. This plugin thresholds the two input diagnostics, creates a hybrid probability field from the resulting binary fields, and then collapses the realizations to give a non-binary probability field that represents the likelihood of conditions being showery.

Parameters:

cubes (CubeList) – A cubelist containing a cube of cloud fraction and one of convective ratio.

Return type:

Cube

Returns:

Probability of any precipitation, if present, being classified as showery