Wind Direction Change

Jeffrey Duda jdduda at IASTATE.EDU
Sun Feb 21 09:18:11 EST 2010


Ivan,
I've tried to do this in the past and have encountered the same problem.  I
have not yet found a solution to it.  You'd really need to do those
calculations in a few DO loops (in FORTRAN or something like it) using an IF
statement in the calculation.  Grads does not do that kind of thing
unfortunately.  You might be able to use the maskout function, however, but
that is just speculation.  Good luck.

Jeff Duda

On Sun, Feb 21, 2010 at 4:54 AM, Ivan Toman <ivtoman at inet.hr> 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.
>



-- 
Jeff Duda
Iowa State University
Meteorology Graduate Student
3134 Agronomy Hall
www.meteor.iastate.edu/~jdduda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100221/4f127290/attachment.html 


More information about the gradsusr mailing list