earthkit.meteo.wind.direction

earthkit.meteo.wind.direction(u: ArrayLike, v: ArrayLike, convention: str = 'meteo', to_positive: bool = True) ArrayLike
earthkit.meteo.wind.direction(u: xarray.DataArray, v: xarray.DataArray, convention: str = 'meteo', to_positive: bool = True) xarray.DataArray

Compute the direction/angle of a vector quantity.

Parameters:
  • u (array-like | xarray.DataArray) – u wind/x vector component

  • v (array-like | xarray.DataArray) – v wind/y vector component (same units as u)

  • convention (str, optional) –

    Specify how the direction/angle is interpreted. The possible values are as follows:

    • ”meteo”: the direction is the meteorological wind direction (see below for explanation)

    • ”polar”: the direction is measured anti-clockwise from the x axis (East/right) to the vector

  • to_positive (bool, optional) – If True, the resulting values are mapped into the [0, 360] range when convention is “polar”. Otherwise they lie in the [-180, 180] range.

Returns:

Direction/angle (degrees)

Return type:

array-like | xarray.DataArray

Notes

The meteorological wind direction is the direction from which the wind is blowing. Wind direction increases clockwise such that a northerly wind is 0°, an easterly wind is 90°, a southerly wind is 180°, and a westerly wind is 270°. The figure below illustrates how it is related to the actual orientation of the wind vector:

../../../../_images/wind_direction.png

Implementations

direction() calls one of the following implementations depending on the type of the input arguments:

The function returns an object of the same type as the input arguments.