[ncl-talk] Writing output files

Ipsita Putatunda ipsita.putatunda at gmail.com
Sun Nov 23 07:39:25 MST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141123/1626fb34/attachment.html 


More information about the ncl-talk mailing list