Wind direction mean calculation

694 views
Skip to first unread message

Marcio Malacarne

unread,
Jan 4, 2016, 7:03:22 AM1/4/16
to wv...@googlegroups.com
Hello!

I'm interested in calculate the mean of the wind direction. We use wview to visualize and register our data obtained with the meteorological station, and to compare with other apps.

The doubt is: how the wind direction mean is calculated?
What is the archive or algoritm to do it?

We were trying to develop our own way, but couldn't find a good solution.

Greetings from Brazil! 
Thank you. 
marcio

Graham Eddy

unread,
Jan 4, 2016, 7:27:25 AM1/4/16
to wview Google Group
i saw an earlier request and interpreted it as for non-personal use so there are intellectual property (IP) issues. short term values are calculated by weather station hardware - talk to the manufacturers. longer term values calculated by wview, the IP belongs to author mark teel, who has made the source code available under a GNU license
___________
Graham Eddy

--
You received this message because you are subscribed to the Google Groups "wview" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wview+un...@googlegroups.com.
To post to this group, send email to wv...@googlegroups.com.
Visit this group at https://groups.google.com/group/wview.
For more options, visit https://groups.google.com/d/optout.

Brooks Clark

unread,
Jan 4, 2016, 11:34:31 AM1/4/16
to wview
I’m not sure where this algorithm comes from originally, but it’s pretty standard practice when averaging azimuthal data.

1) Calculate dx = cos(theta) & dy = sin(theta) for each measurement
2) Calculate the average dx_avg = SUM(dx) / n and dy_avg = SUM(dy) / n
3) Calculate theta_avg = ATAN2(dy_avg, dx_avg)

Requires some special handling when the angle approaches 0.



Marcio

unread,
Jan 5, 2016, 12:13:27 PM1/5/16
to wview
Hi,
Thanks for the tips.
Any news will comment
marcio

John M

unread,
Feb 2, 2016, 8:30:18 PM2/2/16
to wview

John M

unread,
Feb 2, 2016, 8:58:55 PM2/2/16
to wview
The post by Brooks is pretty close.  Because you are using a ratio in the ATAN2 function, you can use the total of the x and y vectors without averaging both.  This will save a couple of floating point operations.  Also, use of the ATAN2 function instead of the ATAN function takes care of the divide by zero problem within the function.  ATAN2 also places the azimuth in the correct quadrant.  That is why you have to provide two arguments instead of just the y/x ratio.  While x=1, y=1 and x=-1, y=-1 have the same tangent, they are not in the same quadrant.  It is my understanding that standard average wind direction is based on observing wind direction every five seconds for two minutes and averaging the 24 data points.

I am writing the software myself in Python 2.7 for a RasPi 2 using an Arduino Uno to collect and transmit the data.  My goal is to start posting the data to the Citizen's Weather Observer Program of the US National Weather Service and open source the software.  I'm still have problems with the rain data due to switch bounce.  Here's what it looks like so far:

http://www.swa.rcschools.net/teachers/marablej/weather.html

But, I'm just a math teacher.






On Monday, January 4, 2016 at 6:03:22 AM UTC-6, Marcio wrote:

Marcio

unread,
Feb 3, 2016, 4:53:53 PM2/3/16
to wview
Dear John,

Thank you for your answer, I think we're going in the right direction here.
Your software will also calculate the wind direction mean?



John M

unread,
Feb 7, 2016, 6:21:17 PM2/7/16
to wview
It does calculate the mean wind direction.  It runs on Windows and Linux and should run on a Mac.  I did leave out the fact that the Python ATAN2 function gives the azimuth in radians measured counterclockwise from East.  The program converts this to the traditional degrees measured clockwise from North.

My weather station uses the SwitchDoc WeatherPiArduino weather board with their WeatherRack instrument cluster.  It's $100 for both on Amazon.  It works well except for a switch bounce problem in the rain tipper bucket.  I think that I have it fixed in software, but I need to remount the cluster to eliminate vibration from the wind and calibrate it against a traditional rain gauge. 

I have been working with the CWOP to get my observations standardized with respect to averaging readings and the standard definition of a wind gust, etc.  My telnet routine is reaching the CWOP servers, but my data is not being accepted yet.  I am waiting for a response on that.

I'll try to put the software up on my Google Drive and share it.  It is still rough, but I'll post a link here and keep updating it.  It has been running reliably for over a week now on a Raspberry Pi 2.

John M

unread,
Feb 7, 2016, 6:51:51 PM2/7/16
to wview
Here is the link:

https://drive.google.com/file/d/0B2jnovbhqK0rWEZ3am0wX1VlNFE/view?usp=sharing

The program opens a serial port and reads data as a plain text string every five seconds.  It reads temperature in degrees Fahrenheit + 200 degrees to avoid negative temperatures, humidity in percent, barometric pressure in inches of Mercury, wind direction in degrees azimuth counterclockwise from North, wind speed in MPH and rain in inches.

It starts a webserver in a separate thread. 

It processes the data calculating average readings, wind chill, heat index, and wind gusts.

It displays the data on the terminal, saves the data to file, writes a web page, serves the web page locally on the host computer, ftps the web page to a web server on the internet and tries to telnet the data to the CWOP.

I'm new to Python, I'm self-taught, and I haven't coded in years (FORTRAN, Turbo Pascal & BASIC!).  It isn't pretty, but it works.  I hope that this is of some help to you.  I would be glad to post the Arduino code also.


On Wednesday, February 3, 2016 at 3:53:53 PM UTC-6, Marcio wrote:

Marcio

unread,
Oct 18, 2016, 7:13:01 AM10/18/16
to wview
Dear Jhon,

On the station web do not have the wind direction.
some problem?
Reply all
Reply to author
Forward
0 new messages