The Attribute interface, H5A, is primarily designed to easily allow small datasets to be attached to primary datasets as metadata information. Additional goals for the H5A interface include keeping storage requirement for each attribute to a minimum and easily sharing attributes among datasets.
Because attributes are intended to be small objects, large datasets intended as additional information for a primary dataset should be stored as supplemental datasets in a group with the primary dataset. Attributes can then be attached to the group containing everything to indicate a particular type of dataset with supplemental datasets is located in the group. How small is "small" is not defined by the library and is up to the user’s interpretation.
Location and name with attribute functions:
Several attribute functions, such as H5A_CREATE2, use a location identifier, an object name, and an attribute name, loc_id
, obj_name
, and attr_name
, respectively. loc_id
and obj_name
specify the object to which an attribute is attached and carry exactly the same meaning and interaction modes as described for loc_id
and name
in Accessing objects by location and name. attr_name
specifies the attribute as it is attached to that object.
The following example specifies an attribute named A3
attached to the dataset dset3
.
loc_id
specifies group3
.
name = 'dset3'
attr_name = 'A3'
Older H5A functions, such as H5A_CREATE1 , generally use only a location identifier and a name. In these functions, loc_id
fully specifies the object to which an attribute is attached; the attribute itself is specified by an attribute name, attr_name
.
Again, the following example specifies an attribute named A3
attached to the dataset dset3
above.
loc_id
specifies dset3
.
attr_name = 'A3'