improver.nowcasting.lightning module¶
Module for NowcastLightning class and associated functions.
-
class
improver.nowcasting.lightning.NowcastLightning(radius=10000.0)[source]¶ Bases:
improver.BasePluginProduce Nowcast of lightning probability.
This Plugin selects a first-guess lightning probability field from MOGREPS-UK data matching the nowcast validity-time, and modifies this based on information from the nowcast.
For each forecast time, the closest-in-time first-guess lightning probability slice is copied and modified thus:
- 1: Increase lightning probability where lightning is observed or is
nearby.
- 2: Increase lightning probability where heavy or intense precipitation
is observed.
- 3: Reduce lightning probability where precipitation is light or
absent.
- 4: Increase lightning probability where ice is likely in the observed
radar column.
In this doc-string, LR is an abbreviation for the Lightning Risk index output by the CDP (Convection Diagnosis Procedure) and the Met Office nowcast. LR can take five values. 5 is the lowest risk and 1 is highest.
The default behaviour makes these adjustments to the upper and lower limits of lightning probability: lightning mapping (lightning rate in “min^-1”):
- upper: lightning rate >= <function> => lightning prob = 1.0 (LR1)
The <function> returns a linear value from 0.5 to 2.5 over a 6-hour forecast_period.
lower: lightning rate == 0.0 => min lightning prob 0.25 (LR2)
- precipitation mapping (for prob(precip > 0.5 mm/hr)):
upper: precip probability >= 0.1 => max lightning prob 1.0 (LR1)
middle: precip probability >= 0.05 => max lightning prob 0.25 (LR2)
lower: precip probability >= 0.0 => max lightning prob 0.0067 (LR3)
- heavy: prob(precip > 7mm/hr) >= 0.4 => min lightning prob 0.25 (LR2)
equiv radar refl 37dBZ
- intense:prob(precip > 35mm/hr) >= 0.2 => min lightning prob 1.0 (LR1)
equiv radar refl 48dBZ
- VII (vertically-integrated ice) mapping (kg/m2):
upper: VII 2.0 => max lightning prob 0.9
middle: VII 1.0 => max lightning prob 0.5
lower: VII 0.5 => max lightning prob 0.1
-
__init__(radius=10000.0)[source]¶ Initialise class for Nowcast of lightning probability.
- Parameters
radius (float) – Radius (metres) over which to neighbourhood process the output lightning probability. The value supplied applies at T+0 and increases to 2*radius at T+6 hours. The radius is applied in “process” using the circular neighbourhood plugin.
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
_modify_first_guess(cube, first_guess_lightning_cube, lightning_rate_cube, prob_precip_cube, prob_vii_cube=None)[source]¶ Modify first-guess lightning probability with nowcast data.
- Parameters
cube (iris.cube.Cube) – Provides the meta-data for the Nowcast lightning probability output cube.
first_guess_lightning_cube (iris.cube.Cube) – First-guess lightning probability. Must have same x & y dimensions as cube. Time dimension should overlap that of cube (closest slice in time is used with a maximum time mismatch of 2 hours). This is included to allow this cube to come from a different modelling system, such as the UM.
lightning_rate_cube (iris.cube.Cube) – Nowcast lightning rate. Must have same dimensions as cube.
prob_precip_cube (iris.cube.Cube) – Nowcast precipitation probability (threshold > 0.5, 7, 35). Must have same other dimensions as cube.
prob_vii_cube (iris.cube.Cube) – Radar-derived vertically integrated ice content (VII). Must have same x and y dimensions as cube. Time should be a scalar coordinate. Must have a threshold coordinate with points matching. self.vii_thresholds. Can be <No cube> or None or anything that evaluates to False.
- Returns
Output cube containing Nowcast lightning probability.
- Return type
- Raises
iris.exceptions.ConstraintMismatchError – If lightning_rate_cube or first_guess_lightning_cube do not contain the expected times.
-
static
_update_metadata(cube)[source]¶ Modify the meta data of input cube to resemble a Nowcast of lightning probability.
Rename to “probability_of_rate_of_lightning_above_threshold”
2. Remove “threshold” coord (or causes iris.exceptions.CoordinateNotFoundError)
Discard all cell_methods
- Parameters
cube (iris.cube.Cube) – An input cube
- Returns
Output cube - a copy of input cube with meta-data relating to a Nowcast of lightning probability. The data array will be a copy of the input cube.data
- Return type
-
apply_ice(prob_lightning_cube, ice_cube)[source]¶ Modify Nowcast of lightning probability with ice data from a radar composite (VII; Vertically Integrated Ice)
- Parameters
prob_lightning_cube (iris.cube.Cube) – First-guess lightning probability. The forecast_period coord is modified in-place to “minutes”.
ice_cube (iris.cube.Cube) – Analysis of vertically integrated ice (VII) from radar thresholded at self.ice_thresholds. Units of threshold coord modified in-place to kg m^-2
- Returns
Output cube containing updated nowcast lightning probability. This cube will have the same dimensions and meta-data as prob_lightning_cube. The influence of the data in ice_cube reduces linearly to zero as forecast_period increases to 2H30M.
- Return type
- Raises
iris.exceptions.ConstraintMismatchError – If ice_cube does not contain the expected thresholds.
-
apply_precip(prob_lightning_cube, prob_precip_cube)[source]¶ Modify Nowcast of lightning probability with precipitation rate probabilities at thresholds of 0.5, 7 and 35 mm/h.
- Parameters
prob_lightning_cube (iris.cube.Cube) – First-guess lightning probability.
prob_precip_cube (iris.cube.Cube) – Nowcast precipitation probability (threshold > 0.5, 7., 35. mm hr-1) Units of threshold coord modified in-place to mm hr-1
- Returns
Output cube containing updated nowcast lightning probability. This cube will have the same dimensions and meta-data as prob_lightning_cube.
- Return type
- Raises
iris.exceptions.ConstraintMismatchError – If prob_precip_cube does not contain the expected thresholds.
-
ice_thresholds= (0.5, 1.0, 2.0)¶ Expected thresholds for vertically-integrated-ice (VII) data. These are used for increasing prob(lightning) with column-ice data. Units are kg/m2.
- Type
(tuple)
-
process(cubelist)[source]¶ Produce Nowcast of lightning probability.
- Parameters
cubelist (iris.cube.CubeList) –
- Where thresholds are listed, only these threshold values will
be used.
- Contains cubes of
First-guess lightning probability
- Nowcast precipitation probability
(required thresholds: > 0.5, 7., 35. mm hr-1)
Nowcast lightning rate
(optional) Analysis of vertically integrated ice (VII) from radar thresholded into probability slices at self.ice_thresholds.
- Returns
Output cube containing Nowcast lightning probability. This cube will have the same dimensions as the input Nowcast precipitation probability after the threshold coord has been removed.
- Return type
- Raises
iris.exceptions.ConstraintMismatchError – If cubelist does not contain the expected cubes.