The CDF_VARGET procedure reads multiple values from a Common Data Format file variable. By default, all elements of a record are read. If INTERVAL, and/or OFFSET are specified but no COUNT is specified, CDF_VARGET attempts to get as many elements of each record as possible.
An optional vector containing the counts to be used in reading Value . The default is to read all elements in each record, taking into account INTERVAL and OFFSET.
A vector specifying the interval between values in each dimension. The default value is 1 for each dimension.
A vector specifying the array indices within the specified record(s) at which to begin writing. OFFSET is a 1-dimensional array containing one element per CDF dimension. The default value is zero for each dimension.
Create a CDF file, and make a few variables:
id = CDF_CREATE('DEMOvargets')
vid1 = CDF_VARCREATE(id, 'VAR1', /CDF_CHAR, NUMELEM=15)
vid2=CDF_VARCREATE(id, 'VAR2', /CDF_UCHAR, NUMELEM=10)
CDF_VARPUT, id, vid1, BINDGEN(15, 2)+55, COUNT=2
CDF_VARPUT, id, vid2, ['IDLandCDF ', 'AreWayCool']
Retreive the CDF_CHAR array as byte data:
CDF_VARGET, id, 'VAR1', var1_byte, REC_COUNT=2
% CDF_VARGET: Warning: converting data to unsigned bytes
This warning message indicates that the data was stored in the CDF file with type CDF_CHAR (signed 1-byte characters), but was retreived by IDL with type BYTE (unsigned byte). To turn this warning message off, set !QUIET=1.
Retreive the CDF_CHAR array as string data:
CDF_VARGET, id, 'VAR1', var1_string, REC_COUNT=2, /STRING
For demonstration purposes, use the "VAR2" variable number to access "VAR2" for the duration of this example:
var2num = CDF_VARNUM(id, 'VAR2")
Rename "VAR2" to "VAR_STRING_2":
CDF_VARRENAME, id, var2num, 'VAR_STRING_2'
Examine VAR_STRING_2 with CDF_VARINQ:
VAR2_INQ = CDF_VARINQ(id, var2num)
** Structure <400b1600>, 6 tags, length=33, refs=1:
Read in and print out VAR_STRING_2: