HDF_SD_ATTRINFO

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.

Calling Sequence

HDF_SD_ATTRINFO, S_ID, Attr_Index

Arguments

S_ID

An SD interface ID as returned by HDF_SD_START (i.e., a global attribute's " SD_ID "), or HDF_SD_SELECT/HDF_SD_CREATE (i.e., a dataset's " SDS_ID ").

Attr_Index

The attribute index, usually obtained by calling HDF_SD_ATTRFIND or HDF_SD_NAMETOINDEX .

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_CHAR , DFNT_FLOAT32 , DFNT_FLOAT64 , DFNT_INT8 , DFNT_INT16 , DFNT_INT32 , DFNT_UINT8 , DFNT_UINT16 , and DFNT_UINT32 .

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 .

Example

sd_id = HDF_SD_START('demo.hdf') ; Open an HDF file and start the SD interface.

gindex = HDF_SD_ATTRFIND(sd_id, 'TITLE') ; Find a global attribute

HDF_SD_ATTRINFO, sd_id, gindex, NAME=n, TYPE=t, COUNT=c, $

                 DATA=d, HDF_TYPE=h ; Retrieve attribute info.

HELP, n, t, c, h ; Print information about the returned variables.

IDL prints:

N STRING = 'TITLE'

T STRING = 'STRING'

C LONG = 17

D STRING = '5th Ave Surf Shop'

H STRING = 'DFNT_CHAR'

sds_id = HDF_SD_SELECT(sd_id, 0) ; Return the SD dataset ID for the first dataset (index 0).

dindex = HDF_SD_ATTRFIND(sds_id, 'LOCATION')
; Find a dataset attribute.

HDF_SD_ATTRINFO,SDS_ID, dindex, NAME=n, TYPE=t, COUNT=c, DATA=d
; Retrieve attribute info.

HELP, n, t, c, d ; Print information about the new returned variables.

IDL prints:

N STRING = 'LOCATION'

T STRING = 'STRING'

C LONG = 15

D STRING = 'MELBOURNE BEACH'

See Also

HDF_SD_ATTRFIND , HDF_SD_ATTRSET , HDF_SD_CREATE , HDF_SD_SELECT , HDF_SD_START