Wind Direction Change

Charles Seman Charles.Seman at NOAA.GOV
Mon Feb 22 16:28:36 EST 2010


Ivan,

http://en.wikipedia.org/wiki/Law_of_cosines#Vector_formulation
...try the vector formulation for two wind vectors

Hope this helps,
Chuck

Ivan Toman wrote:
> Dear GrADS users,
>
> I need some help with scripting. I have to calculate change in wind
> direction in degrees between two different times. I do this this way:
>
> 'define hwd0 = 57.3*atan2(ugrd10m(t='i'),vgrd10m(t='j'))'
> 'define hwd1 = 57.3*atan2(ugrd10m(t='j'),vgrd10m(t='j'))'
> 'define hwdc = hwd0-hwd1'
>
> where hwd0 is present wind direction, and hwd1 is wind direction in past time.
>
> The problem arises when there is, for example, hwd0=10deg, hwd1=350deg, the
> result of this equation is of course -340 degrees. This is not good, because
> I have to get something like +20 degrees as result (by words: wind changed
> direction for 20 degrees to the right).
>
> In fact, when wind is backing result should be negative value (from 0 to
> -180), and when wind is veering the result must be positive value (from 0 to
> 180), and never < -180 or > 180 degrees.
>
> I hope you got the point? Can somebody help me please here? I feel this is a
> trivial problem but I'm stuck unfortunately. Thanks a lot.
>   

-- 

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
 Charles Seman                                Charles.Seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not necessarily
reflect any position of the Government or NOAA."



More information about the gradsusr mailing list