<br><font size=2 face="sans-serif">John,</font><br><font size=2 face="sans-serif">The if statement you quoted--the one
that Jennifer suggested--is valid, as is the nested method that Pablo suggested.
However, your unexpected results appear to indicate the "if..else"
conditions (in particular are not changing during the second time loop
iteration. Since your variable 'aa' would be the same at each timestep,
then I suppose 'iwc' may be the culprit. Have you tried echo-displaying
the conditional results at each timestep to confirm their values?</font><br><font size=2 face="sans-serif">Stephen Mc</font><br><br><br><table width=100%><tr valign=top><td width=40%><font size=1 face="sans-serif"><b>John Guhin <johnguhin@GMAIL.COM></b></font><br><font size=1 face="sans-serif">Sent by: GRADSUSR@LIST.CINECA.IT</font><p><font size=1 face="sans-serif">03/11/2009 08:03 PM</font><table border><tr valign=top><td bgcolor=white><div align=center><font size=1 face="sans-serif">Please respond to<br>GRADSUSR@LIST.CINECA.IT</font></div></table><br><td width=59%><table width=100%><tr valign=top><td><div align=right><font size=1 face="sans-serif">To</font></div><td><font size=1 face="sans-serif">GRADSUSR@LIST.CINECA.IT</font><tr valign=top><td><div align=right><font size=1 face="sans-serif">cc</font></div><td><tr valign=top><td><div align=right><font size=1 face="sans-serif">Subject</font></div><td><font size=1 face="sans-serif">Re: if statement in grads</font></table><br><table><tr valign=top><td><td></table><br></table><br><br><br><font size=3>Thanks Stephen. </font><br><font size=3> I simplified the script by considering only one
time (t). The problem is indeed if statement.</font><br><font size=3>It seems if statement like this if (rainlow <=aa
& aa<rainhigh)</font><br><font size=3>does not work in grads. Is it true? or there is another
way to solve my problem?</font><br><br><font size=3>thanks in advance.</font><br><br><br><font size=3>On Wed, Mar 11, 2009 at 5:07 PM, Stephen R McMillan <</font><a href=mailto:smcmillan@planalytics.com><font size=3 color=blue><u>smcmillan@planalytics.com</u></font></a><font size=3>>wrote:</font><br><font size=2>John,</font><br><font 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 size=2>Stephen Mc</font><br><br><br><table width=100%><tr valign=top><td width=40%><font size=1><b>John Guhin <</b></font><a href=mailto:johnguhin@GMAIL.COM><font size=1 color=blue><b><u>johnguhin@GMAIL.COM</u></b></font></a><font size=1><b>></b></font><br><font size=1>Sent by: </font><a href=mailto:GRADSUSR@LIST.CINECA.IT><font size=1 color=blue><u>GRADSUSR@LIST.CINECA.IT</u></font></a><br><br><font size=1>03/11/2009 03:48 PM</font><br><table border width=100%><tr valign=top><td width=100% bgcolor=white><div align=center><font size=1>Please respond to</font><br><a href=mailto:GRADSUSR@LIST.CINECA.IT><font size=1 color=blue><u>GRADSUSR@LIST.CINECA.IT</u></font></a></div></table><br><br><td width=59%><table width=100%><tr valign=top><td width=38%><div align=right><font size=1>To</font></div><td width=61%><a href=mailto:GRADSUSR@LIST.CINECA.IT><font size=1 color=blue><u>GRADSUSR@LIST.CINECA.IT</u></font></a><tr valign=top><td><div align=right><font size=1>cc</font></div><td><tr valign=top><td><div align=right><font size=1>Subject</font></div><td><font size=1>Re: if statement in grads</font></table><br><table width=100%><tr valign=top><td width=50%><td width=50%></table><br><br></table><br><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><font size=3 color=blue><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 size=3 color=#8f8f8f>--</font><br><font size=3 color=#8f8f8f>Jennifer M. Adams</font><br><font size=3 color=#8f8f8f>IGES/COLA</font><br><font size=3 color=#8f8f8f>4041 Powder Mill Road, Suite 302</font><br><font size=3 color=#8f8f8f>Calverton, MD 20705</font><br><a href=mailto:jma@cola.iges.org><font size=3 color=blue><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><font size=3>***************************************************</font><br><font size=3>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.</font><br><font size=3>***************************************************</font><br><br><br><br><font size=3>-- </font><br><font size=3>John Guhin</font><br><br><BR>
<BR>
***************************************************<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>