improver.nowcasting.pysteps_advection module

Semi-Lagrangian backward advection plugin using pysteps

class PystepsExtrapolate(interval, max_lead_time)[source]

Bases: BasePlugin

Wrapper for the pysteps semi-Lagrangian extrapolation method

Reference:

https://pysteps.readthedocs.io/en/latest/generated/ pysteps.extrapolation.semilagrangian.extrapolate.html

__init__(interval, max_lead_time)[source]

Initialise the plugin

Parameters:
  • interval (int) – Lead time interval, in minutes

  • max_lead_time (int) – Maximum lead time required, in minutes

_abc_impl = <_abc_data object>
_generate_displacement_array(ucube, vcube)[source]

Create displacement array of shape (2 x m x n) required by pysteps algorithm

Parameters:
  • ucube (Cube) – Cube of x-advection velocities

  • vcube (Cube) – Cube of y-advection velocities

Return type:

ndarray

Returns:

Array of shape (2, m, n) containing the x- and y-components of the m*n displacement field (format required for pysteps extrapolation algorithm)

_generate_forecast_cubes(all_forecasts, attributes_dict)[source]

Convert forecast arrays into IMPROVER output cubes with re-added orographic enhancement

Parameters:
  • all_forecasts (ndarray) – Array of 2D forecast fields returned by extrapolation function

  • attributes_dict (Optional[Dict]) – Dictionary containing information for amending the attributes of the output cube.

Return type:

List[Cube]

Returns:

List of iris.cube.Cube instances containing forecasts at all required lead times, and conforming to the IMPROVER metadata standard.

_get_advectable_precip_rate()[source]

From the initial cube, generate a precipitation rate array in mm h-1 with orographic enhancement subtracted, as required for advection

Return type:

ndarray

Returns:

2D precipitation rate array in mm h-1

_reformat_analysis_cube(attribute_changes)[source]

Add forecast reference time and forecast period coordinates (if they do not already exist) and nowcast attributes to analysis cube

_set_up_output_cubes(all_forecasts)[source]

Convert 3D numpy array into list of cubes with correct time metadata. All other metadata are inherited from self.analysis_cube.

Parameters:

all_forecasts (ndarray) – Array of 2D forecast fields returned by extrapolation function

Return type:

CubeList

Returns:

List of extrapolated cubes with correct time coordinates

process(initial_cube, ucube, vcube, orographic_enhancement, attributes_dict=None)[source]

Extrapolate the initial precipitation field using the velocities provided to the required forecast lead times

Parameters:
  • initial_cube (Cube) – Cube of precipitation at initial time

  • ucube (Cube) – x-advection velocities

  • vcube (Cube) – y-advection velocities

  • orographic_enhancement (Cube) – Cube containing orographic enhancement fields at all required lead times

  • attributes_dict (Optional[Dict]) – Dictionary containing information for amending the attributes of the output cube.

Return type:

List[Cube]

Returns:

List of extrapolated iris.cube.Cube instances at the required lead times (including T+0 / analysis time)