[gradsusr] error in writing ascii data

Jackie Yip zheng.yip at mcgill.ca
Thu Aug 4 12:31:13 EDT 2011


Hi Mahesh,

I just moved your open file loopend to the end of the script. Give it a try.


Jackie

'reinit'
'clear'

year_st=1951
year_end=1953
yidx=year_st
while(yidx<=year_end)
'open /home/mahesh/data/ncep/ctl/precip_'yidx'.ctl'

tt=1
yrid=1951
fst=1
fend=3
fnum=fst
while(fnum<=fend)
 while(tt<=30)
     'set t 'tt
     'define arn=aave(precip.'fnum',lon=0,lon=40,lat=25,lat=55)'
    'd arn'
    lrn=subwrd(result,4)
    w=write(pnew.dat,lrn)
   tt=tt+1
 endwhile
 fnum=fnum+1
 yrid=yrid+1
'!mv pnew.dat pdata_'yrid'.dat'
endwhile

yidx=yidx+1
endwhile

On 4 August 2011 03:14, Mahesh Shinde <mashinde05 at gmail.com> wrote:

> Dear Grads users,
>
> I am trying to write ascii data from ctl files. I need output data files
> like pdata_1951, pdata_1952 and so on.
> It works for first year. but not for the rest of the years . It gives
> following error msg.
>
> No hardcopy metafile open
> All files closed; all defined objects released;
> All GrADS attributes have been reinitialized
> mv: cannot stat `pnew.dat': No such file or directory
> mv: cannot stat `pnew.dat': No such file or directory
>
>
> Here i am pasting my script.
>
>
> --------------------------------------------------------------------------------------------
> 'reinit'
> 'clear'
>
> year_st=1951
> year_end=1953
> yidx=year_st
> while(yidx<=year_end)
> 'open /home/mahesh/data/ncep/ctl/precip_'yidx'.ctl'
> yidx=yidx+1
> endwhile
>
> tt=1
> yrid=1951
> fst=1
> fend=3
> fnum=fst
> while(fnum<=fend)
>  while(tt<=30)
>      'set t 'tt
>      'define arn=aave(precip.'fnum',lon=0,lon=40,lat=25,lat=55)'
>     'd arn'
>     lrn=subwrd(result,4)
>     w=write(pnew.dat,lrn)
>    tt=tt+1
>  endwhile
>  fnum=fnum+1
>  yrid=yrid+1
> '!mv pnew.dat pdata_'yrid'.dat'
> endwhile
>
> --------------------------------------------------------------------------------------------------------
>
> so please tell me where it goes wrong.
>
> thanking you
>
> regards
> Mahesh
>
>
> --
>
> ----------------------------------------------------------------------------------------------------------------------
> (Permanent Affiliaiton)
> Mr. Mahesh Shinde
> Climate and Global Modeling Division,
> Indian Institute of Tropical Meteorology,
> NCL POST, Dr. Homi Bhabha Road,
> Pashan, Pune-411008, INDIA
> email: samurai at tropmet.res.in
> cell: +91-9822050959
> skype : mshinde2k9
>
> ----------------------------------------------------------------------------------------------------------------------
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110804/2dd3057c/attachment-0003.html 


More information about the gradsusr mailing list