earthkit.meteo.wind.xy_to_polar

earthkit.meteo.wind.xy_to_polar(x: ArrayLike, y: ArrayLike, convention: str = 'meteo') tuple[ArrayLike, ArrayLike]
earthkit.meteo.wind.xy_to_polar(x: xarray.DataArray, y: xarray.DataArray, convention: str = 'meteo') tuple[xarray.DataArray, xarray.DataArray]

Convert wind/vector data from xy representation to polar representation.

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

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

  • convention (str) –

    Specify how the direction/angle component of the target polar coordinate system is interpreted. The possible values are as follows:

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

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

Returns:

  • array-like | xarray.DataArray – Magnitude (same units as u)

  • array-like | xarray.DataArray – Direction (degrees)

Notes

In the target xy representation the x axis points East while the y axis points North.

Implementations

xy_to_polar() 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.