[Thread Prev][Thread Next][Index]

Re: write cdf file using a list of selected indices



Hi all,
Last week Billy wrote with a question about selecting a set of profiles at some particular times.  Here's a quick couple of examples showing how COMPRESSL and COMPRESSL_BY work:

COMPRESSL compresses each level along the time axis.  So, it takes data in Z (across) and T (down) that looks like this
 JAN-1990 / 1:   ....   ....
 JAN-1991 / 2:  1.000  2.000
 JAN-1992 / 3:  3.000   ....
 DEC-1992 / 4:  4.000  5.000
 DEC-1993 / 5:  6.000   ....
 JAN-1995 / 6:   ....  7.000
 JAN-1996 / 7:   ....   ....
 DEC-1996 / 8:   ....  8.000

and turns it into this, losing track of which values occur at the same time.

 1   / 1:  1.000  2.000
 2   / 2:  3.000  5.000
 3   / 3:  4.000  7.000
 4   / 4:  6.000  8.000
 5   / 5:   ....   ....
 6   / 6:   ....   ....
 7   / 7:   ....   ....
 8   / 8:   ....   ....

Here's a short example of COMPRESSL_BY. First I'll create and list the values of a simple variable in Z and T.  Then we'll sample at a set of times,

yes?  ! create a 2-D variable in Z and T

yes? let var = {,,1,2,3,,4,5,6,,,7,,,,8}
yes? def axis/z=1:2:1/units=meters zax
yes? def axis/t=1-jan-1990:1-jan-1998:1/units=years tax
yes? let shapevar  = z[gz=zax] + t[gt=tax]
yes? let var2d = reshape(var, shapevar)

yes? list var2d
             VARIABLE : RESHAPE(VAR, SHAPEVAR)
             SUBSET   : 2 by 8 points (Z (METERS)-TIME)
                  1      2   
                  1      2
 JAN-1990 / 1:   ....   ....
 JAN-1991 / 2:  1.000  2.000
 JAN-1992 / 3:  3.000   ....
 DEC-1992 / 4:  4.000  5.000
 DEC-1993 / 5:  6.000   ....
 JAN-1995 / 6:   ....  7.000
 JAN-1996 / 7:   ....   ....
 DEC-1996 / 8:   ....  8.000

  ! Define a mask to choose the 3rd, 4th, and 8th element in L
  ! Notice how the result is on an abstract axis L= 1,2,3, ...
  ! with the first result at the first point we asked for
  ! (e.g. compressed in L)

yes? let tmask = tsequence({,,1,1,,,,1})

yes? list compressl_by(var2d, tmask)
             VARIABLE : COMPRESSL_BY(VAR2D, TMASK)
             SUBSET   : 2 by 8 points (Z (METERS)-T)
             1      2   
             1      2
 1   / 1:  3.000   ....
 2   / 2:  4.000  5.000
 3   / 3:   ....  8.000
 4   / 4:   ....   ....
 5   / 5:   ....   ....
 6   / 6:   ....   ....
 7   / 7:   ....   ....
 8   / 8:   ....   ....


In Billy's example, he would just use  COMPRESSL_BY (temp, ytrack) 
assuming that the variable ytrack is on a Z axis.



William S Kessler wrote:

    
I have a large cdf file consisting of a (z,t) temperature grid with
associated (time-index-only) grids of lats, lons and julian dates. I
have defined a subset of these, which are defined by a latitude flag
(ytrack) existing or not:

let tempsi = if ytrack then temp  ! only exists at selected ytrack
let lonsi = if ytrack then lon
let latsi = if ytrack then lat
let julsi = if ytrack then jul

I want to write just the selected ones to a new cdf file.
COMPRESSL works fine for the three 1-d variables, but not for the (z,t)
temperature grid, because the temperature profiles are not all of the
same depth range (as a result COMPRESSL pushes all of them to lower
indices at each depth and does not keep profiles intact). How can I SAVE
(ideally all in a single cdf file) just the temp, lon, lat and jul data
that exist?

By the way, the description of COMPRESSI_BY in the documentation does
not give enough information for me to figure out what this does.

Billy K



      



  

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement