improver.nowcasting.utilities module
Module with utilities required for nowcasting.
- class ApplyOrographicEnhancement(operation)[source]
Bases:
BasePlugin
Apply orographic enhancement to precipitation rate input, either to add or subtract an orographic enhancement component.
- __init__(operation)[source]
Initialise class.
- Parameters:
operation (
str
) – Operation (“add” or “subtract”) to apply to the incoming cubes.- Raises:
ValueError – Operation not supported.
- _abc_impl = <_abc_data object>
- _apply_minimum_precip_rate(precip_cube, cube)[source]
Ensure that negative precipitation rates are capped at the defined minimum precipitation rate.
- Parameters:
- Return type:
- Returns:
Cube containing the precipitation rate field where any negative precipitation rates have been capped at the defined minimum precipitation rate.
- _apply_orographic_enhancement(precip_cube, oe_cube)[source]
Combine the precipitation rate cube and the orographic enhancement cube.
- Parameters:
- Return type:
- Returns:
Cube containing the precipitation rate field modified by the orographic enhancement cube.
- static _select_orographic_enhancement_cube(precip_cube, oe_cube, allowed_time_diff=1800)[source]
Select the orographic enhancement cube with the required time coordinate.
- Parameters:
precip_cube (
Cube
) – Cube containing the input precipitation fields.oe_cube (
Cube
) – Cube containing orographic enhancement fields at one or more times.allowed_time_diff (
int
) – The maximum permitted difference, in integer seconds, between the datetime of the precipitation cube and the time points available within the orographic enhancement cube. If this limit is exceeded, then an error is raised.
- Return type:
- Returns:
Cube containing the orographic enhancement field at the required time.
- Raises:
ValueError – If required time step is not available within tolerance (in theory. In practise, the tolerance is left as the default None, which matches ANY available field regardless of time offset. So this error will never be thrown.)
- process(precip_cubes, orographic_enhancement_cube)[source]
Apply orographic enhancement by modifying the input fields. This can include either adding or deleting the orographic enhancement component from the input precipitation fields.
- Parameters:
- Return type:
- Returns:
CubeList of precipitation rate cubes that have been updated using orographic enhancement.
- class ExtendRadarMask[source]
Bases:
BasePlugin
Extend the mask on radar rainrate data based on the radar coverage composite
- __init__()[source]
Initialise with known values of the coverage composite for which radar data is valid. All other areas will be masked.
- _abc_impl = <_abc_data object>
- class FillRadarHoles[source]
Bases:
BasePlugin
Fill in small “no data” regions in the radar composite by interpolating in log rainrate space.
The log-linear transformation does not preserve non-zero rainrates of less than 0.001 mm/h. Since the radar composite encodes trace rain rates with a value of 0.03 mm/h, this should not have any effect on “real” data from the Met Office.
- MIN_RR_MMH = 0.001
- __init__()[source]
Initialise parameters of interpolation
The constants defining neighbourhood size and proportion of neighbouring masked pixels for speckle identification have been empirically tuned for UK radar data. As configured, this method will flag “holes” of up to 24 pixels in size (30% of a 9 x 9 neighbourhood).
The radius used to interpolate data into these holes has been chosen to match these constants, by defining the smallest radius that ensures there will always be valid data in the neighbourhood (25 pixels) over which averaging is performed.
- _abc_impl = <_abc_data object>
- _find_and_interpolate_speckle(cube)[source]
Identify and interpolate “speckle” points, where “speckle” is defined as areas of “no data” that are small enough to fill by interpolation without affecting data integrity. We would not wish to interpolate large areas as this may give false confidence in “no precipitation”, where in fact precipitation exists in a “no data” region.
Masked pixels near the borders of the input data array are not considered for interpolation.