[ncl-talk] Writing output files
Ipsita Putatunda
ipsita.putatunda at gmail.com
Mon Nov 24 03:58:44 MST 2014
Thanks it is working.
Ipsita
On Sun, Nov 23, 2014 at 10:32 PM, Gustavo Correa <gus at ldeo.columbia.edu>
wrote:
> Hi Ipsita
>
> Maybe this?
>
> path="/dummy/file."+sprinti("%0.2i",nf)+".grd" ; <= "%0.2i" formats nf
> w/ 2 digits: 01,02,...,10...
>
> See:
> http://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml
>
> I hope this helps,
> Gus Correa
>
> On Nov 23, 2014, at 9:39 AM, Ipsita Putatunda wrote:
>
> > Potentially dangerous attachments were identified and removed from this
> > message.
> >
> > Hi NCL users,
> > I need a help on writing output files inside a loop...That may be easy
> > but not working for me, any help will be appreciated.
> >
> > First am reading the files inside a loop and doing the needed
> operations. I
> > want to write output files according to the each opened file which am
> > reading inside loop. I want an incremental loop in the name of the output
> > files...like file.21.grd, file.22.grd, file.23.grd...etc upto nfil-1.
> >
> > ;*****************************************************************
> >
> > diri = "./"
> >
> > fili = systemfunc("cd "+diri+" ; ls *.nc")
> > nfil = dimsizes( fili )
> > print("nfil="+nfil)
> >
> > ;*****************************************************************
> > ; Loop over the files
> > ;*****************************************************************
> > tStrt = systemfunc("date") ; time the loop (wall clock)
> >
> > do nf=0,nfil-1
> > print(nf+" "+fili(nf))
> > f = addfile(diri+fili(nf), "r") <===reading data for each file
> >
> > ........Doing rest of the operations.....
> >
> > *path="/dummy/file.21.grd" <==here I want the file name **increment*
> >
> > fbindirwrite(path,z) <=======output files
> >
> > end do
> >
> >
> > Thanks,
> >
> > Ipsita
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141124/e02371cc/attachment.html
More information about the ncl-talk
mailing list