Jim,<br> Thank you very much. I clearly missed the obvious. <br>-Jim<br><br><div class="gmail_quote">On Thu, Apr 15, 2010 at 10:23 PM, James T. Potemra <span dir="ltr"><<a href="mailto:jimp@hawaii.edu">jimp@hawaii.edu</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;">Hey Jim:<br>
<br>
I think you need to reset i = 1 inside the p loop. As it is, p = 0,<br>
then i goes from 1 to 25, p increments to 1 but i will be 25. In oder<br>
words, put the line "i = 1" after the line "while(p<=1332)".<br>
<br>
Jim<br>
<div><div></div><div class="h5"><br>
<a href="mailto:jimbo32886@gmail.com">jimbo32886@gmail.com</a> wrote:<br>
> Hello Everyone,<br>
> I am running into a very trivial problem that I just can not figure<br>
> out. I am attempting to write some anomalous data out in Grads<br>
> format, however my nested loop is not functioning properly. The<br>
> second while-loop works just fine, but the "time" step while-loop is<br>
> not functioning at all. Essentially after I run the script it goes<br>
> through the first time and the first 24 levels and then stops. I do<br>
> not understand why the first loop is not functioning correctly. Any<br>
> help would be greatly appreciated. I have a feeling I am making a<br>
> stupid mistake, but I just can't find it. I'm running grads v1.9 on<br>
> Linux. The script works just fine with the exception of the first<br>
> while-loop.<br>
> Thanks,<br>
> Jim<br>
><br>
> *This is my script*<br>
><br>
> 'open template.ctl'<br>
> 'open salt.ctl'<br>
> 'set lat 60 90'<br>
> 'set lon 0 360'<br>
> 'open arctic1900_2009.ctl'<br>
> 'set fwrite saltanom.dat'<br>
> 'set gxout fwrite'<br>
> i = 1<br>
> p = 0<br>
> while(p<=1332) *<---------this loop is not functioning properly<br>
> while(i<=24)<br>
> 'set z 'i''<br>
> 'set t 1 12'<br>
> 'tempseasonal = ave(salt.2,t+0,t+0)'<br>
> 'set t 1 1332'<br>
> 'modify tempseasonal seasonal'<br>
> 'set t 'p''<br>
> 'anom=oacres(salt.1,salt.3-gr2stn(tempseasonal,salt.3),5,4,3,2,1)'<br>
> 'd anom'<br>
> 'undefine anom'<br>
> i = i + 1<br>
> endwhile<br>
> p=p+1<br>
> endwhile<br>
> 'disable fwrite'<br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
><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" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
><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" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br><br clear="all"><br><br>