improver.nowcasting.utilities module¶
Module with utilities required for nowcasting.
-
class
improver.nowcasting.utilities.ApplyOrographicEnhancement(operation)[source]¶ Bases:
improver.BasePluginApply 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_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
_apply_minimum_precip_rate(precip_cube, cube)[source]¶ Ensure that negative precipitation rates are capped at the defined minimum precipitation rate.
- Parameters
precip_cube (iris.cube.Cube) – Cube containing a precipitation rate input field.
cube (iris.cube.Cube) – Cube containing the precipitation rate field after combining with orographic enhancement.
- Returns
Cube containing the precipitation rate field where any negative precipitation rates have been capped at the defined minimum precipitation rate.
- Return type
-
_apply_orographic_enhancement(precip_cube, oe_cube)[source]¶ Combine the precipitation rate cube and the orographic enhancement cube.
- Parameters
precip_cube (iris.cube.Cube) – Cube containing the input precipitation field.
oe_cube (iris.cube.Cube) – Cube containing the orographic enhancement field matching the validity time of the precipitation cube.
- Returns
Cube containing the precipitation rate field modified by the orographic enhancement cube.
- Return type
-
static
_select_orographic_enhancement_cube(precip_cube, oe_cubes, allowed_time_diff=1800)[source]¶ Select the orographic enhancement cube with the required time coordinate.
- Parameters
precip_cube (iris.cube.Cube) – Cube containing the input precipitation fields.
oe_cubes (iris.cube.Cube or iris.cube.CubeList) – Cube or CubeList containing the orographic enhancement fields.
allowed_time_diff (int) – An int in seconds to define a limit to the maximum difference 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.
- Returns
Cube containing the orographic enhancement fields at the required time.
- Return type
-
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
precip_cubes (iris.cube.Cube or iris.cube.CubeList) – Cube or CubeList containing the input precipitation fields.
orographic_enhancement_cube (iris.cube.Cube) – Cube containing the orographic enhancement fields.
- Returns
CubeList of precipitation rate cubes that have been updated using orographic enhancement.
- Return type
-
-
class
improver.nowcasting.utilities.ExtendRadarMask[source]¶ Bases:
improver.BasePluginExtend 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_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
process(radar_data, coverage)[source]¶ Update the mask on the input rainrate cube to reflect where coverage is valid
- Parameters
radar_data (iris.cube.Cube) – Radar data with mask corresponding to radar domains
coverage (iris.cube.Cube) –
- Radar coverage data containing values:
0: outside composite 1: precip detected 2: precip not detected & 1/32 mm/h detectable at this range 3: precip not detected & 1/32 mm/h NOT detectable
- Returns
Radar data with mask extended to mask out regions where 1/32 mm/h are not detectable
- Return type
-