The HDF_SD_ATTRFIND function locates the index of an HDF attribute given its name. The attribute can be global or from a specific dataset. If an attribute is located, its index is returned. Otherwise, -1 is returned. Once an attribute’s index is known, the HDF_SD_ATTRINFO function can be used to read that attribute.
Examples
SDinterface_id = HDF_SD_START('demo.hdf')
gindex = HDF_SD_ATTRFIND(SDinterface_id, 'TITLE')
SDdataset_id = HDF_SD_SELECT(SDinterface_id, 1)
HDF_SD_ATTRINFO,SDinterface_id,gindex, NAME=name, TYPE=type, COUNT=count
HELP, type, count, name
dindex = HDF_SD_ATTRFIND(SDdataset_id, 'LOCATION')
HDF_SD_ATTRINFO,SDdataset_id,dindex,NAME=name,TYPE=type,COUNT=count
IDL Output
TYPE STRING = 'STRING'
COUNT LONG = 8
NAME STRING = 'TITLE'
Syntax
Result = HDF_SD_ATTRFIND(SD_id, Name)
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”).
Name
A string containing the name of the attribute whose index is to be returned.
Keywords
None
Version History
See Also
HDF_SD_ATTRINFO, HDF_SD_ATTRSET, HDF_SD_SELECT