<div dir="ltr"><div>Thanks it is working.<br><br></div>Ipsita<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 23, 2014 at 10:32 PM, Gustavo Correa <span dir="ltr"><<a href="mailto:gus@ldeo.columbia.edu" target="_blank">gus@ldeo.columbia.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ipsita<br>
<br>
Maybe this?<br>
<br>
path="/dummy/file."+sprinti("%0.2i",nf)+".grd" ; <= "%0.2i" formats nf w/ 2 digits: 01,02,...,10...<br>
<br>
See:<br>
<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml</a><br>
<br>
I hope this helps,<br>
Gus Correa<br>
<br>
On Nov 23, 2014, at 9:39 AM, Ipsita Putatunda wrote:<br>
<br>
> Potentially dangerous attachments were identified and removed from this<br>
> message.<br>
<span class="">><br>
> Hi NCL users,<br>
> I need a help on writing output files inside a loop...That may be easy<br>
> but not working for me, any help will be appreciated.<br>
><br>
> First am reading the files inside a loop and doing the needed operations. I<br>
> want to write output files according to the each opened file which am<br>
> reading inside loop. I want an incremental loop in the name of the output<br>
> files...like file.21.grd, file.22.grd, file.23.grd...etc upto nfil-1.<br>
><br>
> ;*****************************************************************<br>
><br>
> diri = "./"<br>
><br>
> fili = systemfunc("cd "+diri+" ; ls *.nc")<br>
> nfil = dimsizes( fili )<br>
> print("nfil="+nfil)<br>
><br>
> ;*****************************************************************<br>
> ; Loop over the files<br>
> ;*****************************************************************<br>
> tStrt = systemfunc("date") ; time the loop (wall clock)<br>
><br>
> do nf=0,nfil-1<br>
> print(nf+" "+fili(nf))<br>
> f = addfile(diri+fili(nf), "r") <===reading data for each file<br>
><br>
> ........Doing rest of the operations.....<br>
><br>
</span>> *path="/dummy/file.21.grd" <==here I want the file name **increment*<br>
<span class="im HOEnZb">><br>
> fbindirwrite(path,z) <=======output files<br>
><br>
> end do<br>
><br>
><br>
> Thanks,<br>
><br>
> Ipsita<br>
</span><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> ncl-talk mailing list<br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></div>