The following blog will help give programmers a simple formula for average wind direction and speed.
Here is an excel sheet with all averaging examples
First a disclaimer: I am not a mathematician. The idea behind this blog is not to teach math it is simply to give the formula to calculate the Average Wind Direction and Average Wind Speed.
Averaging Wind Direction is different than simply averaging a set of numbers. If I wanted the average temperature over 5 readings I would add the 5 numbers and divide by 5… simple grade 4 math.
2°C + 2°C + 4°C + 1°C + 1°C = 10°C / 5 = 2°C
Why it is difficult
The problem with Wind Direction and Speed is 2 fold:
1. There are 2 components (direction and speed) that must be averaged together.
If you want to Average (N 1 km/h) with (N 3 km/h) you’ll get (N 2km/h) as the average because the direction is the same we can simply average it as we would normally.
But when the direction is different (N 1 km/h) and (W 1 km/h) we cannot simply average the two directions. (N 1 km/h) + (W 1 km/h) != (NW 1km/h)
2. Wind Direction can not be averaged by adding and dividing since it is a 360° circle.
The “reset” from 359° to 1° also complicates things, you cannot average (N 359°) with (N 1°), logically this should be at around 0° or straight North. But averaging 359° with 1° gives us (359+1)/2 180° which is straight south. Of course this is incorrect.
How is it done
Averaging Wind Direction and Speed is done by splitting out the East/West vector and the North/South vector. Each of these can be averaged then recombined to produce a speed and a direction. Some Wind Sensors will already provide the split Uvector and Vvector which saves a step.
The raw formula is available here: http://www.webmet.com/met_monitoring/622.html
I will try to provide a step-by-step to help programmers. If you are already provided with the East/West and North/South vectors you can skip to step 2.
Step 1: Break Out East/West and North/South Vectors
If you are provided with a 360° direction and a wind speed you must first breakout the East/West and North/South components so they can be averaged. In order to use this formula we must use radians so each Vector will be converted to Radians.
Step 2: Combine Vectors back into a direction and speed
Note: If you are given the Vectors you can simply use the following skipping Step 1
AverageWindSpeed = SQRT(EW_Average² + NS_Average²) //Simple Pythagorean Theorem.
Atan2Direction = ATAN2(EW_Average, NS_Average) //can be found in any math library
AvgDirectionInDeg = RadiansToDegrees(Atan2Direction)
//Correction As specified in webmet.com webpage http://www.webmet.com/met_monitoring/622.html
if(AvgDirectionInDeg > 180)
AvgDirectionInDeg -= 180
else if(AvgDirectionInDeg < 180)
AvgDirectionInDeg += 180
Now you will have an Average Wind Speed and a direction between 0-360°.
One Final note:
There are some cases where the x/y coordinates are reversed. This is important as in the following scenario:
In this Case the reported North/South Vector is reversed. When you are calculating the averages you will have to reverse the radians by *-1.