Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / IDL Reference / I/O - HDF / HDF_SD_ATTRFIND

HDF_SD_ATTRFIND

HDF_SD_ATTRFIND

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


; Open an HDF file and start the SD interface:
SDinterface_id = HDF_SD_START('demo.hdf')
; Find "TITLE", a global attribute:
gindex = HDF_SD_ATTRFIND(SDinterface_id, 'TITLE')
; Get the ID for the first dataset:
SDdataset_id = HDF_SD_SELECT(SDinterface_id, 1)
; Read attribute info:
HDF_SD_ATTRINFO,SDinterface_id,gindex, NAME=name, TYPE=type, COUNT=count
; Print info about the returned variables:
HELP, type, count, name
; Find the "LOCATION" dataset attribute:
dindex = HDF_SD_ATTRFIND(SDdataset_id, 'LOCATION')
; Read attribute info:
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


4.0

Introduced

See Also


HDF_SD_ATTRINFO, HDF_SD_ATTRSET, HDF_SD_SELECT



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us