improver.wind_calculations.wind_components module

Module containing plugin to resolve wind components.

class improver.wind_calculations.wind_components.ResolveWindComponents[source]

Bases: improver.BasePlugin

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

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 213
_abc_registry = <_weakrefset.WeakSet 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 (iris.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.

Returns

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

Return type

numpy.ndarray

process(wind_speed, wind_dir)[source]

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

Parameters
  • wind_speed (iris.cube.Cube) – Cube containing wind speed values

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

Returns

tuple containing:
ucube (iris.cube.Cube):

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

vcube (iris.cube.Cube):

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

Return type

(tuple)

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

Perform trigonometric reprojection onto x and y axes

Parameters
  • speed (iris.cube.Cube) – Cube containing wind speed data

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

  • adj (numpy.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.

Returns

tuple containing:
u_speed (iris.cube.Cube):

Cube containing wind vector component in the positive x-direction

v_speed (iris.cube.Cube):

Cube containing wind vector component in the positive y-direction

Return type

(tuple)