The CDF_ATTGET_ENTRY procedure reads a variable attribute entry from a CDF file.

Examples


id = CDF_OPEN('test.cdf')
inq = CDF_INQUIRE(id)
 
; Read all the variable attribute entries.
 
; Walk through all of the zVariables
FOR varNum = 0, inq.nzvars-1 DO BEGIN
 
	; Walk through all of the ZVariable attributes
   FOR attrNum = 0, inq.natts-1 DO BEGIN
 
      ; Read the variable attribute
      CDF_ATTGET_ENTRY, id, attrNum, varNum, attType, value, $
         status, /ZVARIABLE, CDF_TYPE=cdfType, $
         ATTRIBUTE_NAME=attName
      IF STATUS NE 1 THEN CONTINUE
      PRINT, "attr_name = ", attName, ", ", cdfType, ", ", $
         value
   ENDFOR
ENDFOR

Syntax


CDF_ATTGET_ENTRY, Id, Attribute, EntryNum, AttributeEntryType, Value, Status [, CDF_TYPE=variable] [, ATTRIBUTE_NAME=string] [, /ZVARIABLE]

Arguments


Id

The CDF ID, returned from a previous call to CDF_OPEN or CDF_CREATE.

Attribute

A string containing the name of the attribute or the attribute number to be written.

EntryNum

The entry number. If the attribute is variable in scope, this is either the name or number of the variable the attribute is to be associated with. If the attribute is global in scope, this is the actual gEntry. It is the user's responsibility to keep track of valid gEntry numbers. Normally, gEntry numbers begin with 0 or 1 and increase to MAXGENTRY (as reported in the GET_ATTR_INFO structure returned by CDF_CONTROL), but this is not required.

AttributeEntryType

The data type of the requested attribute entry.

Value

A named variable that will contain the attribute value.

Status

The procedure return status. A value of 1 is returned if the requested attribute exists and its entry is retrieved. Otherwise, 0 is returned.

Keywords


CDF_TYPE

Set this keyword to a named variable that will contain the CDF type of the attribute entry, returned as a scalar string. The possible string values are:

CDF_CHAR

CDF_UCHAR

CDF_INT1

CDF_BYTE

CDF_UINT1

CDF_UINT2

CDF_INT2

CDF_UINT4

CDF_INT4

CDF_REAL4

CDF_FLOAT

CDF_REAL8

CDF_DOUBLE

CDF_EPOCH

CDF_EPOCH16

If the type cannot be determined, “UNKNOWN” is returned.

ATTRIBUTE_NAME

Set this keyword to a named variable that will hold the name of the requested attribute number.

ZVARIABLE

If EntryNum is a variable ID (as opposed to a variable name) and the variable is a zVariable, set this flag to indicate that the variable ID is a zVariable ID. The default behavior is to assume that EntryNum is an rVariable ID.

Note: The attribute must have a scope of VARIABLE_SCOPE.

Version History


 

8.0

Introduced

See Also


CDF_ATTGET