The HDF_VG_ATTRSET procedure writes a VGroup attribute to the currently attached HDF VGroup structure. If no data type keyword is specified, the data type of the attribute value is used.

Syntax


HDF_VG_ATTRSET, VGroup, AttributeName, Values [, /BYTE] [, /DFNT_CHAR8] [, /DFNT_FLOAT32] [, /DFNT_FLOAT64] [, /DFNT_INT8] [, /DFNT_INT16] [, /DFNT_INT32] [, /DFNT_UCHAR8] [, /DFNT_UINT8] [, /DFNT_UINT16] [, /DFNT_UINT32] [, /DOUBLE] [, /FLOAT] [, /INT] [, /LONG] [, /SHORT] [, /STRING] [, /UINT ] [, /ULONG ]

Arguments


VGroup

The VGroup handle returned by a previous call to HDF_VG_ATTACH with the WRITE keyword.

AttributeName

A string containing the name of the attribute to be written.

Values

The attribute value(s) to be written.

Note: Attributes to be written as characters must come from either a scalar string or a one-dimensional byte array; string arrays or multi-dimensional byte arrays are not allowed.

Keywords


BYTE

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.

DFNT_CHAR8

Set this keyword to create an attribute of HDF type DFNT_CHAR8. Setting this keyword is the same as setting the STRING keyword.

DFNT_FLOAT32

Set this keyword to create an attribute of HDF type DFNT_FLOAT32. Setting this keyword is the same as setting the FLOAT keyword.

DFNT_FLOAT64

Set this keyword to create an attribute of HDF type DFNT_FLOAT64. Setting this keyword is the same as setting the DOUBLE keyword.

DFNT_INT8

Set this keyword to create an attribute of HDF type DFNT_INT8.

Note: IDL does not have a signed 8-bit integer type. When writing the data to the file using DFNT_INT8, byte values from 0-127 will be written unchaged, while byte values from 128-255 will be wrapped into the range -127 to -1. When reading data of type DFNT_INT8 from the file into IDL, values from 0-127 will be read in unchanged, while values from -127 to -1 will be wrapped into the byte range 128 to 255.

DFNT_INT16

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.

DFNT_INT32

Set this keyword to create an attribute of HDF type DFNT_INT32. Setting this keyword is the same as setting the LONG keyword.

DFNT_UCHAR8

Set this keyword to create an attribute of HDF type DFNT_UCHAR8.

DFNT_UINT8

Set this keyword to create an attribute of HDF type DFNT_UINT8. Setting this keyword is the same as setting the BYTE keyword.

DFNT_UINT16

Set this keyword to create an attribute of HDF type DFNT_UINT16.

DFNT_UINT32

Set this keyword to create an attribute of HDF type DFNT_UINT32.

DOUBLE

Set this keyword to indicate that the attribute is composed of double-precision floating-point values. Data will be stored with the HDF type DFNT_FLOAT64. Setting this keyword is the same as setting the DFNT_FLOAT64 keyword.

FLOAT

Set this keyword to indicate that the attribute is composed of single-precision floating-point values. Data will be stored with the HDF type DFNT_FLOAT32 data type. Setting this keyword is the same as setting the DFNT_FLOAT32 keyword.

INT

Set this keyword to indicate that the attribute is composed of 16-bit integers. Data will be stored with the HDF type DFNT_INT16 data type. Setting this keyword is the same as setting either the SHORT keyword or the DFNT_INT16 keyword.

LONG

Set this keyword to indicate that the attribute is composed of longword integers. Data will be stored with the HDF type DFNT_INT32 data type. Setting this keyword is the same as setting the DFNT_INT32 keyword.

SHORT

Set this keyword to indicate that the attribute is composed of 16-bit integers. Data will be stored with the HDF type DFNT_INT16 data type. Setting this keyword is the same as setting either the INT keyword or the DFNT_INT16 keyword.

STRING

Set this keyword to indicate that the attribute is composed of strings. Data will be stored with the HDF type DFNT_CHAR8 data type. Setting this keyword is the same as setting the DFNT_CHAR8 keyword.

UINT

Set this keyword to indicate that the attribute is composed of unsigned 2-byte integers. Data will be stored with the HDF type DFNT_UINT16 data type. Setting this keyword is the same as setting the DFNT_UINT16 keyword.

ULONG

Set this keyword to indicate that the attribute is composed of unsigned longword integers. Data will be stored with the HDF type DFNT_UINT32 data type. Setting this keyword is the same as setting the DFNT_UINT32 keyword.

Examples


file = FILEPATH('vattr_example.hdf', SUBDIR=['examples', 'data'])
FileHandle = HDF_OPEN(file, /READ, /WRITE)
vgID = HDF_VG_GETID(FileHandle, -1)
VGroup = HDF_VG_ATTACH(FileHandle, vgID, /WRITE)
 
HDF_VG_ATTRSET, VGroup, 'MyAttributeSTRING', "ABC"
 
HDF_VG_DETACH, VGroup
HDF_CLOSE, FileHandle

See HDF_VG_ATTRGET for an example of reading in the attribute.

Version History


8.5.1

Introduced

See Also


HDF_VG_ATTRFIND, HDF_VG_ATTRINFO,  HDF_VG_ATTRGET,  HDF_VG_GETINFO