# compute standard deviation of wind direction angle

How would one compute the standard deviation of wind direction that can assume values between 0 and 360°? I have the wind information in u and v components and corresponding angle. Getting the average is possible to take the average of u and v and then compute the angle, while just averaging the angular information could result in averages of 180° when wind directions strays around 0°. If I took standard deviations of u and v, how would I have to compute them to get the standard deviation of the angle?

• Circular measures of dispersion are not as intuitive as you might hope and are affected by whether you are just looking at angles or also at magnitudes. It is worth looking at en.wikipedia.org/wiki/… – Henry Dec 19 '19 at 14:14
• Could you explain what a standard deviation of an angle might mean, given that the numerical measure of an angle is defined only up to an integral multiple of 360 degrees? – whuber Dec 19 '19 at 15:13
• Sorry for my imprecise description. So basically I have 20Hz wind data and I want to plot the 10min average wind direction over time and have errorbars on it. To calculate those, I want to take the standard deviation - which is too large and wrong if wind direction values jump between 359 and 0, same for averaging. But the averaging issue can be dealt with by averaging wind in x and y directions and then compute the direction from them. I am not comfortable doing that with computing standard deviations from the wind components and go from there, not sure if that's allowed. – sfluck Dec 19 '19 at 15:52

I had a similar problem and used Yamartino method: https://en.wikipedia.org/wiki/Yamartino_method which is one pass approximation for wind direction variation. in python it something like (the code is not optimised though):

from math import *
def yamartino(thetalist):
s=0
c=0
n=0.0
for theta in thetalist: