I can think of two possible errors:<br>1) Your control file doesn&#39;t properly open the .dat files<br>2) When a variable is defined within Grads, sometimes the output from displaying that variable occurs on only one line, so trying to grab data from the second line of output would give you nothing.  Try putting in a print statement there to see if that is happening.<br>
<br>Jeff Duda<br><br><div class="gmail_quote">On Wed, Aug 10, 2011 at 4:01 PM, Krishna Santhanam <span dir="ltr">&lt;<a href="mailto:KSanthanam@everpower.com">KSanthanam@everpower.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I am trying to fetch average monthly values for the following.<br>
<br>
I have a ctl file which opens about 8496 files (.dat grads file every 10 minutes for 2 months)  the data set is defined as<br>
<br>
dset ^fname_%y4-%m2-%d2_%h2_%n2.dat<br>
<br>
I have a grads script with the following<br>
<br>
function main()<br>
&#39;open fname.ctl&#39;<br>
cntx=32<br>
while(cntx&lt;=121)<br>
 cnty=17<br>
while(cnty&lt;=110)<br>
&#39;set x &#39;cntx<br>
&#39;set y &#39;cnty<br>
&#39;define wind=sqrt(umet*umet+vmet*vmet)&#39;<br>
&#39;define mwind=ave(wind,t=1,t=4460)&#39;<br>
&#39;d mwind&#39;<br>
dum1=sublin(result,2)<br>
lrn=subwrd(dum1,4)<br>
w=write(tmp1.dat,lrn)<br>
cnty=cnty+1<br>
endwhile<br>
cntx=cntx+1<br>
endwhile<br>
<br>
I have a file written with nothing in that, could someone tell me what is wrong?<br>
<br>
Thanks,<br>
Krishna<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>Jeff Duda<br>Iowa State University<br>Meteorology Graduate Student<br>3134 Agronomy Hall<br><a href="http://www.meteor.iastate.edu/~jdduda">www.meteor.iastate.edu/~jdduda</a><br>