[wxqc] Average wind direction?

Mark Wyman mark at markwyman.com
Thu Aug 10 22:22:35 EDT 2006


I have a VB .BAS file with a bunch of 2D and 3D vector math in there which
simplifies things a lot. E-mail me if you would like it. Very easy to use!

Private Const numMeas = 5

Public Sub average2DWindVectors()
    Dim windSpeedArray(numMeas - 1) As Polar
    Dim windSum As Polar
    Dim windCount As Polar
    Dim I As Long
    
    'Initialize fake measurements
    windSpeedArray(0).Angle = 120 * PI / 180
    windSpeedArray(0).Magnitude = 12.5
    windSpeedArray(1).Angle = 100 * PI / 180
    windSpeedArray(1).Magnitude = 12.5
    windSpeedArray(2).Angle = 90 * PI / 180
    windSpeedArray(2).Magnitude = 12.5
    windSpeedArray(3).Angle = 324 * PI / 180
    windSpeedArray(3).Magnitude = 12.5
    windSpeedArray(4).Angle = 300 * PI / 180
    windSpeedArray(4).Magnitude = 12.5
    
    'Sum all of the measurements
    For I = 0 To numMeas - 1
        windSum = Math_Mod.Polar_Add(windSum, windSpeedArray(I))
    Next I
    
    'Set up the averager (angle 0 for clean divide)
    windCount.Magnitude = numMeas
    windCount.Angle = 0
    
    'Find the average
    windSum = Math_Mod.Polar_Divide(windSum, windCount)
    
End Sub


Using my math routine yields an answer of:

3.84 MPH at an angle of 65.5degrees

-----Original Message-----
From: wxqc-bounces at lists.gladstonefamily.net
[mailto:wxqc-bounces at lists.gladstonefamily.net] On Behalf Of
steveh at softwx.com
Sent: Thursday, August 10, 2006 11:00 PM
To: Discussion of weather data quali
Subject: Re: [wxqc] Average wind direction?

Hi,

For wind direction, you could use a unit vector average (not weighted by
speed). 
Steps:
1. Convert wind dir degrees to radians
2. x = sin(winddir in radians)
3. y = cos(winddir in radians)
4. Vx = avg(x)      //i.e. sum(x) / number of samples
5. Vy = avg(y)
6. avg wind dir in radians = arcTan(Vx / Vy)
7. convert avg wind dir to degrees

Note that you have to include code to fixup the resultant quadrant. In
Object Pascal (Delphi) there is an function that simplifies this; in step 6
you would use
avgWindDirRad := ArcTan2(Vx, Vy);

and after converting to degrees...
if (avgWindDirDeg < 0) then avgWindDirDeg := avgWindDirDeg + 180;

Here is a source for some detailed info on the topic:
http://www.bom.gov.au/bmrc/csr/prc/usepa-met-obs,4.5.99.rtf

Steve
  
======= At 2006-08-10, 10:46:20 you wrote: =======

>So, as I'm slowly making progress on this Perl script in the bits of
>time I get here and there, I'm stumped on how to come up with a wind
>direction average.  Maybe I'm putting too much thought into this?  I
>have several documents that describe the data fields, but no one
>document is clear on all of the elements (i.e., one document says the
>avg wind speed is an average over 5 minutes, another one says it's a
>10 minute sustained (minimum?) wind).
>
>Anyway I Google'd for info on average the wind direction and appears
>some of them try to take into account hte wind speed as well as part
>of that calculation.  I assumed it was just a an average sample based
>on direction alone.  Am I overanalyzing this?
>
>What formulas are people using to calculate the average wind direction
>in their own programming?
>
>-- 
>Joe Morris
>_______________________________________________
>wxqc mailing list
>Post messages to wxqc at lists.gladstonefamily.net
>To unsubcribe or change delivery options, please go to:
>http://pond1.gladstonefamily.net:8080/mailman/listinfo/wxqc
>
>The contents of this message are the responsibility of the author.


_______________________________________________
wxqc mailing list
Post messages to wxqc at lists.gladstonefamily.net
To unsubcribe or change delivery options, please go to:
http://pond1.gladstonefamily.net:8080/mailman/listinfo/wxqc

The contents of this message are the responsibility of the author.

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.8/415 - Release Date: 8/9/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.8/415 - Release Date: 8/9/2006
 



More information about the wxqc mailing list