The following is more general. It is untested:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
   f     = addfile("prec_1948-1948.nc","r")
   P     = f->data
   dimP  = dimsizes(P)
   ntim  = dimP(0)                                 ; # of records
   nsam  = 8                                       ; # of samples per day
   nday  = ntim/nsam
   nlat  = dimP(1)
   mlon  = dimP(2)
   Pday  = new((/nday,nlat,mlon/),typeof(P))  ; array for daily values
   do nt=0,ntim-1,nsam
      Pday(nt/nsam,:,:) = dim_sum_n(P(nt:nt+nsam-1,:,:),0)
   end do
   copy_VarCoords(P(0,:,:), Pday(0,:,:))          ; contributed.ncl
   Pday!0 = P!0
   Pday&$Pday!0$  = P&$P!0$(::nsam)
   Pday@long_name = "daily total precipitation"
   Pday@units     = P@units
   printVarSummary(Pday)
On 5/29/12 3:06 PM, Noel Aloysius wrote:
>
> f      = addfile("prec_1948-1948.nc <http://prec_1948-1948.nc>","r")
> P    = f->data
> nt    = 2928                                    ; no. of records (leap year)
> j=-1
> Pday = new((/366,180,360/),"float")   ; array for daily values in leap year
>
> do i=7,nt,8
>     j = j+1
>     x = P(i-7:i,:,:)
>     Pday(j,:,:) = dim_sum_n_Wrap(x,0)
> end do
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 30 17:23:31 2012
This archive was generated by hypermail 2.1.8 : Wed Jun 06 2012 - 15:17:44 MDT