Re: help me check this code,Please

From: Andrew Mai <mai_at_nyahnyahspammersnyahnyah>
Date: Fri May 03 2013 - 07:54:52 MDT
Try this:

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/wrf/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"


begin
;read in data 
ncols = 3
nrows = 768
  y = new((/31,3/),float)  
  f = asciiread("110000", (/nrows,ncols/), "float")
  g = transpose(f)
        
     s = 0   
     do j = 0,724,24
             y(s,0) = dim_avg(g(0,j+4:j+27))*1000
             y(s,1) = dim_avg(g(1,j+4:j+27))*1000
             y(s,2) = dim_avg(g(2,j+4:j+27))
        
        s = s+1 

      end do  
        xopt = True
        xopt@fout = "test.txt"
        write_matrix(y,"3f15.5",xopt)

end

dim_avg averages over the right-most dimension. And your statement "s = 0" needs to be outside the do loop.

Andy

  


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 3 07:54:59 2013

This archive was generated by hypermail 2.1.8 : Tue May 07 2013 - 08:38:33 MDT