The HDF_SD_ATTRSET procedure writes attributes to an open HDF SD dataset. If no data type is specified, the data type is taken from the Values argument.
Set this keyword to indicate that the attribute is composed of bytes. Data will be stored with the HDF DFNT_UINT8 data type. Setting this keyword is the same as setting the DFNT_UINT8 keyword.
Set this keyword to create an attribute of HDF type DFNT_CHAR. Setting this keyword is the same as setting the STRING keyword.
Set this keyword to create an attribute of HDF type DFNT_FLOAT32. Setting this keyword is the same as setting the FLOAT keyword.
Set this keyword to create an attribute of HDF type DFNT_FLOAT64. Setting this keyword is the same as setting the DOUBLE keyword.
Set this keyword to create an attribute of HDF type DFNT_INT16. Setting this keyword is the same as setting either the INT keyword or the SHORT keyword.
Set this keyword to create an attribute of HDF type DFNT_INT32. Setting this keyword is the same as setting the LONG keyword.
Set this keyword to create an attribute of HDF type DFNT_UINT8. Setting this keyword is the same as setting the BYTE keyword.
Set this keyword to indicate that the attribute is composed of double-precision floating-point values. Data will be stored with the HDF DFNT_FLOAT64 data type. Setting this keyword is the same as setting the DFNT_FLOAT64 keyword.
Set this keyword to indicate that the attribute is composed of single-precision floating-point values. Data will be stored with the HDF DFNT_FLOAT32 data type. Setting this keyword is the same as setting the DFNT_FLOAT32 keyword.
Set this keyword to indicate that the attribute is composed of 2-byte integers. Data will be stored with the HDF DFNT_INT16 data type. Setting this keyword is the same as setting either the SHORT keyword or the DFNT_INT16 keyword.
Set this keyword to indicate that the attribute is composed of longword integers. Data will be stored with the HDF DFNT_INT32 data type. Setting this keyword is the same as setting the DFNT_INT32 keyword.
fid = HDF_OPEN('demo.hdf', /ALL) ; Create a new HDF file.
sd_id = HDF_SD_START('demo.hdf', /RDWR) ; Start the SD interface.
HDF_SD_ATTRSET, sd_id, 'TITLE', 'MY TITLE GLOBAL', 16
;
Create a global attribute.
HDF_SD_ATTRSET, sd_id, 'RANGE', [-99.88,55544.2], /DOUBLE
;
Create another global attribute.
SDS_ID = HDF_SD_CREATE(sd_id, 'var1', [10,20], /FLOAT)
;
Create a dataset.
HDF_SD_ATTRSET, SDS_ID, 'TITLE', 'MY TITLE SD_ID', 15
;
Add a dataset attribute.
index=HDF_SD_ATTRFIND(sd_id, 'RANGE') ; Find the recently-created RANGE attribute.
HDF_SD_ATTRINFO,sd_id,index,NAME=atn,COUNT=atc,TYPE=att,DATA=d
;
Retrieve data from RANGE.
HELP, atn, atc, att ; Print information about the returned variables.
PRINT, d, FORMAT='(F8.2,x,F8.2)' ; Print the data returned in variable d with the given format.
HDF_SD_ATTRFIND , HDF_SD_ATTRINFO , HDF_SD_CREATE , HDF_SD_SELECT