[gradsusr] Conditional handling of terms

Jeff Duda jeffduda319 at gmail.com
Sun Jul 8 14:33:16 EDT 2012


Stefan,
Use the maskout and const functions to define each term.  For example, for
the total totals term,

'define ttterm = const(maskout(20*(TT-49),TT-49),0)'

The above first uses the maskout function to define the one term, but any
grid point where TT < 49 is set to "missing" or "undef".  The const
function then takes that grid and replaces all "missing" or "undef" values
with 0, thus giving you that term as needed.  You can follow the same idea
for the other terms.  Look at the instructions for the maskout and const
functions on the Grads documentation - index page if you get confused as to
how to use them.  Accounting for the veering winds is simple.  Just define
a wind direction somehow (for the SWEAT index, it doesn't even matter which
specific angle corresponds to north, e.g., since all that term is looking
for is a difference), then use the const and maskout functions using the
mask definition of dd500 > dd850 (assuming you define angles to increase
for veering winds).

Jeff Duda

On Sun, Jul 8, 2012 at 11:37 AM, Stefan Gofferje <stefan at saakeskus.fi>wrote:

> Hi,
>
> I'm just working on plotting a few new indices and I am wondering if and
> how the conditional handling of terms is possible in grads somehow.
>
> E.g.: SWEAT index...
>
> The definition says
> SWEAT= 12(850Td) + 20(TT - 49) + 2(V850) + (V500) + 125(sin(dd500 -
> dd850) + 0.2)
>
> *If TT less than 49, then that term of the equation is set to zero
> *If any term is negative then that term is set to zero
> *Winds must be veering with height or that term is set to zero
>
> How would I do something like this. The only thing I could think of
> would be, going through the grid with two while loops, calculating the
> values with a couple of "if" clauses, then output them to a new grid and
> plot this new grid. But that seems a bit overkill, doesn't it? :)
>
> -Stefan
>
> --
> Suomen Sääkeskus - Hyvä sää on makuasia
>
> Stefan Gofferje
> Haukantie 2 B 5
> FIN-37600 Valkeakoski
> GSM:       +358 (41) 7290730
>
> http://www.saakeskus.fi/
> stefan at saakeskus.fi
>
>
>
> --------------------------------------------------------------------------------
> This mail was scanned for malware by ClamAV (http://www.clamav.net/)
>
> --------------------------------------------------------------------------------
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>



-- 
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120708/c7c6590f/attachment-0003.html 


More information about the gradsusr mailing list