wind_direction#

metpy.calc.wind_direction(u, v, convention='from')[source]#

Compute the wind direction from u and v-components.

Parameters:
  • u (pint.Quantity) – Wind component in the X (East-West) direction

  • v (pint.Quantity) – Wind component in the Y (North-South) direction

  • convention (str) – Convention to return direction; ‘from’ returns the direction the wind is coming from (meteorological convention), ‘to’ returns the direction the wind is going towards (oceanographic convention), default is ‘from’.

Returns:

direction (pint.Quantity) – The direction of the wind in intervals [0, 360] degrees, with 360 being North, direction defined by the convention kwarg.

See also

wind_components

Notes

In the case of calm winds (where u and v are zero), this function returns a direction of 0.

Examples

>>> from metpy.calc import wind_direction
>>> from metpy.units import units
>>> wind_direction(10. * units('m/s'), 10. * units('m/s'))
<Quantity(225.0, 'degree')>