Page 1 of 1

Wind Direction U and V

Posted: Thu Apr 12, 2007 8:18 pm
by Ian
Hi Jeff,

I am using DEGRIB to convert grib2 files into a XML format, but i need to calulate wind direction and wind speed.

I believe this is stored in a grib message as

UGRD
VGRD
both in M/S

I used the formla atan2(y,x)

Where y is the V and x is U

is this correct? and is the output in DEG.

I am getting a little lost here, and wondered if you could help me out.

Ian

Posted: Fri Apr 13, 2007 2:16 am
by jkrob
Ian,

Well, you are half right...but not quite. Yes, UGRD & VGRD are the way wind is 'packed' into GRIB messages. However, the numbers are not straight forward. Here are the formulas to get wind speed (M/S) & direction (grid relative) from the U & V

DIRECTION=57.29578*(arctangent(UGRD,VGRD))+180.
SPEED=SQRT(UGRD*UGRD+VGRD*VGRD)

Clear as mud...right? In essence, the UGRD is the North/South wind component (North is + & South is -) and VGRD is the East/West wind component (East is + West is - [I think...]).

Remember...you asked for it ;-)

Thanks,
Jeff

Posted: Fri Apr 13, 2007 7:23 am
by Ian
Hi Jeff,

Thanks for that. However (DIRECTION=57.29578*(arctangent(UGRD,VGRD))+180)

Does this formula work in what ever quadrant?

Or does the +180 change to suit V and U values?

i.e

180 if V>=0
0 if U<0 and V<0>0 and V<0

Ian

Posted: Fri Apr 13, 2007 8:13 am
by Ian
Hi again,

Tried the DIRECTION=57.29578*(arctangent(UGRD,VGRD))+180 Could not get it to work.

Entered DIRECTION=57.29578*(ATAN2(UGRD,VGRD))+180

Works OK - where U = 6 and V = 5, result dir= 220 deg

Speed = 8 m/s

Could you check it please.

Thanks
Ian

Posted: Fri Apr 13, 2007 7:01 pm
by jkrob
Ian,

Yes, those numbers look good. Sorry for the confusion; arctangent & ATAN2 were the same thing. I did not know if you knew Fortran functions so I wrote the formula out longhand.

Jeff

Posted: Fri Apr 13, 2007 9:09 pm
by Ian
Jeff,

No probs mate for the confusion, just glad you could help me out.

While Iam picking your brain for the maths, perhaps you would be able to help me out again.

I have two more calcs to do

1. PRATE, [kg/(m^2 s) to mm/h
2. Weather strings.

Now i was going to use the DAVIS weather software which came with my weather station to give a description of the weather based on the output of the GRIB model, but this is only based on pressure trends.
Is there a WMO standard for simple weather strings. I have looked on google, but have not found anything as of yet which made much sence to me.

Ian.

P.S
Wingridds is getting better with every relaese - keep up the good work.

Posted: Sat Apr 14, 2007 2:15 am
by jkrob
Ian,

Sorry...I don't really follow what it is you are trying to accomplish. Can you be more 'verbose' in your explaination? ;-)

Thanks,
Jeff