Variables and Attributes

Information in a CDF file consists of attributes (metadata) and collections of data records (variables).


IDL can create CDF files representing any data that can be stored in a zero- to eight-dimensional array. CDF supports two distinct types of variables, rVariables and zVariables . For reasons of efficiency, CDF uses "variances" to indicate whether data is unique between records and dimensions. For example, consider a data set of simultaneous surface temperatures at a variety of locations, the IDL code for creating the CDF file is included at the end of this section. A variable representing "GMT time" will vary from record to record, but not dimension to dimension (since all data are taken simultaneously). On the other hand, a variable such as longitude may not vary from record to record, but will vary from dimension to dimension. Record variance is set using the REC_VARY and REC_NOVARY keywords to CDF_VARCREATE, while dimensional variance is set through the DimVary argument to CDF_VARCREATE. In both cases, the default is varying data.


rVariables (or "regular" variables) are multidimensional arrays of values, each having the same dimensions. That is, all rVariables in a CDF must have the same number of dimensions and dimension sizes. In IDL, the rVariable dimension sizes are declared when the CDF file is first created with CDF_CREATE. In the above example at the end of this section, all variables except "time" are rVariables.


zVariables (The "z" doesn't stand for anything--the CDF people just like the letter "z") are multidimensional arrays of values of the same data type. zVariables can have different dimensionality from other zVariables and rVariables. In general, zVariables are much more flexible, and therefore easier to use, than rVariables.

For more discussion on CDF variables, see section 1.5 ("Organizing Your Data in CDF") of the version 2.6 CDF User's Guide .


Attributes can contain auxiliary information about an entire CDF file ( global scope attributes or gAttributes), or about particular CDF variables ( variable scope attributes or rAttributes/zAttributes depending on variable type). CDF attributes can be scalar or vector in nature, and of any valid datatype. In the case of vector, or multiple entry, attributes the user must keep track of the entry numbers ( in CDF terms these are the gEntry, rEntry, or zEntry numbers depending on attribute type). For example, every rVariable in a CDF file might have an rAttribute named "Date". A vector zVariable might have a zAttribute named "Location" with values such as ["Melbourne Beach", "Crowley", ...]. A global attribute "MODS" might be used to keep track of the modification history of a CDF file (see CDF_ATTPUT ). Note however, that variables cannot have multiple attributes with the same names. In IDL, CDF attributes are created with CDF_ATTPUT and retrieved with CDF_ATTGET.

For more discussion on CDF variables, see section 1.6 ("Attributes") of the version 2.6 CDF User's Guide . Certain "standard" attributes are required for a file to conform to the NSSDC standard. For a description of these attributes see section 2.6.1 ("Standard Attributes") of the Version 2.6 CDF User's Guide .