# Calculate average wind direction

What is the best way to average wind direction? I have found many conflicting suggestions elsewhere. Best one I saw is to average SINs of all angles in radians and take inverse SIN of the result.

This is to be used to produce a windrose where the input must have one record per hour, but the data provided has several records per hour.

-
The real questions, I think, are 1) what do you mean by an average direction? 2) what do you want to use this for? –  Robert Israel Jun 10 '11 at 19:08

While it's not quite meaningless to average the direction of the wind, it's ill-defined in many cases (imagine that you have a perfect east wind and a perfect west wind and you want to find the direction of their average!), and probably not really what you're after. Assuming that you have velocity data for the wind as well as directional data, you're best off turning the velocity+direction into a vector, adding those vectors, and then if you need a direction in the end, taking the direction of the result. In the case where your wind always has the same speed (or at least can be assumed to have constant speed), this is better than the mechanism you suggest: for instance, in your method an east wind ($\theta_0=0^{\circ}$) and a north wind ($\theta_1=90^{\circ}$) will give $s_0 = \sin(0^{\circ}) = 0$ and $s_1 = \sin(90^{\circ}) = 1$, so $s_{avg} = 0.5$ and $\theta_{avg} = \sin^{-1}(s_{avg}) = 30^{\circ}$, whereas the average-of-vectors method yields $v_0 = (\cos(\theta_0),\sin(\theta_0)) = (1,0), v_1 = (0,1), v_{avg} = (0.5, 0.5)$ and $\theta_{avg} = 45^{\circ}$. It also has the advantage that it's rotationally invariant; rotating the entire assemblage by any constant value (for instance, making your north wind a northeast wind and your east wind a southeast wind) will give an average that's the average of the initial data rotated by that amount. Note that in the case where the average is ill-defined, this method will yield a zero vector for the combined wind's direction, and so it (correctly) breaks down when trying to find an angle from that result.

-
You are right, the sine method is plain wrong. Thank you for the vector suggestion. +1 –  avguchenko Jun 11 '11 at 1:36
I know this is late but the method of decomposing the directions into u and v components is correct, although the best thing would be to work with complex numbers, since it is way simpler (automatic, actually). –  TomCho May 15 at 16:31

Averaging the sines of the inputs and taking the inverse sine of the result can't give you a sensible answer, since the range of the inverse sine function is $180^\circ$ rather than $360^\circ$.

You probably want to take the magnitude of the wind into account. For example, if you have a wind blowing to the east (at $0^\circ$) at 10 mph for half the time and to the north (at $90^\circ$) at 2 mph half the time, the average probably shouldn't be $45^\circ$ but something much closer to $0^\circ$.

A good solution would be to take the vectors of wind direction, add them all together and divide by the number of samples. For example, in the above case the average speed would be

$$\frac{(10,0) + (0,2)}{2} = (5,1)$$

which, if we plug it into the atan2 function gives a wind direction of $11.31^\circ$, or just slightly north of east. This method also has the nice property that it generalizes easily to higher dimensions which, though it might not be relevant for your work, is often an indicator that you're on the right track.

-

Question is old, but I found this in Wikipedia, which might be the "average of sin" stuff you wrote in your question:

"A simple way to calculate the mean of a series of angles (in the interval [0°, 360°)) is to calculate the mean of the cosines and sines of each angle, and obtain the angle by calculating the inverse tangent. Consider the following three angles as an example: 10, 20, and 30 degrees. Intuitively, calculating the mean would involve adding these three angles together and dividing by 3, in this case indeed resulting in a correct mean angle of 20 degrees. By rotating this system anticlockwise through 15 degrees the three angles become 355 degrees, 5 degrees and 15 degrees. The naive mean is now 125 degrees, which is the wrong answer, as it should be 5 degrees."

http://en.wikipedia.org/wiki/Directional_statistics#The_fundamental_difference_between_linear_and_circular_statistics

-