Hi Mahesh, <br><br>I just moved your open file loopend to the end of the script. Give it a try. <br><br>Jackie<br><br>'reinit'<br>'clear'<br><br>year_st=1951<br>year_end=1953<br>yidx=year_st<br>
while(yidx<=year_end)<br>'open /home/mahesh/data/ncep/ctl/precip_'yidx'.ctl' <br><div id=":xr"><br>tt=1 <br>yrid=1951<br>fst=1<br>fend=3<br>fnum=fst<br>while(fnum<=fend)<br> while(tt<=30) <br>
'set t 'tt <br> 'define arn=aave(precip.'fnum',lon=0,lon=40,lat=25,lat=55)' <br> 'd arn' <br> lrn=subwrd(result,4) <br> w=write(pnew.dat,lrn) <br>
tt=tt+1 <br> endwhile<br> fnum=fnum+1<br> yrid=yrid+1<br>'!mv pnew.dat pdata_'yrid'.dat' <br>endwhile</div><br>yidx=yidx+1 <br>endwhile<br><br><div class="gmail_quote">On 4 August 2011 03:14, Mahesh Shinde <span dir="ltr"><<a href="mailto:mashinde05@gmail.com">mashinde05@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear Grads users,<br><br>I am trying to write ascii data from ctl files. I need output data files like pdata_1951, pdata_1952 and so on.<br>
It works for first year. but not for the rest of the years . It gives following error msg.<br>
<br>No hardcopy metafile open<br>All files closed; all defined objects released;<br>All GrADS attributes have been reinitialized<br>mv: cannot stat `pnew.dat': No such file or directory<br>mv: cannot stat `pnew.dat': No such file or directory<br>
<br><br>Here i am pasting my script. <br><br>--------------------------------------------------------------------------------------------<br>'reinit'<br>'clear'<br><br>year_st=1951<br>year_end=1953<br>yidx=year_st<br>
while(yidx<=year_end)<br>'open /home/mahesh/data/ncep/ctl/precip_'yidx'.ctl'<br>yidx=yidx+1 <br>endwhile <br><br>tt=1 <br>yrid=1951<br>fst=1<br>fend=3<br>fnum=fst<br>while(fnum<=fend)<br> while(tt<=30) <br>
'set t 'tt <br> 'define arn=aave(precip.'fnum',lon=0,lon=40,lat=25,lat=55)' <br> 'd arn' <br> lrn=subwrd(result,4) <br> w=write(pnew.dat,lrn) <br>
tt=tt+1 <br> endwhile<br> fnum=fnum+1<br> yrid=yrid+1<br>'!mv pnew.dat pdata_'yrid'.dat' <br>endwhile<br clear="all">--------------------------------------------------------------------------------------------------------<br>
<br>so please tell me where it goes wrong.<br><br>thanking you<br><br>regards<br>Mahesh<br><br><br>-- <br><div>----------------------------------------------------------------------------------------------------------------------</div>
<div style="color:rgb(102, 102, 102)">(Permanent Affiliaiton)</div><span style="color:rgb(102, 102, 102)">Mr. Mahesh Shinde</span><div><font color="#666666"></font><span style="color:rgb(102, 102, 102)">Climate and Global Modeling Division,</span><br style="color:rgb(102, 102, 102)">
<span style="color:rgb(102, 102, 102)">Indian Institute of Tropical Meteorology,</span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">NCL POST, Dr. Homi Bhabha Road,</span><br style="color:rgb(102, 102, 102)">
<span style="color:rgb(102, 102, 102)">Pashan, Pune-411008, INDIA </span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">email: </span><a style="color:rgb(102, 102, 102)" href="mailto:samurai@tropmet.res.in" target="_blank">samurai@tropmet.res.in</a><br style="color:rgb(102, 102, 102)">
<span style="color:rgb(102, 102, 102)">cell: <a href="tel:%2B91-9822050959" value="+919822050959" target="_blank">+91-9822050959</a></span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">skype : mshinde2k9</span><br>
----------------------------------------------------------------------------------------------------------------------<br>
</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></blockquote></div><br>