<div dir="ltr">Hi Matt,<div><br></div><div>In addition to Bernd's suggestion, also check out the "if" function, which should have come with your opengrads package as part of the following extension function set:</div><div><br></div><div><a href="http://opengrads.org/doc/udxt/libbjt/">http://opengrads.org/doc/udxt/libbjt/</a><br></div><div><br></div><div>The "if" function syntax:</div><div><h2><a name="if_expr1_op_expr2_true_expr_false_expr_"><strong>if</strong>(<em>EXPR1,OP,EXPR2,TRUE_EXPR,FALSE_EXPR</em>)</a></h2>
<p>This function compares <em>EXPR1</em> and <em>EXPR2</em>, where 5 arguments are
expected. if their relation is true, <em>TRUE_EXP</em> is returned, otherwise
expression <em>FALSE_EXPR</em> is returned.</p>
<dl>
<dt><strong><a name="item_op"><em>OP</em></a></strong>
</dt><dd>
<p>One of the following: ==, =, >, <, >=, <=, !=</p>
</dd>
<dt><strong><a name="item_expr2_2c_true_expr_2c_false_expr"><em>EXPR2, TRUE_EXPR, FALSE_EXPR</em></a></strong>
</dt><dd>
<p>These can be a expression, constant or -u.</p>
</dd><dd><p><br></p></dd><dd><p>I have found this function to be very useful and much easier to handle than using maskout and const, although there are probably cases where the latter is more appropriate or advisable.<br></p></dd><dd><p>Stephen McMillan</p></dd></dl></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 22, 2016 at 9:24 AM, Baker, Matt (Quebec - Atlantic) <span dir="ltr"><<a href="mailto:matt.baker@amecfw.com" target="_blank">matt.baker@amecfw.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-CA" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have a question regarding Open GrADS.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m trying to use <i>if statements</i> for scalar model data (eg. GFS and NAM) over a grid and I’m wondering if it’s possible to do this. As an example, I’m using if statements for these parameters: surface based CAPE, LI, and 500 mb relative
humidity to create an index to plot on a map. So far GrADS isn’t showing that this is working, however, I can plot the model data individually so I don’t think it’s a case of missing data.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Here’s some of the code for the NAM model. Note that I define the variable NAMHail to equal 0 at the start of the function.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> if (modelNumberNAM>0)<u></u><u></u></p>
<p class="MsoNormal"> set_maps(_map,_hasNegativeNAM)<u></u><u></u></p>
<p class="MsoNormal"> 'set grads off'<u></u><u></u></p>
<p class="MsoNormal"> 'set grid off'<u></u><u></u></p>
<p class="MsoNormal"> 'set gxout contour'<u></u><u></u></p>
<p class="MsoNormal"> 'set ccolor 0'<u></u><u></u></p>
<p class="MsoNormal"> 'set clopts -1 1 0.15'<u></u><u></u></p>
<p class="MsoNormal"> 'set cint 1'<u></u><u></u></p>
<p class="MsoNormal"> 'set cthick 6'<u></u><u></u></p>
<p class="MsoNormal"> 'set clab on'<u></u><u></u></p>
<p class="MsoNormal"> 'set csmooth on'<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> 'NAMcape = CAPEsfc.'modelNumberNAM<u></u><u></u></p>
<p class="MsoNormal"> if (NAMcape > 1500 & NAMcape < 2200)<u></u><u></u></p>
<p class="MsoNormal"> 'NAMHail = NAMHail + 1'<u></u><u></u></p>
<p class="MsoNormal"> endif<u></u><u></u></p>
<p class="MsoNormal"> if (NAMcape > 2199 & NAMcape < 3100)<u></u><u></u></p>
<p class="MsoNormal"> 'NAMHail = NAMHail + 2'<u></u><u></u></p>
<p class="MsoNormal"> endif<u></u><u></u></p>
<p class="MsoNormal"> if (NAMcape > 3099)<u></u><u></u></p>
<p class="MsoNormal"> 'NAMHail = NAMHail + 3'<u></u><u></u></p>
<p class="MsoNormal"> endif<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> 'set lev 500'<u></u><u></u></p>
<p class="MsoNormal"> 'NAMrh500=RHprs.'modelNumberNAM<u></u><u></u></p>
<p class="MsoNormal"> if (NAMrh500 < 35)<u></u><u></u></p>
<p class="MsoNormal"> 'NAMHail = NAMHail + 3'<u></u><u></u></p>
<p class="MsoNormal"> endif<u></u><u></u></p>
<p class="MsoNormal"> if (NAMrh500 > 35 & NAMrh500 < 44)<u></u><u></u></p>
<p class="MsoNormal"> 'NAMHail = NAMHail + 1'<u></u><u></u></p>
<p class="MsoNormal"> endif<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> endif<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> 'set gxout contour'<u></u><u></u></p>
<p class="MsoNormal"> 'set ccolor 0'<u></u><u></u></p>
<p class="MsoNormal"> 'set clopts -1 1 0.15'<u></u><u></u></p>
<p class="MsoNormal"> 'set cint 200'<u></u><u></u></p>
<p class="MsoNormal"> 'set cthick 6'<u></u><u></u></p>
<p class="MsoNormal"> 'set clab on'<u></u><u></u></p>
<p class="MsoNormal"> 'set csmooth on'<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> 'd NAMcape'<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks!<u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><u></u> <u></u></p>
<p class="MsoNormal" style="text-autospace:none"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#5f2167">Matt Baker</span></b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#5f2167"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#5f2167">Meteorologist, Met-Ocean Services, Amec Foster Wheeler Environment & Infrastructure
</span><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#5f2167"><u></u><u></u></span></b></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#5f2167">133 Crosbie Road, PO Box 13216, St. John’s, NL A1B 4A5, Canada</span><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#5f2167"><u></u><u></u></span></b></p>
<p class="MsoNormal" style="text-autospace:none"><u><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#5d2167"><a href="mailto:matt.baker@amecfw.com" target="_blank"><span style="color:blue">matt.baker@amecfw.com</span></a></span></u><u><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#5f2167"></span></u><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#5f2167">
<a href="http://amecfw.com" target="_blank">amecfw.com</a></span><span style="font-family:"Arial",sans-serif;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#5f2167">ISO 9001:2008 Quality Management System (St. John's)</span><span style="font-size:8.0pt;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td><img border="0" src="cid:116062214244800353@uk-mta-60.uk.mimecast.lan"></td></tr></tbody></table> <br>
<span style="font-family:Arial;Font-size:9.0pt;color:#5f2167">This message is the property of Amec Foster Wheeler plc and/or its subsidiaries and/or
affiliates and is intended only for the named recipient(s). Its contents (including any attachments) may be confidential, legally privileged or otherwise
protected from disclosure by law. Unauthorised use, copying, distribution or disclosure of any of it may be unlawful and is strictly prohibited. We assume
no responsibility to persons other than the intended named recipient(s) and do not accept liability for any errors or omissions which are a result of email
transmission. If you have received this message in error, please notify us immediately by reply email to the sender and confirm that the original message and
any attachments and copies have been destroyed and deleted from your system. This disclaimer applies to any and all messages originating from us and set out
above. If you do not wish to receive future unsolicited commercial electronic messages from us, <b>please forward this email to: unsubscribe<img alt="" border="0" height="0" style="font-size:0px;line-height:0px" width="0">@<img alt="" border="0" height="0" style="font-size:0px;line-height:0px" width="0">amecfw.<img alt="" border="0" height="0" style="font-size:0px;line-height:0px" width="0">com and include
“Unsubscribe” in the subject line</b>. If applicable, you will continue to receive invoices, project communications and similar factual, non-commercial electronic
communications.<br>
<br>
Please click <a href="http://amecfw.com/email-disclaimer" target="_blank">http://amecfw.com/email-disclaimer</a> for notices and
company information in relation to emails originating in the UK, Italy or France.<br>
</span>
</div>
<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" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br></div>