|
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.
|