<br>Hi,<br> I am trying to use if statement in a grads script... which doesn't seem to work. I am <br>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. <br>
<br> '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<11)<br>t1=1<br>while(t1<21)<br>'set t 't1<br>z1=1<br>while(z1<19)<br>'set z 'z1<br>'define aa=24*rain.2(z=1)'<br>if (rainlow <= aa < rainhigh)<br>
'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>