Re: how to keep the time dimension?

From: Dennis Shea (shea AT XXXXXX)
Date: Wed Aug 15 2001 - 13:43:46 MDT


> I try to get the monthly mean by average the daily data. When I use p0
=dim_sum(p(lat|:,lon|:,time|:)), then p0 become two dimension p0(lat,lon). I
hope to get three dimensions output p0(lat,lon,time), where dimsize(time)=1,
because I need to concatenate all the monthly data into a large file. Has anyone
know how to solve my problems? Thanks a lot

    dimp = dimsizes(p) ; I am assuming that p(time,lat,lon)
    nlat = dimp(1)
    mlon = dimp(2)
    
    p0 = new (/nlat,mlon,1/) , typeof(p) )
    p0(:,:,0) = dim_sum(p(lat|:,lon|:,time|:))
    p0!0 = "lat" ; create dimension names
    p0!1 = "lon"
    p0!2 = "time"
    
Remember that "concatenation" whether it is the netCDF operators (NCO)
or NCL will work only on the "record" dimension (ie, the
slowewst varying [left-most] dimension. Thus u will have to reorder

    P0 = p0(time|:,lat|:,lon|:)
    
Further if u r using the NCO then the record dimension must be
"unlimited." NCL will concatenate a record dimension
if it is "unlimited" or not.

    



This archive was generated by hypermail 2b29 : Wed Aug 15 2001 - 13:51:20 MDT