<br>Thanks Stephen. <br> I simplified the script by considering only one time (t). The problem is indeed if statement.<br>It seems if statement like this <font size="3">if (rainlow <=aa & aa<rainhigh)</font><br>
does not work in grads. Is it true? or there is another way to solve my problem?<br><br>thanks in advance.<br><br><br><div class="gmail_quote">On Wed, Mar 11, 2009 at 5:07 PM, Stephen R McMillan <span dir="ltr"><<a href="mailto:smcmillan@planalytics.com">smcmillan@planalytics.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font face="sans-serif" size="2">John,</font><br><font face="sans-serif" size="2">Check the position of your "t1=1"
line. As it is, it would appear to repeat the 20 days once. Did
you intend to put "t1=1" before the outermost while loop?</font><br><font face="sans-serif" size="2">Stephen Mc</font><br><br><br><table width="100%"><tbody><tr valign="top"><td width="40%"><font face="sans-serif" size="1"><b>John Guhin <<a href="mailto:johnguhin@GMAIL.COM" target="_blank">johnguhin@GMAIL.COM</a>></b></font><br>
<font face="sans-serif" size="1">Sent by: <a href="mailto:GRADSUSR@LIST.CINECA.IT" target="_blank">GRADSUSR@LIST.CINECA.IT</a></font><p><font face="sans-serif" size="1">03/11/2009 03:48 PM</font></p><table border="1"><tbody><tr valign="top">
<td bgcolor="white"><div align="center"><font face="sans-serif" size="1">Please respond to<br><a href="mailto:GRADSUSR@LIST.CINECA.IT" target="_blank">GRADSUSR@LIST.CINECA.IT</a></font></div></td></tr></tbody></table><br>
</td><td width="59%"><table width="100%"><tbody><tr valign="top"><td><div align="right"><font face="sans-serif" size="1">To</font></div></td><td><font face="sans-serif" size="1"><a href="mailto:GRADSUSR@LIST.CINECA.IT" target="_blank">GRADSUSR@LIST.CINECA.IT</a></font></td>
</tr><tr valign="top"><td><div align="right"><font face="sans-serif" size="1">cc</font></div></td><td></td></tr><tr valign="top"><td><div align="right"><font face="sans-serif" size="1">Subject</font></div></td><td><font face="sans-serif" size="1">Re: if statement in grads</font></td>
</tr></tbody></table><br><table><tbody><tr valign="top"><td></td><td></td></tr></tbody></table><br></td></tr></tbody></table><div><div></div><div class="h5"><br><br><br><font size="3">Hi,</font><br><font size="3"> I tried with</font><br>
<font size="3"> if (rainlow <=aa & aa<rainhigh)</font><br><br><font size="3"> but didn't work. Am I mising something?</font><br><br><font size="3">thanks in advance.</font><br><br><br><font size="3">On Wed, Mar 11, 2009 at 1:28 PM, Jennifer Adams <</font><a href="mailto:jma@cola.iges.org" target="_blank"><font color="blue" size="3"><u>jma@cola.iges.org</u></font></a><font size="3">>wrote:</font><br>
<font size="3">Try changing your if statement to: </font><br><font size="3">if (rainlow <=aa & aa<rainhigh)</font><br><font size="3">--Jennifer</font><br><br><font size="3">On Mar 11, 2009, at 1:19 PM, John Guhin wrote:</font><br>
<br><br><font size="3">Hi,</font><br><font size="3"> I am trying to use if statement in
a grads script... which doesn't seem to work. I am </font><br><font size="3">attaching the gs file. iwc is a 3D variable, and
rain is 2D variable exactly in the same grids. I am trying to extract iwc
when rain is within certain range. The script executes without any error,
but the output repeats itself every 20 days. This means that the "
if" statement is not working!! Any help would be appreciated. </font><br><br><font size="3"> 'reinit'</font><br><font size="3">'c'</font><br><font size="3">'open iwc.ctl'</font><br><font size="3">'open /rain.ctl'</font><br>
<font size="3">'set gxout fwrite'</font><br><font size="3">'set fwrite iwc_ppt_binned.dat'</font><br><br><font size="3">lon1=40 ; lon2=180</font><br><font size="3">lat1=-20 ; lat2=20</font><br><font size="3">undef=-1e+34</font><br>
<font size="3">rainlow=0 ; rainhigh=5;</font><br><br><font size="3">while(rainhigh<11)</font><br><font size="3">t1=1</font><br><font size="3">while(t1<21)</font><br><font size="3">'set t 't1</font><br><font size="3">z1=1</font><br>
<font size="3">while(z1<19)</font><br><font size="3">'set z 'z1</font><br><font size="3">'define aa=24*rain.2(z=1)'</font><br><font size="3">if (rainlow <= aa < rainhigh)</font><br><font size="3">'d aave(iwc,lon='lon1',lon='lon2',lat='lat1',lat='lat2')'</font><br>
<font size="3">else</font><br><font size="3">'d aave(iwc*0+'undef',lon='lon1',lon='lon2',lat='lat1',lat='lat2')'</font><br><font size="3">endif</font><br><font size="3">z1=z1+1</font><br>
<font size="3">endwhile</font><br><font size="3">t1=t1+1</font><br><font size="3">endwhile</font><br><font size="3">rainlow=rainlow+5</font><br><font size="3">rainhigh=rainhigh+5</font><br><font size="3">endwhile</font><br>
<br><font size="3">'close 2'</font><br><font size="3">'close 1'</font><br><font size="3">'disable fwrite'</font><br><br><font size="3">-- </font><br><font size="3">John Guhin</font><br><font color="#8f8f8f" size="3">--</font><br>
<font color="#8f8f8f" size="3">Jennifer M. Adams</font><br><font color="#8f8f8f" size="3">IGES/COLA</font><br><font color="#8f8f8f" size="3">4041 Powder Mill Road, Suite 302</font><br><font color="#8f8f8f" size="3">Calverton, MD 20705</font><br>
<a href="mailto:jma@cola.iges.org" target="_blank"><font color="blue" size="3"><u>jma@cola.iges.org</u></font></a><br><br><br><br><br><br><br><br><font size="3">-- </font><br><font size="3">John Guhin</font><br><br><br>
<br></div></div>
***************************************************<br>
The information contained in this e-mail message is intended only for the use of the recipient(s) named above and may contain information that is privileged, confidential, and/or proprietary. If you are not the intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify the sender immediately by e-mail, and delete the original message.<br>
***************************************************<br></blockquote></div><br><br clear="all"><br>-- <br>John Guhin<br>