<div dir="ltr">Hi NCL users,<div> 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.</div><div></div><div><br></div><div>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.</div><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">;*****************************************************************</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"> <span style="font-family:arial">diri = "./"</span></pre></div><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"> 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</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"> ........Doing rest of the operations.....</pre><pre style="word-wrap:break-word"><u style="color:rgb(0,0,0);white-space:pre-wrap">path="/dummy/file.21.grd" <==here I want the file name </u><font color="#000000"><span style="white-space:pre-wrap"><u>increment</u></span></font></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">fbindirwrite(path,z) <=======output files</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">end do</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><br></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">Thanks,</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">Ipsita</pre></div></div>