improver.wind_calculations.wind_components module

Module containing plugin to resolve wind components.

class ResolveWindComponents[source]

Bases: BasePlugin

Plugin to resolve wind components along an input cube’s projection axes, given directions with respect to true North

_abc_impl = <_abc_data object>
static calc_true_north_offset(reference_cube)[source]

Calculate the angles between grid North and true North, as a matrix of values on the grid of the input reference cube.

Parameters:

reference_cube (Cube) – 2D cube on grid for which “north” is required. Provides both coordinate system (reference_cube.coord_system()) and template spatial grid on which the angle adjustments should be provided.

Return type:

ndarray

Returns:

Angle in radians by which wind direction wrt true North at each point must be rotated to be relative to grid North.

process(wind_speed, wind_dir)[source]

Convert wind speed and direction into u,v components along input cube projection axes.

Parameters:
  • wind_speed (Cube) – Cube containing wind speed values

  • wind_dir (Cube) – Cube containing wind direction values relative to true North

Return type:

Tuple[Cube, Cube]

Returns:

  • Cube containing wind speeds in the positive projection x-axis direction, with units and projection matching wind_speed cube.

  • Cube containing wind speeds in the positive projection y-axis direction, with units and projection matching wind_speed cube.

static resolve_wind_components(speed, angle, adj)[source]

Perform trigonometric reprojection onto x and y axes

Parameters:
  • speed (Cube) – Cube containing wind speed data

  • angle (Cube) – Cube containing wind directions as angles from true North

  • adj (ndarray) – 2D array of wind direction angle adjustments in radians, to convert zero reference from true North to grid North. Broadcast automatically if speed and angle cubes have extra dimensions.

Return type:

Tuple[Cube, Cube]

Returns:

  • Cube containing wind vector component in the positive x-direction u_speed

  • Cube containing wind vector component in the positive y-direction v_speed