Consider a data object consisting of a wind vector measured over a longitude-latitude grid and standard atmospheric pressure levels, as in the previous example. The winds are averages over ten years for each day in January. Each wind measurement is a vector having three components (, , ), one along each of the dimensions of longitude, latitude, and pressure.
Thus the data have one Level 0 dimension with three elements. Longitude and latitude are Level 1 dimensions as in the previous example, but this time we make pressure a Level 1 dimension, too, instead of Level 2.
We choose to write the data out as a array (i.e., pressure, wind component, latitude, longitude, day of month).
If our indices start numbering at 0, then we have the following record fields:
In IDL, then, the code for specifying the dimensions would look something like this:
; set up the relevant elements in the OBJDESC record RECTYPE = long(1) NDIM0 = long(1) NDIM1 = long(3) NDIM2 = long(1) NDIM3 = long(1) . . . writeu,log_file_unit, RECTYPE, vartype, reserved $ , NDIM0, NDIM1, NDIM2, NDIM3, reserved, isource $ , reserved, reserved, naudit, ninfo, ncomms, comcod $ , reserved, nbads, reserved, nprocs, reserved, npacks $ , reserved, reserved, cmpnum, reserved, reserved $ , reserved . . .
; set up the DIMSPEC0 record RECTYPE = long(20) ; The wind component index is second in the actual data ; array INDEX = long(1) ; There are three components to the wind GPTNUM = long(3)
writeu,log_file_unit, RECTYPE, reserved, reserved $ , INDEX, GPTNUM
; set up the DIMSPEC1 record RECTYPE = long(21) ; longitude, latitude, and pressure are the fourth, ; third, and first dimensions of the data array read in. INDEX = long( [ 3, 2, 0 ] ) ; we will specify only one DESCRIP1 record for each ; dimension DESNUM = long( [ 1, 1, 1 ] )
writeu,log_file_unit, RECTYPE, reserved, reserved $ , INDEX, DESNUM
; set up the DIMSPEC2 record RECTYPE = long(22) ; Time will be the fifth dimension of the data array read ; in. INDEX = long( 4 ) ; There will be 31 times, one for each day of January GPTNUM = long( 31 )
writeu,log_file_unit, RECTYPE, reserved, reserved $ , INDEX, GPTNUM
; set up the DIMSPEC3 record RECTYPE = long(23) ; there will be only one DESCRIP3 record for the single ; Level 3 dimension DESNUM = 1
writeu,log_file_unit, RECTYPE, reserved, reserved, DESNUM
; set up the DESCRIP0 record RECTYPE = long(30) ; data are floating-point single precision numbers DATFMT = long(67108864, 67108864, 67108864) ; data are wind componenets (u, v, w) ; Note: in actual working code, one would call here a ; function which would convert the strings ; "measured u wind", "measured v wind", and ; "measured w wind" to the quantity codes: ; 18874368, 18878464, 18882560 VARTYPE = long(18874368, 18878464, 18882560) ; the wind components are in m/s, m/s, cm/s UNITS = long(1616347136, 1616347136, 1616347137)
writeu,log_file_unit, RECTYPE, reserved, reserved $ , DATFMT, VARTYPE, UNITS
; Now do the latitude DESCRIP1 and DESCVAL records writeu,log_file_unit, long(31), long(1), long(0) $ , long(-1), long(91), long(0), long(0), long(51445760) $ , long(17838096), long(1745355010), long(2), reserved $ , reserved writeu,log_file_unit, long(35),long(1),long(1) $ , long([ -90, 90 ])
; Now do the longitude DESCRIP1 and DESCVAL records writeu,log_file_unit, long(31), long(0), long(0) $ , long(-1), long(72), long(0), long(0), long(51445760) $ , long(17838080), long(1745355010), long(1), reserved $ , reserved writeu,log_file_unit, long(35), long(1), long(0), $ , long([ 0, 5 ])
; Do the pressure DESCRIP1 record RECTYPE = long(31) ; This describes the third Level 1 dimension NDEX = long(2) ; This covers the entire range of the single Level 2 ; dimension START = long(0) ENDIT = long(-1) ; Six pressure levels GPTNUM = 6 ; No duplicate records DUPNUM = long(0) ; No supplemental information DESSUP = long(0) ; pressures are floating-point numbers DESFMT = long(67108864) ; the quantity id for pressure is 16781312 DESTYPE = long(16781312) ; The units code for millibars is 1081593921 UNITS = long(1081593921) ; We will store this as a an explicit array STORG = long(0)
writeu,log_file_unit, RECTYPE, NDEX, START, ENDIT $ , GPTNUM, DUPNUM, DESSUP, DESFMT, DESTYPE, UNITS $ , STORG, reserved, reserved
; set up the pressure DESCVAL record RECTYPE = long(35) ; This belongs to Level 1, dimension number 3 LEVEL = long(1) NDEX = long(2) ; We list the pressure levels AVALS = float([1000., 850., 700., 500., 250., 100.] )
writeu,log_file_unit, RECTYPE, LEVEL, NDEX, AVALS
; do the time dimension spec (DESCRIP2 and DESCVAL) writeu,log_file_unit, long(32), long(0), long(0) $ , long(0), long(50397184), long(131072) $ , long(1615331845), long(1), reserved, reserved writeu,log_file_unit, long(35), long(2), long(0) $ , long(1, 1)
; set up the time averaging DESCRIP3 record RECTYPE = long(33) ; This describes the first Level 3 dimension NDEX = long(0) ; This covers the entire range of all Levels 0-2 ; dimension START = long( [ 0, 0, 0, 0, 0 ] ) ENDIT = long( [ -1, -1, -1, -1, -1 ] ) ; There are 10 years in the average GPTNUM = long(10) ; These are arithmetic means computed from discrete sums AVGCOD = 1 ; No duplicate records DUPNUM = long(0) ; No supplemental information DESSUP = long(0) ; years are unsigned long integers DESFMT = long(50397184) ; the quantity id for time is 131072 DESTYPE = long(131072) ; The units code for year is 1615331616 UNITS = long(1615331616) ; We will store this as a an implicit ; (low-value, high-value) pair STORG = long(2)
writeu,log_file_unit, RECTYPE, NDEX, START, ENDIT $ , GPTNUM, AVGCOD, DUPNUM, DESSUP, DESFMT, DESTYPE $ , UNITS, STORG, reserved, reserved
; set up the 10-year average DESCVAL record RECTYPE = long(35) ; This belongs to Level 3, dimension number 1 LEVEL = long(3) NDEX = long(0) ; We start at 1983 increase and end at 1992 AVALS = long([ 1983, 1992 ] )
writeu,log_file_unit, RECTYPE, LEVEL, NDEX, AVALS
Note that the specifications for the dimensions, the dimension descriptors, and even the data itself do not have to be stored in any prescribed order. This is explained in Section 2.3.2. These indices are used as pointers from the descriptors to the specifications to the data itself. The DESCVAL record associated with the DESCRIP3 record will contain the year index over which the data has been averaged. These values are not needed to access the data values but instead they aid in interpreting the meaning of the data.