The HDF_SD_ATTRINFO procedure reads or retrieves information about an SD attribute. The attribute can be global or from a specific dataset. If an attribute is not present, an error message is printed.
Examples
SDinterface_id = HDF_SD_START('demo.hdf')
gindex = HDF_SD_ATTRFIND(SDinterface_id, 'TITLE')
HDF_SD_ATTRINFO, SDinterface_id, gindex, NAME=n, TYPE=t, $
COUNT=c, DATA=d, HDF_TYPE=h
HELP, n, t, c, h
SDdataset_id = HDF_SD_SELECT(SDinterface_id, 0)
dindex = HDF_SD_ATTRFIND(SDdataset_id, 'LOCATION')
HDF_SD_ATTRINFO,SDdataset_id, dindex, NAME=n, TYPE=t, $
COUNT=c, DATA=d
HELP, n, t, c, d
IDL Output
N STRING = 'TITLE'
T STRING = 'STRING'
C LONG = 17
D STRING = '5th Ave Surf Shop'
H STRING = 'DFNT_CHAR8'
N STRING = 'LOCATION'
T STRING = 'STRING'
C LONG = 15
D STRING = 'MELBOURNE BEACH'
Syntax
HDF_SD_ATTRINFO, SD_id, Attr_Index [, COUNT=variable] [, DATA=variable] [, HDF_TYPE=variable] [, NAME=variable] [, TYPE=variable]
Arguments
SD_id
An SD interface ID as returned by HDF_SD_START (i.e., a global attribute’s “SDinterface_id”), or HDF_SD_SELECT/HDF_SD_CREATE (i.e., a dataset’s “SDdataset_id”).
Attr_Index
The attribute index, can either be obtained by calling HDF_SD_ATTRFIND if a particular attribute name is known or can be obtained with a 0-based index sequentially referencing the attribute.
Keywords
COUNT
Set this keyword to a named variable in which the total number of values in the specified attribute is returned.
DATA
Set this keyword to a named variable in which the attribute data is returned.
HDF_TYPE
Set this keyword to a named variable in which the HDF type of the attribute is returned as a scalar string. Possible returned values are DFNT_NONE, DFNT_CHAR8, DFNT_FLOAT32, DFNT_FLOAT64, DFNT_INT8, DFNT_INT16, DFNT_INT32, DFNT_UINT8, DFNT_UINT16, and DFNT_UINT32.
Note: IDL does not have a signed 8-bit integer type. When writing the data to the file using DFNT_INT8, byte values from 0-127 will be written unchaged, while byte values from 128-255 will be wrapped into the range -127 to -1. When reading data of type DFNT_INT8 from the file into IDL, values from 0-127 will be read in unchanged, while values from -127 to -1 will be wrapped into the byte range 128 to 255.
NAME
Set this keyword to a named variable in which the name of the attribute is returned.
TYPE
Set this keyword to a named variable in which the IDL type of the attribute is returned as a scalar string. Possible returned values are BYTE, INT, LONG, FLOAT, DOUBLE, STRING, or UNKNOWN.
Version History
See Also
HDF_SD_ATTRFIND, HDF_SD_ATTRSET, HDF_SD_CREATE, HDF_SD_SELECT, HDF_SD_START