HDF5 documents and links 
Introduction to HDF5 
HDF5 User’s Guide 
Other High-level API documents
In the HDF5 Reference Manual  
H5DS   H5IM   H5LT   H5PT   H5TB   Optimized 
H5   H5A   H5D   H5E   H5F   H5G   H5I   H5L  
H5O   H5P   H5PL   H5R   H5S   H5T   H5Z  
Tools   Datatypes   Fortran  

H5LT: HDF5 Lite

HDF5 Lite API Reference

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.

Programming Hints:

To use any of these functions or subroutines, you must first include the relevant include file (C) or module (Fortran) in your application.

The following line includes the HDF5 Lite package, H5LT, in C applications:
         #include "hdf5_hl.h"

This line includes the H5LT module in Fortran applications:
         use h5lt

The C Interfaces:

Path and object function

Query path and object function

File image function

Open file image function

Dataset functions

Make dataset functions

Read dataset functions

Query dataset functions

Dataset watch functions

Datatype functions

Datatype translation functions

Attribute functions

Set attribute functions

Get attribute functions

Query attribute functions

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.

Path and object function

Query path and object function

Dataset functions

Make dataset functions

Read dataset functions

Query dataset functions

Attribute functions

Set attribute functions

Get attribute functions

Query attribute functions

 


Last modified: 1 April 2016
Name: H5LTpath_valid

Signature:
htri_t H5LTpath_valid ( hid_t loc_id, const char *path, hbool_t check_object_valid)

Purpose:
Determines whether an HDF5 path is valid and, optionally, whether the path resolves to an HDF5 object.

Description:
H5LTpath_valid checks the validity of path relative to the identifier of an object, loc_id. Optionally, check_object_valid can be set to determine whether the final component of path resolves to an HDF5 object; if not, the final component is a dangling link.

The meaning of the function’s return value depends on the value of check_object_valid:
If check_object_valid is set to FALSE,   H5LTpath_valid will check all links in path to verify that they exist. If all the links in path exist, the function will return TRUE; otherwise the function will return FALSE.

If check_object_valid is set to TRUE,   H5LTpath_valid will first check the links in path, as described above. If all the links exist, check_object_valid will then determine whether the final component of path resolves to an actual HDF5 object. H5LTpath_valid will return TRUE if all the links in path exist and the final component resolves to an actual object; otherwise, it will return FALSE.

path can be any one of the following:

If path is an absolute path, then loc_id can be an identifier for any object in the file as it is used only to identify the file. If path is a relative path, then loc_id must be a file or a group identifier.


Note on Behavior Change:
The behavior of H5LTpath_valid was changed in the 1.10.0 release in the case where the root group, “/”, is the value of path. This change is described below:
  1. Let loc_id denote a valid HDF5 file identifier, and let check_object_valid be set to true or false. A call to H5LTpath_valid with arguments loc_id, “/”, and check_object_valid returns a positive value; in other words, H5LTpath_valid(loc_id, "/", check_object_valid) returns a positive value. In HDF5 version 1.8.16, this function returns 0.
  2. Let ‘root’ denote a valid HDF5 group identifier that refers to the root group of an HDF5 file, and let check_object_valid be set to true or false. A call to H5LTpath_valid with arguments ‘root’, “/”, and check_object_valid returns a positive value; in other words, H5LTpath_valid(root, "/", check_object_valid) returns a postive value. In HDF5 version 1.8.16, this function returns 0.

Parameters:
hid_t loc_id IN: An identifier of an object in the file.
const char *path IN: The path to the object to check.
Links in path may be of any type.
hbool_t check_object_valid    IN: If TRUE, determine whether the final component of path resolves to an object; if FALSE, do not check.

Returns:
Upon success:
If check_object_valid is set to FALSE
Returns TRUE if the path is valid; otherwise returns FALSE.
If check_object_valid is set to TRUE
Returns TRUE if the path is valid and resolves to an HDF5 object; otherwise returns FALSE.
Upon error, returns a negative value.

Fortran90 Interface: h5ltpath_valid_f
SUBROUTINE h5ltpath_valid_f(loc_id, path, check_object_valid, path_valid, &
                            errcode)
   INTEGER(HID_T)  , INTENT(IN)  :: loc_id       ! An identifier of an object 
                                                 ! in the file
   CHARACTER(LEN=*), INTENT(IN)  :: path         ! Path to the object to check, 
                                                 ! relative to loc_id
   LOGICAL         , INTENT(IN)  :: check_object_valid  
                                                 ! Indicates whether to determine 
                                                 ! whether final component of path
                                                 ! resolves to an object 
   LOGICAL         , INTENT(OUT) :: path_valid   ! Object status
   INTEGER         , INTENT(OUT) :: errcode      ! Error code: 0 on success 
                                                 ! and -1 on failure
END SUBROUTINE h5ltpath_valid_f 

