HDF5 documents and links Introduction to HDF5 HDF5 User Guide Other High-level API documents |
And in this document, the
HDF5 Reference Manual
H5DS H5IM H5LT H5PT H5TB H5 H5A H5D H5E H5F H5G H5I H5L H5O H5P H5R H5S H5T H5Z Tools Datatypes |
The HDF5 Lite API consists of higher-level functions which do more operations per call than the basic HDF5 interface. The purpose is to wrap intuitive functions around certain sets of features in the existing APIs. This version of the API has two sets of functions: dataset and attribute related functions.
The following functions are part of the HDF5 Lite API.
The C Interfaces:
The FORTRAN90 Interfaces:
In general, each FORTRAN90 subroutine performs exactly the same task
as the corresponding C function. There are four types supported: integer
,
real, double precision
and character
array. The
<TYPE> notation below is one of these four types. The
corresponding C functions are for the int, float, double
and string
cases.
Dataset functions
|
Attribute functions
|
type_id
.
H5LT
make_dataset
creates and writes a
dataset named dset_name
attached to the object specified
by the identifier loc_id
. The parameter
type_id
can be any valid HDF5
predefined native datatype, for example H5T_NATIVE_INT
.
hid_t loc_id |
IN: Identifier of the file or group to create the dataset within. |
const char *dset_name |
IN: The name of the dataset to create. |
int rank |
IN: Number of dimensions of dataspace. |
const hsize_t * dims |
IN: An array of the size of each dimension. |
hid_t type_id |
IN: Identifier of the datatype to use when creating the dataset. |
const void * buffer |
IN: Buffer with data to be written to the dataset. |
subroutine h5ltmake_dataset_f(loc_id, dset_name, rank, dims, type_id, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer, intent(IN) :: rank ! rank integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the bufffer buf integer(HID_T), intent(IN) :: type_id ! datatype identifier <TYPE>, intent(IN), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltmake_dataset_f
H5LT
make_dataset_char
creates and writes
a dataset named dset_name
attached to the object specified
by the identifier loc_id
. The HDF5 datatype is
H5T_NATIVE_CHAR.
hid_t loc_id |
IN: Identifier of the file or group to create the dataset within. |
const char *dset_name |
IN: The name of the dataset to create. |
int rank |
IN: Number of dimensions of dataspace. |
const hsize_t * dims |
IN: An array of the size of each dimension. |
const char * buffer |
IN: Buffer with data to be written to the dataset. |
H5LTmake_dataset_short
creates and writes a dataset
named dset_name
attached to the object specified by the
identifier loc_id
. The HDF5 datatype is H5T_NATIVE_SHORT.
hid_t loc_id |
IN: Identifier of the file or group to create the dataset within. |
const char *dset_name |
IN: The name of the dataset to create. |
int rank |
IN: Number of dimensions of dataspace. |
const hsize_t * dims |
IN: An array of the size of each dimension. |
const short * buffer |
IN: Buffer with data to be written to the dataset. |
H5LTmake_dataset_int
creates and writes a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_INT. loc_id
dset_name
rank
dims
buffer
subroutine h5ltmake_dataset_int_f(loc_id, dset_name, rank, dims, buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer, intent(IN) :: rank ! rank integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf integer, intent(IN), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltmake_dataset_int_f
H5LTmake_dataset
creates and writes a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_LONG. loc_id
dset_name
rank
dims
buffer
H5LTmake_dataset
creates and writes a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_FLOAT. loc_id
dset_name
rank
dims
buffer
subroutine h5ltmake_dataset_float_f(loc_id, dset_name, rank, dims, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer, intent(IN) :: rank ! rank integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf real, intent(IN), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltmake_dataset_float_f
H5LTmake_dataset
creates and writes a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_DOUBLE. loc_id
dset_name
rank
dims
buffer
subroutine h5ltmake_dataset_double_f(loc_id, dset_name, rank, dims, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer, intent(IN) :: rank ! rank integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf double precision, intent(IN), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltmake_dataset_double_f
H5LTmake_dataset_string
creates and writes a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_C_S1. loc_id
dset_name
buffer
subroutine h5ltmake_dataset_string_f(loc_id, dset_name, buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltmake_dataset_string_f
H5LT
read_dataset
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. loc_id
dset_name
type_id
buffer
subroutine h5ltread_dataset_f(loc_id, dset_name, type_id, buf, dims, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer(HID_T), intent(IN) :: type_id ! datatype identifier integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf <TYPE>, intent(INOUT), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltread_dataset_f
H5LTread_dataset_char
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_CHAR. loc_id
dset_name
buffer
H5LTread_dataset_short
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_SHORT. loc_id
dset_name
buffer
H5LTread_dataset_int
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_INT. loc_id
dset_name
buffer
subroutine h5ltread_dataset_int_f(loc_id, dset_name, type_id, buf, & dims, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer(HID_T), intent(IN) :: type_id ! datatype identifier integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf integer, intent(INOUT), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltread_dataset_int_f
H5LTread_dataset_long
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_LONG. loc_id
dset_name
buffer
H5LTread_dataset
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_FLOAT. loc_id
dset_name
buffer
subroutine h5ltread_dataset_float_f(loc_id, dset_name, type_id, buf, & dims, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer(HID_T), intent(IN) :: type_id ! datatype identifier integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf real, intent(INOUT), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltread_dataset_float_f
H5LTread_dataset
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_NATIVE_DOUBLE. loc_id
dset_name
buffer
subroutine h5ltread_dataset_double_f(loc_id, dset_name, type_id, buf, & dims, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer(HID_T), intent(IN) :: type_id ! datatype identifier integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf double precision, intent(INOUT), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltread_dataset_double_f
H5LTread_dataset_string
reads a dataset named dset_name
attached to
the object specified by the identifier loc_id
. The HDF5
datatype is H5T_C_S1. loc_id
dset_name
buffer
subroutine h5ltread_dataset_string_f(loc_id, dset_name, type_id, buf, & dims, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer(HID_T), intent(IN) :: type_id ! datatype identifier integer(HSIZE_T), dimension(*), intent(IN) :: dims ! size of the buffer buf character(LEN=*), intent(INOUT), dimension(*) :: buf ! data buffer integer :: errcode ! error code end subroutine h5ltread_dataset_string_f
H5LT
find_dataset
inquires if a dataset named dset_name
exists attached to the object loc_id
.loc_id
dset_name
integer function h5ltfind_dataset_f(loc_id, dset_name, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer :: errcode ! error code end function h5ltfind_dataset_f
H5LT
get_dataset_ndims
gets the dimensionality of a dataset named dset_name
exists attached to the object loc_id
.loc_id
dset_name
rank
subroutine h5ltget_dataset_ndims_f(loc_id, dset_name, rank, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer, intent(INOUT) :: rank ! rank integer :: errcode ! error code end subroutine h5ltget_dataset_ndims_f
H5LT
get_dataset_info
gets information about a dataset named dset_name
exists attached to the object loc_id
.loc_id
dset_name
dims
class_id
type_size
subroutine h5ltget_dataset_info_f(loc_id, dset_name, dims, type_class, & type_size, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset integer(HSIZE_T),dimension(*),intent(INOUT):: dims ! dimensions integer, intent(INOUT) :: type_class ! type class integer(SIZE_T), intent(INOUT) :: type_size ! type size integer :: errcode ! error code end subroutine h5ltget_dataset_info_f
H5LT
attach_attribute
creates and writes a string attribute named attr_name
and
attaches it to the object specified by the name obj_name
. If the attribute already exists, it is overwritten.loc_id
obj_name
attr_name
attr_data
subroutine h5ltset_attribute_string_f(loc_id, dset_name, attr_name, & buf, errcode ) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code character(LEN=*), intent(IN) :: buf ! data buffer end subroutine h5ltset_attribute_string_f
H5LT
set_attribute_char
creates and writes a numerical attribute named attr_name
and
attaches it to the object specified by the name obj_name
. The attribute has
a dimensionality of 1. The HDF5
datatype of the attribute is H5T_NATIVE_CHAR.loc_id
obj_name
attr_name
buffer
size
H5Screate_simple
to create the
dataspace.H5LTset_attribute_short
creates and writes a numerical attribute named attr_name
and
attaches it to the object specified by the name obj_name
. The attribute has
a dimensionality of 1. The HDF5
datatype of the attribute is H5T_NATIVE_SHORT.loc_id
obj_name
attr_name
buffer
size
H5Screate_simple
to create the
dataspace.H5LTset_attribute_int
creates and writes a numerical integer attribute named attr_name
and
attaches it to the object specified by the name obj_name
. The attribute has
a dimensionality of 1. The HDF5
datatype of the attribute is H5T_NATIVE_INT.loc_id
obj_name
attr_name
buffer
size
H5Screate_simple
to create the
dataspace.subroutine h5ltset_attribute_int_f(loc_id, dset_name, attr_name, buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code integer, intent(IN), dimension(*) :: buf ! data buffer end subroutine h5ltset_attribute_int_f
H5LTset_attribute_long
creates and writes a numerical attribute named attr_name
and
attaches it to the object specified by the name obj_name
. The attribute has
a dimensionality of 1. The HDF5
datatype of the attribute is H5T_NATIVE_LONG.loc_id
obj_name
attr_name
buffer
size
H5Screate_simple
to create the
dataspace.H5LTset_attribute_long_long
(hid_t
loc_id
, const char *obj_name
,
const char *attr_name
,
const long_long *data
, size_t
size
)
H5LTset_attribute_long_long
creates and writes
an attribute with a long long the datatype.
hid_t loc_id |
Location of the object to which the attribute is to be attached. |
const char *obj_name |
That object's name. |
const char *attr_name |
Attribute name. |
const long_long *data |
Attribute value. |
size_t size |
Attribute size. |
H5LT
set_attribute_float
creates and writes a numerical floating point attribute named attr_name
and
attaches it to the object specified by the name obj_name
. The attribute has
a dimensionality of 1. The HDF5
datatype of the attribute is H5T_NATIVE_FLOAT.loc_id
obj_name
attr_name
buffer
size
H5Screate_simple
to create the
dataspace.subroutine h5ltset_attribute_float_f(loc_id, dset_name, attr_name, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code real, intent(INOUT), dimension(*) :: buf ! data buffer end subroutine h5ltset_attribute_float_f
H5LTset_attribute_double
creates and writes a numerical attribute named attr_name
and
attaches it to the object specified by the name obj_name
. The attribute has
a dimensionality of 1. The HDF5
datatype of the attribute is H5T_NATIVE_DOUBLE.loc_id
obj_name
attr_name
buffer
size
H5Screate_simple
to create the
dataspace.subroutine h5ltset_attribute_double_f(loc_id, dset_name, attr_name, & buf, errcode ) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code double precision, intent(INOUT), dimension(*) :: buf ! data buffer end subroutine h5ltset_attribute_double_f
H5LT
get_attribute
reads an attribute named attr_name
with the memory type mem_type_id.
loc_id
obj_name
attr_name
mem_type_id
data
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
loc_id
obj_name
attr_name
data
subroutine h5ltget_attribute_string_f(loc_id, dset_name, attr_name, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code character(LEN=*), intent(INOUT) :: buf ! data buffer end subroutine h5ltget_attribute_string_f
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
The HDF5
datatype of the attribute is H5T_NATIVE_CHAR. loc_id
obj_name
attr_name
data
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
The HDF5
datatype of the attribute is H5T_NATIVE_SHORT. loc_id
obj_name
attr_name
data
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
The HDF5
datatype of the attribute is H5T_NATIVE_INT. loc_id
obj_name
attr_name
data
subroutine h5ltget_attribute_int_f(loc_id, dset_name, attr_name, buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code integer, intent(IN), dimension(*) :: buf ! data buffer end subroutine h5ltget_attribute_int_f
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
The HDF5
datatype of the attribute is H5T_NATIVE_LONG. loc_id
obj_name
attr_name
data
H5LTget_attribute_long_long
(hid_t
loc_id
, const char *obj_name
,
const char *attr_name
,
long_long *data
)
H5LTget_attribute_long_long
reads the attribute
specified by loc_id
and obj_name
.
hid_t loc_id |
Location of the object to which the attribute is attached. |
const char *obj_name |
That object's name. |
const char *attr_name |
Attribute name. |
long_long *data |
Attribute value. |
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
The HDF5
datatype of the attribute is H5T_NATIVE_FLOAT. loc_id
obj_name
attr_name
data
subroutine h5ltget_attribute_float_f(loc_id, dset_name, attr_name, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code real, intent(IN), dimension(*) :: buf ! data buffer end subroutine h5ltget_attribute_float_f
H5LTget_attribute
reads an attribute named attr_name
that is attached to the object specified by the name obj_name.
The HDF5
datatype of the attribute is H5T_NATIVE_DOUBLE. loc_id
obj_name
attr_name
data
subroutine h5ltget_attribute_double_f(loc_id, dset_name, attr_name, & buf, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer :: errcode ! error code double precision, intent(IN), dimension(*) :: buf ! data buffer end subroutine h5ltget_attribute_double_f
H5LT
get_attribute_ndims
gets the dimensionality of an attribute named attr_name
that is
attached to the object specified by the name obj_name.
loc_id
obj_name
attr_name
rank
subroutine h5ltget_attribute_ndims_f(loc_id, dset_name, attr_name, & rank, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer, intent(INOUT) :: rank ! rank integer :: errcode ! error code integer :: namelen ! name length integer :: attrlen ! name length end subroutine h5ltget_attribute_ndims_f
H5LT
get_attribute_info
gets information about an attribute named attr_name
attached to the object specified by the name obj_name.
loc_id
obj_name
attr_name
dims
type_class
type_size
subroutine h5ltget_attribute_info_f(loc_id, dset_name, attr_name, & dims, type_class, type_size, errcode) implicit none integer(HID_T), intent(IN) :: loc_id ! file or group identifier character(LEN=*), intent(IN) :: dset_name ! name of the dataset character(LEN=*), intent(IN) :: attr_name ! name of the attribute integer(HSIZE_T),dimension(*),intent(INOUT):: dims ! dimensions integer, intent(INOUT) :: type_class ! type class integer(SIZE_T), intent(INOUT) :: type_size ! type size integer :: errcode ! error code end subroutine h5ltget_attribute_info_f
H5LTcreate_compound_type
creates a compound type. nfields
field_names[]
field_types
nfields
nrecords
H5LTtext_to_dtype
(
const char *text
, H5LT_lang_t
lang_type
)
lang_type
definition of HDF5 datatypes. Currently,
only the DDL(H5LT_DDL
) is supported. The complete
DDL definition of HDF5 datatypes can be found in the last
chapter of the HDF5 User’s Guide.
An example of DDL definition of enum
type is
shown as follows.
“H5T_ENUM { H5T_NATIVE_INT; “Bob” 0; “Elena” 1; “Quincey” 2; “Frank” 3; }”
const char *str |
IN: A character string containing a DDL definition of the datatype to be created. |
H5LT_lang_t lang_type |
IN: The language used to describe the datatype.
The only currently supported language
is H5LT_DDL . |
H5LTtype_to_text
(hid_t
datatype
, char* str
,
H5LT_lang_t lang_type
,
size_t* len
)
lang_type
language
format.
A preliminary H5LTdtype_to_text
call can be made
to determine the size of the buffer needed with a NULL
passed in for str
. This value is returned as len
.
That value can then be assigned to len
for a second
H5Ttype_to_text
call, which will retrieve the actual text
description for the datatype.
If len
is not big enough for the description,
the text description will be truncated to fit in the buffer.
Currently only DDL (H5LT_DDL
) is supported for
lang_type
. The complete DDL definition of HDF5 data
types can be found in the last chapter of the HDF5 User’s Guide.
An example of DDL definition of enum
type is shown as follows.
“H5T_ENUM { H5T_NATIVE_INT; “Bob” 0; “Elena” 1; “Quincey” 2; “Frank” 3; }”
hid_t datatype |
IN: Identifier of the datatype to be converted. |
char* str |
OUT: Buffer for the text description of the datatype. |
H5LT_lang_t lang_type |
IN: The language used to describe the datatype.
The currently supported language is H5LT_DDL. |
size_t* len |
OUT: the size of buffer needed to store the text description. |
HDF5 documents and links Introduction to HDF5 HDF5 User Guide Other High-level API documents |
And in this document, the
HDF5 Reference Manual
H5DS H5IM H5LT H5PT H5TB H5 H5A H5D H5E H5F H5G H5I H5L H5O H5P H5R H5S H5T H5Z Tools Datatypes |