lair.air.wind_direction#
- lair.air.wind_direction(u, v)[source]#
Convert u and v components to wind direction.
- Parameters:
u (np.array) – u component of wind
v (np.array) – v component of wind
- Returns:
np.array – wind direction in degrees (blowing from), NaN where u = v = 0: a zero vector has no direction, and arctan2(0, 0) = 0 would report 270 (west). This matters for vector-mean winds, where a dead-calm period averages to exactly zero.
See also
wind_componentsThe components from a speed and a direction.
Examples
>>> from lair.air import wind_direction >>> float(wind_direction(10.0, 0.0)) # blowing toward the east 270.0 >>> float(wind_direction(0.0, 0.0)) # calm nan