History:
Release     Change
1.10.0 Function behavior changed in this release. See the “Note on Behavior Change” section above.


Last modified: 17 April 2012
Name: H5LTopen_file_image
Signature:
hid_t H5LTopen_file_image( void *buf_ptr, size_t buf_size, unsigned flags )

Purpose:
Opens an HDF5 file image in memory.

Motivation:
H5LTopen_file_image and other elements of HDF5 are used to load an image of an HDF5 file into system memory and open that image as a regular HDF5 file. An application can then use the file without the overhead of disk I/O.

Recommended Reading:
This function is part of the file image operations feature set. It is highly recommended to study the guide “HDF5 File Image Operations” before using this feature set.

See the “See Also” section below for links to other elements of HDF5 file image operations.

Description:
H5LTopen_file_image opens the HDF5 file image that is located in system memory at the address indicated by buf_ptr of size buf_size. H5LTopen_file_image opens a file image with the Core driver, H5FD_CORE.

The flags passed in flags specify whether to open the image read-only or read/write, whether HDF5 is to take control of the buffer, and instruction regarding releasing the buffer.

Parameters:
void *buf_ptr      IN: A pointer to the supplied initial image

A value of NULL is invalid and will cause the function to fail.

size_t buf_size   IN: Size of the supplied buffer

A value of 0 is invalid and will cause the function to fail.

unsigned flags   IN: Flags specifying whether to open the image read-only or read/write, whether HDF5 is to take control of the buffer, and instruction regarding releasing the buffer

Valid values are:

H5LT_FILE_IMAGE_OPEN_RW
Specifies opening the file image in read/write mode.

Default without this flag: File image will be opened read-only.

H5LT_FILE_IMAGE_DONT_COPY
Specifies to not copy the provided file image buffer; the buffer will be used directly. HDF5 will release the file image when finished.

Default without this flag: Copy the file image buffer and open the copied file image.

H5LT_FILE_IMAGE_DONT_RELEASE
Specifies that HDF5 is not to release the buffer when the file opened with H5LTopen_file_image is closed; releasing the buffer will be left to the application.

Default without this flag: HDF5 will automatically release the file image buffer after the file image is closed.

This flag is valid only when used with H5LT_FILE_IMAGE_DONT_COPY.

Returns:
Returns a file identifier if successful; otherwise returns a negative value.

Failure Modes:
H5LTopen_file_image will fail if either buf_ptr is NULL or buf_size equals 0 (zero).

See Also:
H5Fget_file_image
 
H5Pset_file_image
H5Pget_file_image
 
H5Pset_file_image_callbacks
H5Pget_file_image_callbacks
     HDF5 File Image Operations
     in Advanced Topics in HDF5
 
Within H5Pset_file_image_callbacks:
Callback struct   H5_file_image_callbacks_t
Callback ENUM   H5_file_image_op_t

History:
Release     Change
1.8.9 C function introduced in this release.

Name: H5LTmake_dataset
Signature:
herr_t H5LTmake_dataset ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, hid_t type_id, const void *buffer )

 

Purpose:
Creates and writes a dataset of a type type_id.

 

Description:
H5LTmake_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, setting type_id to H5T_NATIVE_INT will result in a dataset of signed integer datatype.

 

Parameters:
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.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltmake_dataset_f
This subroutine can create and write a dataset of up to seven (7) dimensions.
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                               

 

Fortran2003 Interface: h5ltmake_dataset_f
This subroutine can create and write a dataset of any rank.
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(C_PTR), intent(IN) :: buf                  ! data buffer 
  integer :: errcode                              ! error code
end subroutine h5ltmake_dataset_f                               

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.
1.10.0 Fortran 2003 subroutine added to accept a C address of the data buffer.

Name: H5LTmake_dataset_char
Signature:
herr_t H5LTmake_dataset_char ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const char *buffer )

 

Purpose:
Creates and writes a dataset.

 

Description:
H5LTmake_dataset_char creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be character, H5T_NATIVE_CHAR.

 

Parameters:
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.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTmake_dataset_short
Signature:
herr_t H5LTmake_dataset_short ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const short *buffer )

 

Purpose:
Creates and writes a dataset.

 

Description:
H5LTmake_dataset_short creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be short signed integer, H5T_NATIVE_SHORT.

 

Parameters:
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.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTmake_dataset_int
Signature:
herr_t H5LTmake_dataset_int ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const int *buffer )

 

Purpose:
Creates and writes a dataset.

 

Description:
H5LTmake_dataset_int creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be native signed integer, H5T_NATIVE_INT.

 

Parameters:
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 int * buffer
IN: Buffer with data to be written to the dataset.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltmake_dataset_int_f
This subroutine can create and write a dataset of up to seven (7) dimensions.
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                                  

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.

