|
HDF5 documents and links Introduction to HDF5 HDF5 User Guide |
And in this document, the
HDF5 Reference Manual
H5 H5A H5D H5E H5F H5G H5I H5P H5R H5S H5T H5Z Tools Datatypes |
The C Interfaces:
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.
See Attributes in the HDF5 User's Guide for further information.
H5Aclose(hid_t attr_id)
H5Aclose terminates access to the attribute
specified by attr_id by releasing the identifier.
Further use of a released attribute identifier is illegal; a function using such an identifier will fail.
attr_id
SUBROUTINE h5aclose_f(attr_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aclose_f
H5Acreate(hid_t loc_id,
const char *name,
hid_t type_id,
hid_t space_id,
hid_t create_plist
)
H5Acreate creates an attribute named name
and attached to the object specified with loc_id.
loc_id is a group, dataset, or named datatype identifier.
The attribute name specified in name must be unique.
Attempting to create an attribute with the same name as an already
existing attribute will fail, leaving the pre-existing attribute
in place. To overwrite an existing attribute with a new attribute
of the same name, first call H5Adelete then recreate
the attribute with H5Acreate.
The datatype and dataspace identifiers of the attribute,
type_id and space_id, respectively,
are created with the H5T and H5S interfaces, respectively.
Currently only simple dataspaces are allowed for attribute dataspaces.
The attribute creation property list, create_plist,
is currently unused;
it may be used in the future for optional attribute properties.
At this time, H5P_DEFAULT is the only accepted value.
H5Aclose or resource leaks will develop.
loc_idnametype_idspace_idcreate_plistH5P_DEFAULT.)
SUBROUTINE h5acreate_f(obj_id, name, type_id, space_id, attr_id, &
hdferr, creation_prp)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name
INTEGER(HID_T), INTENT(IN) :: type_id ! Attribute datatype identifier
INTEGER(HID_T), INTENT(IN) :: space_id ! Attribute dataspace identifier
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp
! Attribute creation property
! list identifier
END SUBROUTINE h5acreate_f
H5Adelete(hid_t loc_id,
const char *name
)
H5Adelete removes the attribute specified by its
name, name, from a dataset, group, or named datatype.
This function should not be used when attribute identifiers are
open on loc_id as it may cause the internal indexes
of the attributes to change and future writes to the open
attributes to produce incorrect results.
loc_id
name
SUBROUTINE h5adelete_f(obj_id, name, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5adelete_f
H5Aget_name(hid_t attr_id,
size_t buf_size,
char *buf
)
H5Aget_name retrieves the name of an attribute
specified by the identifier, attr_id.
Up to buf_size characters are stored in
buf followed by a \0 string
terminator. If the name of the attribute is longer than
(buf_size -1), the string terminator is stored in the
last position of the buffer to properly terminate the string.
attr_id
buf_size
buf
buf_size, if successful.
Otherwise returns a negative value.
SUBROUTINE h5aget_name_f(attr_id, size, buf, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER, INTENT(IN) :: size ! Buffer size
CHARACTER(LEN=*), INTENT(OUT) :: buf ! Buffer to hold attribute name
INTEGER, INTENT(OUT) :: hdferr ! Error code: name length
! on success and -1 on failure
END SUBROUTINE h5aget_name_f
H5Aget_num_attrs(hid_t loc_id)
H5Aget_num_attrs returns the number of attributes
attached to the object specified by its identifier,
loc_id.
The object can be a group, dataset, or named datatype.
loc_id
SUBROUTINE h5aget_num_attrs_f(obj_id, attr_num, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
INTEGER, INTENT(OUT) :: attr_num ! Number of attributes of the object
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aget_num_attrs_f
H5Aget_space(hid_t attr_id)
H5Aget_space retrieves a copy of the dataspace
for an attribute. The dataspace identifier returned from
this function must be released with H5Sclose
or resource leaks will develop.
attr_id
SUBROUTINE h5aget_space_f(attr_id, space_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(OUT) :: space_id ! Attribute dataspace identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aget_space_f
H5Aget_type(hid_t attr_id)
H5Aget_type retrieves a copy of the datatype
for an attribute.
The datatype is reopened if it is a named type before returning it to the application. The datatypes returned by this function are always read-only. If an error occurs when atomizing the return datatype, then the datatype is closed.
The datatype identifier returned from this function must be
released with H5Tclose or resource leaks will develop.
attr_id
SUBROUTINE h5aget_type_f(attr_id, type_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(OUT) :: type_id ! Attribute datatype identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aget_type_f
H5Aiterate(hid_t loc_id,
unsigned * idx,
H5A_operator_t op,
void *op_data
)
H5Aiterate iterates over the attributes of
the object specified by its identifier, loc_id.
The object can be a group, dataset, or named datatype.
For each attribute of the object, the op_data
and some additional information specified below are passed
to the operator function op.
The iteration begins with the attribute specified by its
index, idx; the index for the next attribute
to be processed by the operator, op, is
returned in idx.
If idx is the null pointer, then all attributes
are processed.
The prototype for H5A_operator_t is:
typedef herr_t (*H5A_operator_t)(hid_t loc_id,
const char *attr_name,
void *operator_data);
The operation receives the identifier for the group, dataset
or named datatype being iterated over, loc_id, the
name of the current attribute about the object, attr_name,
and the pointer to the operator data passed in to H5Aiterate,
op_data. The return values from an operator are:
loc_id
idx
op
op_data
H5Aopen_idx(hid_t loc_id,
unsigned int idx
)
H5Aopen_idx opens an attribute which is attached
to the object specified with loc_id.
The location object may be either a group, dataset, or
named datatype, all of which may have any sort of attribute.
The attribute specified by the index, idx,
indicates the attribute to access.
The value of idx is a 0-based, non-negative integer.
The attribute identifier returned from this function must be
released with H5Aclose or resource leaks will develop.
loc_id
idx
SUBROUTINE h5aopen_idx_f(obj_id, index, attr_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
INTEGER, INTENT(IN) :: index ! Attribute index
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aopen_idx_f
H5Aopen_name(hid_t loc_id,
const char *name
)
H5Aopen_name opens an attribute specified by
its name, name, which is attached to the
object specified with loc_id.
The location object may be either a group, dataset, or
named datatype, which may have any sort of attribute.
The attribute identifier returned from this function must
be released with H5Aclose or resource leaks
will develop.
loc_id
name
SUBROUTINE h5aopen_name_f(obj_id, name, attr_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aopen_name_f
H5Aread(hid_t attr_id,
hid_t mem_type_id,
void *buf
)
H5Aread reads an attribute, specified with
attr_id. The attribute's memory datatype
is specified with mem_type_id. The entire
attribute is read into buf from the file.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Conversion section of The Data Type Interface (H5T) in the HDF5 User's Guide for a discussion of data conversion, including the range of conversions currently supported by the HDF5 libraries.
attr_id
mem_type_id
buf
SUBROUTINE h5aread_f(attr_id, memtype_id, buf, dims, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype
! identifier (in memory)
TYPE, INTENT(INOUT) :: buf ! Data buffer; may be a scalar or
! an array
DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN) :: dims
! Array to hold corresponding
! dimension sizes of data buffer buf;
! dim(k) has value of the
! k-th dimension of buffer buf;
! values are ignored if buf is a
! scalar
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aread_f
H5Awrite(hid_t attr_id,
hid_t mem_type_id,
const void *buf
)
H5Awrite writes an attribute, specified with
attr_id. The attribute's memory datatype
is specified with mem_type_id. The entire
attribute is written from buf to the file.
Datatype conversion takes place at the time of a read or write and is automatic. See the Data Conversion section of The Data Type Interface (H5T) in the HDF5 User's Guide for a discussion of data conversion, including the range of conversions currently supported by the HDF5 libraries.
attr_id
mem_type_id
buf
SUBROUTINE h5awrite_f(attr_id, memtype_id, buf, dims, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype
! identifier (in memory)
TYPE, INTENT(IN) :: buf ! Data buffer; may be a scalar or
! an array
DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN) :: dims
! Array to hold corresponding
! dimension sizes of data buffer buf;
! dim(k) has value of the k-th
! dimension of buffer buf;
! values are ignored if buf is
! a scalar
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5awrite_f
|
HDF5 documents and links Introduction to HDF5 HDF5 User Guide |
And in this document, the
HDF5 Reference Manual
H5 H5A H5D H5E H5F H5G H5I H5P H5R H5S H5T H5Z Tools Datatypes |