Stefan,<div>Use the maskout and const functions to define each term. For example, for the total totals term,</div><div><br></div><div>'define ttterm = const(maskout(20*(TT-49),TT-49),0)'</div><div><br></div><div>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).</div>
<div><br></div><div>Jeff Duda<br><br><div class="gmail_quote">On Sun, Jul 8, 2012 at 11:37 AM, Stefan Gofferje <span dir="ltr"><<a href="mailto:stefan@saakeskus.fi" target="_blank">stefan@saakeskus.fi</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm just working on plotting a few new indices and I am wondering if and<br>
how the conditional handling of terms is possible in grads somehow.<br>
<br>
E.g.: SWEAT index...<br>
<br>
The definition says<br>
SWEAT= 12(850Td) + 20(TT - 49) + 2(V850) + (V500) + 125(sin(dd500 -<br>
dd850) + 0.2)<br>
<br>
*If TT less than 49, then that term of the equation is set to zero<br>
*If any term is negative then that term is set to zero<br>
*Winds must be veering with height or that term is set to zero<br>
<br>
How would I do something like this. The only thing I could think of<br>
would be, going through the grid with two while loops, calculating the<br>
values with a couple of "if" clauses, then output them to a new grid and<br>
plot this new grid. But that seems a bit overkill, doesn't it? :)<br>
<br>
-Stefan<br>
<br>
--<br>
Suomen Sääkeskus - Hyvä sää on makuasia<br>
<br>
Stefan Gofferje<br>
Haukantie 2 B 5<br>
FIN-37600 Valkeakoski<br>
GSM: +358 (41) 7290730<br>
<br>
<a href="http://www.saakeskus.fi/" target="_blank">http://www.saakeskus.fi/</a><br>
<a href="mailto:stefan@saakeskus.fi">stefan@saakeskus.fi</a><br>
<br>
<br>
--------------------------------------------------------------------------------<br>
This mail was scanned for malware by ClamAV (<a href="http://www.clamav.net/" target="_blank">http://www.clamav.net/</a>)<br>
--------------------------------------------------------------------------------<br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Jeff Duda<br>Graduate research assistant<br>University of Oklahoma School of Meteorology<br>Center for Analysis and Prediction of Storms<br><br>
</div>