[ncl-talk] Write table problem

snow snowflake_822 at yahoo.com
Wed Jun 15 19:04:48 MDT 2016


  To whom it may concern,
My below ncl code has aproblem in writting the table with 4 data in one column. It only writes the first data and doesnt continue to write the other data.
does anyone know how to fix this problem?
I appreciate your time and consideration. 
Best regards,
Snow Sho

this is the code:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
;----------------------------------------------------------------------
; WRF data translate NetCDF file to  ascii file  
;----------------------------------------------------------------------
    infile=("wrfout_d03_2007-07-24_00_00_00")
    fn=dimsizes(infile)    fin=addfile(infile,"r")
    R=fin->RAINNC(0,:,:)     a=(/189,193,191,192,192,193,192,188,198,196,192,187,197,194,190,187,197,196,195,195,196/)
     b=(/285,286,287,288,289,290,291,292,293,294,295,296,296,297,298,299,298,299,300,301,302/)     c=(/180,174,172,181,179,173,184,175,185,174,184,173,183,193,182,191,179,189,178,188,176/)
     d=(/264,266,267,267,268,269,270,270,271,271,272,273,273,273,274,273,275,274,276,275,277/)
     e=(/202,205,206,206,198,197,206,205,204,202,200,200,200,200,210,209,205,202,212,208,204,203/)
     f=(/270,271,272,273,274,276,277,278,279,280,281,282,283,284,284,284,285,286,287,288,289,290/)
     g=(/208,208,209,210,211,210,207,205,215,212,213,215,216,207,209,210,211,214,215,209,211,215,214/)
     h=(/263,264,265,266,267,267,268,269,269,270,271,273,274,276,277,278,279,279,280,282,283,284,287/)        R1=new((/21/),"float")        
        R2=new((/21/),"float")
        R3=new((/22/),"float")
        R4=new((/23/),"float")
        do k=0,20
        R1(k)=R(a(k),b(k))
        end do
     ;  print(R1)
        do k=0,20
        R2(k)=R(c(k),d(k))
        end do
        do k=0,21
        R3(k)=R(e(k),f(k))
        end do
        do k=0,22
        R4(k)=R(g(k),h(k))
        end do        R5=avg(R1(:))
        R6=avg(R2(:))
        R7=avg(R3(:))
        R8=avg(R4(:))
        ca=new((/1/),"float")
        ca=(/R5/)
        cb=new((/1/),"float")
        cb=(/R6/)
        cc=new((/1/),"float")
        cc=(/R7/)
        cd=new((/1/),"float")
        cd=(/R8/)
;   alist=[/R5,R6,R7,R8/]
   alist=[/ca,cb,cc,cd/]
  write_table("list.txt", "a", alist, "%5.5f")  end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160616/e2f78b35/attachment.html 


More information about the ncl-talk mailing list