HDF_SD_ATTRINFO

Syntax | Arguments | Keywords | Examples | Version History | See Also

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.

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. (See IDL and HDF Data Types for valid values.)

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.

Examples

; Open an HDF file and start the SD interface: 
SDinterface_id = HDF_SD_START('demo.hdf') 
; Find a global attribute: 
gindex = HDF_SD_ATTRFIND(SDinterface_id, 'TITLE') 
; Retrieve attribute info: 
HDF_SD_ATTRINFO, SDinterface_id, gindex, NAME=n, TYPE=t, $ 
   COUNT=c, DATA=d, HDF_TYPE=h 
; Print information about the returned variables:  
HELP, n, t, c, h 
; Return the SD dataset ID for the first dataset (index 0): 
SDdataset_id = HDF_SD_SELECT(SDinterface_id, 0) 
; Find a dataset attribute: 
dindex = HDF_SD_ATTRFIND(SDdataset_id, 'LOCATION') 
; Retrieve attribute info: 
HDF_SD_ATTRINFO,SDdataset_id, dindex, NAME=n, TYPE=t, $ 
   COUNT=c, DATA=d 
; Print information about the new returned variables: 
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' 

Version History

4.0

Introduced

See Also

HDF_SD_ATTRFIND, HDF_SD_ATTRSET, HDF_SD_CREATE, HDF_SD_SELECT, HDF_SD_START