improver.visibility.visibility_combine_cloud_base module

Module for combining a visibility forecast with a scaled cloud base at ground level forecast

class VisibilityCombineCloudBase(initial_scaling_value, first_unscaled_threshold)[source]

Bases: PostProcessingPlugin

Combines the probability of visibility relative to a threshold with the probability of cloud base at ground level.

The probability of cloud base at ground level is used as proxy for low visibility at a grid square. By combining these diagnostics we add additional detail to the visibility diagnostic by capturing low cloud over higher areas of orography not resolved in the underlying visibility diagnostic.

The probability of cloud base at ground level is multiplied by a scalar before combining. The scalar is dependent on which visibility threshold it is combined with. This is done to produce variation across the final visibility thresholds following combining.

The maximum probability is then taken of the scaled cloud base at ground level and the visibility forecast. This is used as the outputted visibility forecast.

__init__(initial_scaling_value, first_unscaled_threshold)[source]

Initialize plugin and define constants in the scaling distribution

Parameters:
  • initial_scaling_value (float) – Defines the scaling value used when combining with a visibility threshold of 0m.

  • first_unscaled_threshold (float) – Defines the first threshold that will have a scaling value of 1.0. All thresholds greater than this will also have a scaling value of 1.0.

_abc_impl = <_abc_data object>
get_scaling_factors(vis_thresholds)[source]

Calculates a scaling factor for every visibility threshold. The scaling factor is determined differently depending on the threshold:

1) If the threshold is greater than or equal to first_unscaled_threshold then the scaling factor is always 1.0. 2) If the threshold is less than first_unscaled_threshold then a scaling factor is calculated by inputting the threshold into an inverted fourth level polynomial. The constants in this curve have been defined such that a threshold equal to first_unscaled_threshold gives a scaling factor of 1.0 and a threshold of 0m gives a scaling factor equal to initial_scaling_value.

This distribution has been determined by experimentation and chosen for combining visibility with a cloud base at ground level of 4.5 oktas or greater.

Parameters:

vis_thresholds (ndarray) – An array of visibility thresholds

Return type:

ndarray

Returns:

An array of scaling factors. This will be the same length as vis_thresholds and the scaling factor will have the same index as the corresponding threshold in vis_thresholds.

process(cubes)[source]

Combines the visibility cube with the cloud base at ground level cube. This is done for every visibility threshold independently. Before combining, the cloud base at ground level cube is multiplied by a scaling factor which either reduces or has no impact on the probabilities in the cube. The scaling factor is calculated based upon which visibility threshold the cloud base will be combined with. The maximum probability is then taken between the scaled cloud base cube and the corresponding visibility threshold.

Parameters:

cubes (CubeList) –

containing:
visibility:

Cube of probability of visibility relative to thresholds

cloud base at ground level:

Cube of probability of cloud base at ground level. This cube should only have spatial dimensions (e.g. spot_index or x,y coordinates).

Return type:

Cube

Returns:

Cube of visibility data that has been combined with the scaled cloud base at ground level cube.

Raises:
  • ValueError – If visibility_cube is not a probability cube

  • ValueError – If cloud_base_ground_cube is not a probability cube

separate_input_cubes(cubes)[source]

Separate cubelist into a visibility cube and a cloud base at ground level cube.

Parameters:

cubes (CubeList) – A cubelist only containing a cube of the probability of visibility relative to thresholds and a cube of the probability of cloud base at ground level

Return type:

Tuple[Cube, Cube]

Returns:

A tuple containing a cube of the probability of visibility relative to threshold and a cube of the probability of cloud base at ground level.

Raises:
  • ValueError – If the input cubelist does not have exactly two cubes

  • ValueError – If input cubelist doesn’t contain a visibility cube and a cloud base at ground level cube