<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Try &nbsp;changing your if statement to:&nbsp;</div><div>if (rainlow &lt;=aa &amp; aa&lt;rainhigh)</div><div><div>--Jennifer</div><div><br></div><div>On Mar 11, 2009, at 1:19 PM, John Guhin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>Hi,<br>&nbsp;&nbsp;&nbsp; I am trying to use if statement in a grads script... which doesn't seem to work. I am <br>attaching&nbsp; 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. <br> <br>&nbsp;'reinit'<br>'c'<br>'open iwc.ctl'<br>'open /rain.ctl'<br>'set gxout fwrite'<br>'set fwrite iwc_ppt_binned.dat'<br><br>lon1=40 ; lon2=180<br>lat1=-20 ; lat2=20<br>undef=-1e+34<br> rainlow=0 ; rainhigh=5;<br><br>while(rainhigh&lt;11)<br>t1=1<br>while(t1&lt;21)<br>'set t 't1<br>z1=1<br>while(z1&lt;19)<br>'set z 'z1<br>'define aa=24*rain.2(z=1)'<br>if (rainlow &lt;= aa &lt; rainhigh)</blockquote></div><div><blockquote type="cite"> 'd aave(iwc,lon='lon1',lon='lon2',lat='lat1',lat='lat2')'<br>else<br>'d aave(iwc*0+'undef',lon='lon1',lon='lon2',lat='lat1',lat='lat2')'<br> endif<br>z1=z1+1<br>endwhile<br>t1=t1+1<br>endwhile<br>rainlow=rainlow+5<br>rainhigh=rainhigh+5<br>endwhile<br><br>'close 2'<br>'close 1'<br>'disable fwrite'<br clear="all"><br>-- <br>John Guhin<br> </blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span></div></span> </div><br></body></html>