Name: H5LTmake_dataset_long
Signature:
herr_t H5LTmake_dataset_long ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const long *buffer )

 

Purpose:
Creates and writes a dataset.

 

Description:
H5LTmake_dataset creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be long signed integer, H5T_NATIVE_LONG.

 

Parameters:
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 long * buffer
IN: Buffer with data to be written to the dataset.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTmake_dataset_float
Signature:
herr_t H5LTmake_dataset_float ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const float *buffer )

 

Purpose:
Creates and writes a dataset.

 

Description:
H5LTmake_dataset creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be native floating point, H5T_NATIVE_FLOAT.

 

Parameters:
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 float * buffer
IN: Buffer with data to be written to the dataset.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltmake_dataset_float_f
This subroutine can create and write a dataset of up to seven (7) dimensions.
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                                

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.

Name: H5LTmake_dataset_double
Signature:
herr_t H5LTmake_dataset_double ( hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const double *buffer )

 

Purpose:
Creates and writes a dataset.

 

Description:
H5LTmake_dataset creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be native floating-point double, H5T_NATIVE_DOUBLE.

 

Parameters:
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 double * buffer
IN: Buffer with data to be written to the dataset.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltmake_dataset_double_f
This subroutine can create and write a dataset of up to seven (7) dimensions.
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                              

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.

Name: H5LTmake_dataset_string
Signature:
herr_t H5LTmake_dataset_string ( hid_t loc_id, const char *dset_name, const char *buffer )

 

Purpose:
Creates and writes a dataset with string datatype.

 

Description:
H5LTmake_dataset_string creates and writes a dataset named dset_name attached to the object specified by the identifier loc_id.

The dataset’s datatype will be C string, H5T_C_S1.

 

Parameters:
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.
const char * buffer
IN: Buffer with data to be written to the dataset.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltmake_dataset_string_f
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                             

