earthkit.meteo.wind.xarray.xy_to_polar

earthkit.meteo.wind.xarray.xy_to_polar(x, y, convention='meteo')

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

Parameters:
  • x (xarray.DataArray) – u wind/x vector component

  • y (xarray.DataArray) – v wind/y vector component (same units as x)

  • 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

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

Returns:

  • xarray.DataArray – Magnitude (same units as x)

  • xarray.DataArray – Direction (degrees)

Return type:

tuple[xarray.DataArray, xarray.DataArray]

Notes

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