improver.nowcasting.utilities module

Module with utilities required for nowcasting.

class improver.nowcasting.utilities.ApplyOrographicEnhancement(operation)[source]

Bases: object

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, -, subtract) to apply to the incoming cubes.
Raises:ValueError – Operation not supported.
_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:

cube (iris.cube.Cube)

_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:

cube (iris.cube.Cube)

static _select_orographic_enhancement_cube(precip_cube, oe_cubes)[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.
Returns:

Cube containing the orographic enhancement fields at the required time.

Return type:

oe_cube (iris.cube.Cube)

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:

updated_cubes (iris.cube.CubeList)

class improver.nowcasting.utilities.ExtendRadarMask[source]

Bases: object

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.

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:

(iris.cube.Cube)