Name: H5LTread_dataset
Signature:
herr_t H5LTread_dataset ( hid_t loc_id, const char *dset_name, hid_t type_id, void *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
H5LTread_dataset reads a dataset named dset_name attached to the object specified by the identifier loc_id.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
hid_t type_id
IN: Identifier of the datatype to use when reading the dataset.
void * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltread_dataset_f
This subroutine can read a dataset of up to seven (7) dimensions.
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
      

 

Fortran2003 Interface: h5ltread_dataset_f
This subroutine can read a dataset of any rank.
subroutine h5ltread_dataset_f(loc_id, dset_name, 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(HID_T), intent(IN) :: type_id              ! datatype identifier
  type(C_PTR) :: buf                                 ! data buffer 
  integer :: errcode                                 ! error code
end subroutine h5ltread_dataset_f
      

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.
1.10.0 Fortran 2003 subroutine added to accept a C address of the data buffer.

Name: H5LTread_dataset_char
Signature:
herr_t H5LTread_dataset_char ( hid_t loc_id, const char *dset_name, char *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
char * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTread_dataset_short
Signature:
herr_t H5LTread_dataset_short ( hid_t loc_id, const char *dset_name, short *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
short * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Last modified: 21 January 2013
Name: H5LTread_dataset_int
Signature:
herr_t H5LTread_dataset_int ( hid_t loc_id, const char *dset_name, int *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
int * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltread_dataset_int_f
This subroutine can read a dataset of up to seven (7) dimensions.
subroutine h5ltread_dataset_int_f(loc_id, dset_name, 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(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
      

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.

Name: H5LTread_dataset_long
Signature:
herr_t H5LTread_dataset_long ( hid_t loc_id, const char *dset_name, long *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
long * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Last modified: 21 January 2013
Name: H5LTread_dataset_float
Signature:
herr_t H5LTread_dataset_float ( hid_t loc_id, const char *dset_name, float *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
float * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltread_dataset_float_f
This subroutine can read a dataset of up to seven (7) dimensions.
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(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
      

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.

Last modified: 11 May 2016
Name: H5LTread_dataset_double
Signature:
herr_t H5LTread_dataset_double ( hid_t loc_id, const char *dset_name, double *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
double * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltread_dataset_double_f
This subroutine can read a dataset of up to seven (7) dimensions.
subroutine h5ltread_dataset_double_f(loc_id, dset_name, 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(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
      

 

History:
Release     Change
1.8.7 Fortran subroutine modified in this release to accomodate arrays with more than three dimensions.

Name: H5LTread_dataset_string
Signature:
herr_t H5LTread_dataset_string ( hid_t loc_id, const char *dset_name, char *buffer )

 

Purpose:
Reads a dataset from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the file or group to read the dataset within.
const char *dset_name
IN: The name of the dataset to read.
double * buffer
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltread_dataset_string_f
subroutine h5ltread_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(inout) :: buf         ! data buffer
  integer :: errcode                             ! error code
end subroutine h5ltread_dataset_string_f
      

Name: H5LTfind_dataset
Signature:
herr_t H5LTfind_dataset ( hid_t loc_id, const char *dset_name )

 

Purpose:
Determines whether a dataset exists.

 

Description:
H5LTfind_dataset determines whether a dataset named dset_name exists in the group specified by loc_id.

loc_id must be a group identifier and dset_name must specify a dataset that is a member of that group.

 

Parameters:
hid_t loc_id
IN: Identifier of the group containing the dataset.
const char *dset_name
IN: Dataset name.

 

Returns:
Returns 1 if the dataset exists, returns 0 otherwise.

 

Fortran90 Interface: h5ltfind_dataset_f
integer function h5ltfind_dataset_f(loc_id, dset_name)
  implicit none
  integer(HID_T), intent(IN) :: loc_id               ! group identifier 
  character(LEN=*), intent(IN) :: dset_name          ! name of the dataset 
end function h5ltfind_dataset_f
      
An error code is passed back in the function’s return value.



Name: H5LTget_dataset_ndims
Signature:
herr_t H5LTget_dataset_ndims ( hid_t loc_id, const char *dset_name, int *rank )

 

Purpose:
Gets the dimensionality of a dataset.

 

Description:
H5LTget_dataset_ndims gets the dimensionality of a dataset named dset_name exists attached to the object loc_id.

 

Parameters:
hid_t loc_id
IN: Identifier of the object to locate the dataset within.
const char *dset_name
IN: The dataset name.
int * rank
OUT: The dimensionality of the dataset.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_dataset_ndims_f
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
      

Name: H5LTget_dataset_info
Signature:
herr_t H5LTget_dataset_info ( hid_t loc_id, const char *dset_name, hsize_t *dims, H5T_class_t *class_id, size_t *type_size )

 

Purpose:
Gets information about a dataset.

 

Description:
H5LTget_dataset_info gets information about a dataset named dset_name exists attached to the object loc_id.

 

Parameters:
hid_t loc_id
IN: Identifier of the object to locate the dataset within.
const char *dset_name
IN: The dataset name.
hsize_t * dims
OUT: The dimensions of the dataset.
H5T_class_t * class_id
OUT: The class identifier. To a list of the HDF5 class types please refer to the Datatype Interface API help.
size_t * type_size
OUT: The size of the datatype in bytes.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_dataset_info_f
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
      

Name: H5LTset_attribute_string
Signature:
herr_t H5LTset_attribute_string( hid_t loc_id, const char *obj_name, const char *attr_name, const char *attr_data )

 

Purpose:
Creates and writes a string attribute.

 

Description:
H5LTattach_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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object (dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
const char * attr_data
IN: Buffer with data to be written to the attribute.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltset_attribute_string_f
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
      

Name: H5LTset_attribute_char
Signature:
herr_t H5LTset_attribute_char ( hid_t loc_id, const char *obj_name, const char *attr_name, char *buffer, hsize_t size)

 

Purpose:
Creates and writes an attribute.

 

Description:
H5LTset_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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
char * buffer
IN: Buffer with data to be written to the attribute.
hsize_t size
IN: The size of the 1D array (one in the case of a scalar attribute). This value is used by H5Screate_simple to create the dataspace.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTset_attribute_uchar

 

See H5LTset_attribute_char. This function is the unsigned version and it uses the H5T_NATIVE_UCHAR datatype instead.

Name: H5LTset_attribute_short
Signature:
herr_t H5LTset_attribute_short ( hid_t loc_id, const char *obj_name, const char *attr_name, short *buffer, hsize_t size)

 

Purpose:
Creates and writes an attribute.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
short * buffer
IN: Buffer with data to be written to the attribute.
hsize_t size
IN: The size of the 1D array (one in the case of a scalar attribute). This value is used by H5Screate_simple to create the dataspace.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTset_attribute_ushort

 

See H5LTset_attribute_short. This function is the unsigned version and it uses the H5T_NATIVE_USHORT datatype instead.

Name: H5LTset_attribute_int
Signature:
herr_t H5LTset_attribute_int( hid_t loc_id, const char *obj_name, const char *attr_name, int *buffer, size_t size)

 

Purpose:
Creates and writes an attribute.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
int * buffer
IN: Buffer with data to be written to the attribute.
hsize_t size
IN: The size of the 1D array (one in the case of a scalar attribute). This value is used by H5Screate_simple to create the dataspace.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltset_attribute_int_f
subroutine h5ltset_attribute_int_f(loc_id, dset_name, attr_name, buf, &
                                   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, intent(IN), dimension(*) :: buf     ! data buffer
  integer(size_t), intent(IN) :: size          ! size of attribute array
  integer :: errcode                           ! error code
end subroutine h5ltset_attribute_int_f
      

Name: H5LTset_attribute_uint

 

See H5LTset_attribute_int. This function is the unsigned version and it uses the H5T_NATIVE_UINT datatype instead.

Name: H5LTset_attribute_long
Signature:
herr_t H5LTset_attribute_long ( hid_t loc_id, const char *obj_name, const char *attr_name, long *buffer, hsize_t size)

 

Purpose:
Creates and writes an attribute.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
long * buffer
IN: Buffer with data to be written to the attribute.
hsize_t size
IN: The size of the 1D array (one in the case of a scalar attribute). This value is used by H5Screate_simple to create the dataspace.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTset_attribute_long_long
Signature:
herr_t H5LTset_attribute_long_long (hid_t loc_id, const char *obj_name, const char *attr_name, const long_long *data, size_t size)

 

Purpose:
Creates and writes an attribute.

 

Description:
H5LTset_attribute_long_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 and its HDF5 datatype is H5T_NATIVE_LLONG.

 

Parameters:

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTset_attribute_ulong

 

See H5LTset_attribute_long. This function is the unsigned version and it uses the H5T_NATIVE_ULONG datatype instead.

Name: H5LTset_attribute_float
Signature:
herr_t H5LTset_attribute_float( hid_t loc_id, const char *obj_name, const char *attr_name, float *buffer, hsize_t size )

 

Purpose:
Creates and writes an attribute.

 

Description:
H5LTset_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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
float * buffer
IN: Buffer with data to be written to the attribute.
hsize_t size
IN: The size of the 1D array (one in the case of a scalar attribute). This value is used by H5Screate_simple to create the dataspace.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltset_attribute_float_f
subroutine h5ltset_attribute_float_f(loc_id, dset_name, attr_name, &
                                     buf, 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
  real, intent(INOUT), dimension(*) :: buf       ! data buffer
  integer(size_t),  intent(in) :: size           ! size of attribute array
  integer :: errcode                             ! error code
end subroutine h5ltset_attribute_float_f
      

Name: H5LTset_attribute_double
Signature:
herr_t H5LTset_attribute_double ( hid_t loc_id, const char *obj_name, const char *attr_name, const double *buffer, size_t size )

 

Purpose:
Creates and writes an attribute.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to create the attribute within.
const char *obj_name
IN: The name of the object to attach the attribute.
const char *attr_name
IN: The attribute name.
const double * buffer
IN: Buffer with data to be written to the attribute.
size_t size
IN: The size of the 1D array (one in the case of a scalar attribute). This value is used by H5Screate_simple to create the dataspace.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltset_attribute_double_f
subroutine h5ltset_attribute_double_f(loc_id, dset_name, attr_name, &
                                      buf, 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(size_t), intent(IN) :: size            ! size of attribute array
  integer :: errcode                             ! error code
  double precision, intent(INOUT), dimension(*) :: buf  
                                                 ! data buffer
end subroutine h5ltset_attribute_double_f
      

Name: H5LTset_attribute_f

 

Purpose:
Creates and writes an attribute and is a generic replacement for data type specific Fortran h5ltset_attribute_*_f APIs. There is no C equivalent API.

 

Fortran Interface: h5ltset_attribute_f
subroutine h5ltset_attribute_f(loc_id, dset_name, attr_name, &
                                      buf, buf_type, SizeOf_buf_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
  type(C_PTR) :: buf                              ! data buffer
  character(LEN=*), INTENT(in) :: buf_type        ! valid data types are:
                                                  !    CHARACTER, INTEGER or REAL
                                                  !    NOTE: only the first character matters and is case insensitive 
  integer(size_t), intent(IN) :: size             ! size of attribute array
  integer(size_t),  intent(IN) :: SizeOf_buf_type ! size of buf's data type 
  integer :: errcode                              ! error code
end subroutine h5ltset_attribute_f
      

Name: H5LTget_attribute
Signature:
herr_t H5LTget_attribute( hid_t loc_id, const char *obj_name, const char *attr_name,  hid_t mem_type_id, void *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
H5LTget_attribute reads an attribute named attr_name with the memory type mem_type_id.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
hid_t mem_type_id
IN: Identifier of the memory datatype.
void * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran Interface: h5ltget_attribute_f
subroutine h5ltget_attribute_f(loc_id, dset_name, attr_name, buf, buf_type, SizeOf_buf_type, 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
  type(C_PTR) :: buf                               ! data buffer
  character(LEN=*), INTENT(in) :: buf_type         ! valid data types are:
                                                   !    CHARACTER, INTEGER or REAL
                                                   !    NOTE: only the first character matters and is case insensitive
  integer(size_t), INTENT(in) :: SizeOf_buf_type   ! size of buf's data type 
  integer :: errcode                               ! error code
end subroutine h5ltget_attribute_f
      

History:
Release     Change
1.10.0 Added Fortran interface.

Name: H5LTget_attribute_string
Signature:
herr_t H5LTget_attribute_string( hid_t loc_id, const char *obj_name, const char *attr_name,  char *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
H5LTget_attribute reads an attribute named attr_name that is attached to the object specified by the name obj_name.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
char * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_attribute_string_f
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
      

History:
Release     Change
1.8.9 The content of the buffer returned by the Fortran subroutine has changed in this release:
If the returned buffer requires padding, h5ltget_attribute_string_f now employs space padding; this buffer was previously returned with a C NULL terminator.

Name: H5LTget_attribute_char
Signature:
herr_t H5LTget_attribute( hid_t loc_id, const char *obj_name, const char *attr_name,  char *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
char * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTget_attribute_uchar

 

See H5LTget_attribute_char. This function is the unsigned version and it uses the H5T_NATIVE_UCHAR datatype instead.

Name: H5LTget_attribute_short
Signature:
herr_t H5LTget_attribute_short( hid_t loc_id, const char *obj_name, const char *attr_name,  short *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
short * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTget_attribute_ushort

 

See H5LTget_attribute_short. This function is the unsigned version and it uses the H5T_NATIVE_USHORT datatype instead.

Name: H5LTget_attribute_int
Signature:
herr_t H5LTget_attribute_int( hid_t loc_id, const char *obj_name, const char *attr_name,  int *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
int * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_attribute_int_f
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(INOUT), dimension(*) :: buf      ! data buffer
end subroutine h5ltget_attribute_int_f
      

 

Fortran90 Interface: h5ltget_attribute_int_f

Name: H5LTget_attribute_uint

 

See H5LTget_attribute_int. This function is the unsigned version and it uses the H5T_NATIVE_UINT datatype instead.

Name: H5LTget_attribute_long
Signature:
herr_t H5LTget_attribute_long( hid_t loc_id, const char *obj_name, const char *attr_name,  long *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
long * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTget_attribute_long_long
Signature:
herr_t H5LTget_attribute_long_long (hid_t loc_id, const char *obj_name, const char *attr_name, long_long *data)

 

Purpose:
Reads a long long attribute.

 

Description:
H5LTget_attribute_long_long reads the attribute specified by loc_id and obj_name.

 

Parameters:
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.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

Name: H5LTget_attribute_ulong

 

See H5LTget_attribute_long. This function is the unsigned version and it uses the H5T_NATIVE_ULONG datatype instead.

Name: H5LTget_attribute_float
Signature:
herr_t H5LTget_attribute_float( hid_t loc_id, const char *obj_name, const char *attr_name,  float *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
float * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_attribute_float_f
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(INOUT), dimension(*) :: buf       ! data buffer
end subroutine h5ltget_attribute_float_f
      

Name: H5LTget_attribute_double
Signature:
herr_t H5LTget_attribute_double( hid_t loc_id, const char *obj_name, const char *attr_name,  double *data )

 

Purpose:
Reads an attribute from disk.

 

Description:
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.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
double * data
OUT: Buffer with data.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_attribute_double_f
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(INOUT), dimension(*) :: buf  
                                                 ! data buffer
end subroutine h5ltget_attribute_double_f
      

Name: H5LTfind_attribute
Signature:
herr_t H5LTfind_attribute ( hid_t loc_id, const char *attr_name )

 

Purpose:
Determines whether an attribute exists.

 

Description:
H5LTfind_attribute determines whether an attribute named attr_name exists attached to the object specified by loc_id.

loc_id must be an object identifier and attr_name must specify an attribute that is expected to be attached to that object.

 

Parameters:
hid_t loc_id
IN: Identifier of the object to which the attribute is expected to be attached.
const char *attr_name
IN: Attribute name.

 

Returns:
Returns 1 if the attribute exists; returns 0 otherwise.

 

Fortran90 Interface:
None.

Name: H5LTget_attribute_ndims
Signature:
herr_t H5LTget_attribute_ndims( hid_t loc_id, const char *obj_name, const char *attr_name,  int *rank )

 

Purpose:
Gets the dimensionality of an attribute.

 

Description:
H5LTget_attribute_ndims gets the dimensionality of an attribute named attr_name that is attached to the object specified by the name obj_name.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
int * rank
OUT: The dimensionality of the attribute.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_attribute_ndims_f
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
      

Name: H5LTget_attribute_info
Signature:
herr_t H5LTget_attribute_info( hid_t loc_id, const char *obj_name, const char *attr_name,  hsize_t *dims, H5T_class_t *type_class, size_t *type_size )

 

Purpose:
Gets information about an attribute.

 

Description:
H5LTget_attribute_info gets information about an attribute named attr_name attached to the object specified by the name obj_name.

 

Parameters:
hid_t loc_id
IN: Identifier of the object ( dataset or group) to read the attribute from.
const char *obj_name
IN: The name of the object that the attribute is attached to.
const char *attr_name
IN: The attribute name.
hsize_t * dims
OUT: The dimensions of the attribute.
H5T_class_t * type_class
OUT: The class identifier. To a list of the HDF5 class types please refer to the Datatype Interface API help.
size_t * type_size
OUT: The size of the datatype in bytes.

 

Returns:
Returns a non-negative value if successful; otherwise returns a negative value.

 

Fortran90 Interface: h5ltget_attribute_info_f
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
      

Name: H5LTtext_to_dtype
Signature:
hid_t H5LTtext_to_dtype( const char *text, H5LT_lang_t lang_type)

 

Purpose:
Creates an HDF5 datatype given a text description.

 

Description:
Given a text description of a datatype, this function creates an HDF5 datatype and returns the datatype identifier. The text description of the datatype has to comply with the 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;      }”

 

Parameters:

 

Returns:
Returns the datatype identifier(non-negative) if successful; otherwise returns a negative value.

Name: H5LTdtype_to_text
Signature:
herr_t H5LTdtype_to_text(hid_t datatype, char* str, H5LT_lang_t lang_type, size_t* len)

 

Purpose:
Creates a text description of an HDF5 datatype.

 

Description:
Given an HDF5 datatype identifier, this function creates a description of this datatype in 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;      }”

 

Parameters:

 

Returns:
Returns non-negative if successful; otherwise returns a negative value.

Last modified: 25 May 2016

Name: H5LDget_dset_type_size

Signature:
size_t H5LDget_dset_type_size( hid_t dset_id, char *fields )

Purpose:
Returns the size in bytes of the dataset’s datatype.

Description:
This routine allows the user to find out the datatype size for the dataset associated with dset_id. If the parameter fields is NULL, this routine just returns the size of the dataset’s datatype. If the dataset has a compound datatype and fields is non-NULL, this routine returns the size of the datatype(s) for the selected fields specified in fields. Note that ’,’ is the separator for the fields of a compound datatype while ’.’ (dot) is the separator for a nested field. Use a backslash ( \ ) to escape characters in field names that conflict with these two separators.

Parameters:
hid_t dset_id    IN: The dataset identifier
char *fields IN: The pointer to a comma-separated list of fields for a compound datatype.

Returns:
If successful, returns the size in bytes of the dataset’s datatype. Otherwise, returns 0.

Example Usage:
See the examples in H5LDget_dset_elmts for the usage of this routine.

Fortran Interface:
None

See Also:

History:
Release     Change
1.10.0 C function introduced with this release.




Last modified: 25 May 2016

Name: H5LDget_dset_dims

Signature:
herr_t H5LDget_dset_dims( hid_t dset_id, hsize_t *cur_dims )

Purpose:
Retrieves the current dimension sizes of a dataset.

Description:
This routine retrieves the current dimension sizes for the dataset dset_id through the parameter cur_dims. It will return failure if cur_dims is NULL.

Parameters:
hid_t dset_id IN: The dataset identifier
hsize_t *cur_dims    OUT: The current dimension sizes of the dataset.

Returns:
If successful, returns zero. Otherwise, returns a negative value.

Example Usage:
See the examples in H5LDget_dset_elmts for the usage of this routine.

Fortran Interface:
None

See Also:

History:
Release     Change
1.10.0 C function introduced with this release.




Last modified: 25 May 2016

Name: H5LDget_dset_elmts

Signature:
herr_t H5LDget_dset_elmts( hid_t dset_id, hsize_t *prev_dims, hsize_t *cur_dims, char *fields, void *buf )

Purpose:
Retrieves selected data from the dataset.

Description:
This routine retrieves selected data of the dataset dset_id and stores the data in the parameter buf. The difference between the parameters prev_dims and cur_dims indicates the dimension sizes of the data to be selected from the dataset. Note that cur_dims must have at least one dimension whose size is greater than the corresponding dimension in prev_dims. Users can determine the size of buf by multipling the datatype size of the dataset by the number of selected elements.

If the parameter fields is NULL, this routine returns data for the selected elements of the dataset. If fields is not NULL and the dataset has a compound datatype, fields is a string containing a comma-separated list of fields. Each name in fields specifies a field in the compound datatype, and this routine returns data of the selected fields for the dataset's selected elements. Note that ’,’ is the separator for the fields of a compound datatype while ’.’ is the separator for a nested field. Use backslash to escape characters in field names that conflict with these two separators.


Parameters:
hid_t dset_id IN: The dataset identifier
hsize_t *prev_dims    IN: The previous dimension size of the dataset
hsize_t *cur_dims IN: The current dimension size of the dataset
char *fields IN: A string containing a comma-separated list of fields for a compound datatype.
void *buf OUT: Buffer for storing data retrieved from the dataset

Returns:
If successful, returns zero; otherwise returns a negative value.

Example Usage:
For the first example, DSET1 is a two-dimensional chunked dataset with atomic type defined below:
    DATASET "DSET1" {
	DATATYPE  H5T_STD_I32LE
	DATASPACE  SIMPLE { ( 4, 13 ) / ( 60, 100 ) }
	:
	:
    }
The following coding sample illustrates the reading of data elements appended to the dataset DSET1:
    /* open the HDF5 file */
    fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);

    /* open the dataset */
    did = H5Dopen2(fid, "DSET1", H5P_DEFAULT);
        :
        :
    /* define hsize_t dims[2]; */
    /* define hsize_t new_dims[2]; */
    /* get the dataset's current dimension sizes */
    H5LDget_dset_dims(did, dims);

    /* extend the dataset by 2 */
    new_dims[0] = dims[0] + 2; 
    new_dims[1] = dims[1] + 2;
    H5Dset_extent(did, new_dims) 
     
    /* write data to the extended dataset */
        :
        :
    /* get the size of the dataset's data type */
    type_size = H5LDget_dset_type_size(did, NULL);
        :
        :
    /* allocate buffer for storing selected data elements from the dataset */
    /* calculate # of selected elements from dims & new_dims */
    /* buffer size = type_size * number of selected elements */
        :
        :
    /* read the selected elements from the dataset into buf */
    H5LDget_dset_elmts(did, dims, new_dims, NULL, buf);
        :
        :
    H5Dclose(did);
    H5Fclose(fid);
The output buffer will contain data elements selected from DSET1 as follows:
    data for elements (0, 13), (0, 14) 
    data for elements (1, 13), (1, 14) 
    data for elements (2, 13), (2, 14) 
    data for elements (3, 13), (3, 14)
    data for elements (4, 0), (4, 1), (4, 2)......................(4, 13), (4, 14)
    data for elements (5, 0), (5, 1), (5, 2)......................(5, 13), (5, 14)
For the second example, DSET2 is a one-dimensional chunked dataset with compound type defined below:
    DATASET "DSET2" {
	DATATYPE  H5T_COMPOUND {
	    H5T_STD_I32LE "a";
	    H5T_STD_I32LE "b";
	    H5T_ARRAY { [4] H5T_STD_I32LE } "c";
	    H5T_STD_I32LE "d";
	    H5T_STD_I32LE "e";
	    H5T_COMPOUND {
		H5T_STD_I32LE "a";
		H5T_STD_I32LE "b";
		H5T_ARRAY {[4] H5T_STD_I32LE} "c";
		H5T_STD_I32LE "d";
		H5T_STD_I32LE "e";
	    } "s2";
	}
	DATASPACE  SIMPLE { ( 5 ) / ( 5 ) }
	:
	:
    }
The following coding sample illustrates the reading of data elements appended to the dataset DSET2 with compound datatype This example selects only 2 fields: the fourth field d and a subfield of the sixth field s2.c:
    /* open the HDF5 file */
    fid = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);

    /* open the dataset */
    did = H5Dopen2(fid, "DSET2", H5P_DEFAULT);

    /* define hsize_t dims[1]; */
    /* define hsize_t new_dims[1]; */
        :
        :
    /* get the dataset's current dimension size */
    H5LDget_dset_dims(did, dims);

    /* extend the dataset by 2 */
    new_dims[0] = dims[0] + 2;
    H5Dset_extent(did, new_dims);
        :
        :
    /* write data to the extended part of the dataset */
        :
        :
    /* #define fields "d,s2.c" */
    /* get the size of the dataset's data type for the selected fields */
    type_size = H5LDget_dset_type_size(did, fields);
        :
        :
    /* allocate buffer for storing selected data elements from the dataset */
    /* calculate # of selected elements from dims & new_dims */
    /* buffer size = type_size * number of selected elements */
        :        
        :
    /* read the selected elements from the dataset into buf */
    H5LD_get_dset_elmts(did, dims, new_dims, fields, buf);
        :
        :
    H5Dclose(did);
    H5Fclose(fid);
The output buffer will contain data for d and s2.c selected from DSET2 as follows:
    Data for element (5): integer value for "d", 4 integer values for array "s2.c"
    Data for element (6): integer value for "d", 4 integer values for array "s2.c"

Fortran Interface:
None

See Also:

History:
Release     Change
1.10.0 C function introduced with this release.




HDF5 documents and links 
Introduction to HDF5 
HDF5 User’s Guide 
Other High-level API documents
In the HDF5 Reference Manual  
H5DS   H5IM   H5LT   H5PT   H5TB   Optimized 
H5   H5A   H5D   H5E   H5F   H5G   H5I   H5L  
H5O   H5P   H5PL   H5R   H5S   H5T   H5Z  
Tools   Datatypes   Fortran  

The HDF Group Help Desk:
Describes HDF5 Release 1.10.
  Copyright by The HDF Group
and the Board of Trustees of the University of Illinois