Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-07-28 The HDF5 Field Guide

Loading...
Searching...
No Matches
Fortran High Level Lite (H5LT) Interface

## Detailed Description

See also
  HDF5 Lite APIs (H5LT,H5LD), C-HL API
  HDF5 High Level Lite, User Guide

## Functions/Subroutines
integer function | h5ltfind_dataset_f (loc_id, dset_name)
| Determines whether a dataset exists.
subroutine | h5ltget_attribute_double_f (loc_id, obj_name, attr_name, buf, errcode)
| Reads an attribute from disk.
subroutine | h5ltget_attribute_f (loc_id, obj_name, attr_name, buf, buf_type, sizeof_buf_type, errcode)
| Reads an attribute from disk.
subroutine | h5ltget_attribute_float_f (loc_id, obj_name, attr_name, buf, errcode)
| Reads an attribute from disk.
subroutine | h5ltget_attribute_info_f (loc_id, obj_name, attr_name, dims, type_class, type_size, errcode)
| Gets information about an attribute.
subroutine | h5ltget_attribute_int_f (loc_id, obj_name, attr_name, buf, errcode)
| Reads an attribute from disk.
subroutine | h5ltget_attribute_ndims_f (loc_id, obj_name, attr_name, rank, errcode)
| Gets the dimensionality of an attribute.
subroutine | h5ltget_attribute_string_f (loc_id, obj_name, attr_name, buf, errcode)
| Reads an attribute from disk.
subroutine | h5ltget_dataset_info_f (loc_id, dset_name, dims, type_class, type_size, errcode)
| Retrieves information about a dataset.
subroutine | h5ltget_dataset_ndims_f (loc_id, dset_name, rank, errcode)
| Gets the dimensionality of a dataset.
subroutine | h5ltmake_dataset_f (loc_id, dset_name, rank, dims, type_id, buf, errcode)
| Creates and writes a dataset of a type `type_id`.
subroutine | h5ltmake_dataset_f (loc_id, dset_name, rank, dims, type_id, buf, errcode)
| Creates and writes a dataset of a type `type_id`.
subroutine | h5ltpath_valid_f (loc_id, path, check_object_valid, path_valid, errcode)
| Determines whether an HDF5 path is valid and, optionally, whether the path resolves to an HDF5 object.
subroutine | h5ltread_dataset_f (loc_id, dset_name, type_id, buf, dims, errcode)
| Reads a dataset of a type `type_id`.
subroutine | h5ltread_dataset_f (loc_id, dset_name, type_id, buf, errcode)
| Reads a dataset of a type `type_id`.
subroutine | h5ltset_attribute_double_f (loc_id, obj_name, attr_name, buf, size, errcode)
| Creates and writes an attribute.
subroutine | h5ltset_attribute_f (loc_id, dset_name, attr_name, buf, buf_type, sizeof_buf_type, size, errcode)
| 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.
subroutine | h5ltset_attribute_float_f (loc_id, obj_name, attr_name, buf, size, errcode)
| Creates and writes an attribute.
subroutine | h5ltset_attribute_int_f (loc_id, obj_name, attr_name, buf, size, errcode)
| Creates and writes an attribute.
subroutine | h5ltset_attribute_string_f (loc_id, obj_name, attr_name, buf, errcode)
| Creates and writes an attribute.

## Function/Subroutine Documentation

## ◆ h5ltfind_dataset_f()

integer function h5ltfind_dataset_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name )

Determines whether a dataset exists.

Parameters

  loc_id | Identifier of the group containing the dataset.
  dset_name | The dataset name.

Returns
  Returns zero (false), a positive (true) or a negative (failure) value.

See C API: H5LTfind_dataset()

## ◆ h5ltget_attribute_double_f()

subroutine h5ltget_attribute_double_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | real(kind=c_double), dimension(*), intent(inout), target | buf,
|  | integer | errcode )

Reads an attribute from disk.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute_double()

## ◆ h5ltget_attribute_f()

subroutine h5ltget_attribute_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | type(c_ptr) | buf,
|  | character(len=*), intent(in) | buf_type,
|  | integer(size_t), intent(in) | sizeof_buf_type,
|  | integer, intent(out) | errcode )

Reads an attribute from disk.

Attention
  The preferred API, Fortran 2003 version.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The name of the attribute to create.
  buf | The data buffer.
  buf_type | Valid data types are CHARACTER, INTEGER or REAL. NOTE: only the first character matters and is case insensitive.
  SizeOf_buf_type | Size of `buf's` data type, in bytes.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute()

## ◆ h5ltget_attribute_float_f()

subroutine h5ltget_attribute_float_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | real(kind=c_float), dimension(*), intent(inout), target | buf,
|  | integer | errcode )

Reads an attribute from disk.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute_float()

## ◆ h5ltget_attribute_info_f()

subroutine h5ltget_attribute_info_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | integer(hsize_t), dimension(*), intent(inout) | dims,
|  | integer, intent(inout) | type_class,
|  | integer(size_t), intent(inout) | type_size,
|  | integer | errcode )

Gets information about an attribute.

Parameters

  loc_id | Identifier of the object (dataset or group) to read the attribute from.
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The attribute name.
  dims | The dimensions of the attribute.
  type_class | The class identifier. For a list of valid class types see: H5Tget_class_f().
  type_size | The size of the datatype in bytes.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute_info()

## ◆ h5ltget_attribute_int_f()

subroutine h5ltget_attribute_int_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | integer, dimension(*), intent(inout), target | buf,
|  | integer | errcode )

Reads an attribute from disk.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute_int()

## ◆ h5ltget_attribute_ndims_f()

subroutine h5ltget_attribute_ndims_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | integer, intent(inout) | rank,
|  | integer | errcode )

Gets the dimensionality of an attribute.

Parameters

  loc_id | Identifier of the object (dataset or group) to read the attribute from.
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The attribute name.
  rank | The dimensionality of the attribute.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute_ndims()

## ◆ h5ltget_attribute_string_f()

subroutine h5ltget_attribute_string_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | character(len=*), intent(inout) | buf,
|  | integer | errcode )

Reads an attribute from disk.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object that the attribute is attached to.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_attribute_string()

## ◆ h5ltget_dataset_info_f()

subroutine h5ltget_dataset_info_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), dimension(*), intent(inout) | dims,
|  | integer, intent(inout) | type_class,
|  | integer(size_t), intent(inout) | type_size,
|  | integer | errcode )

Retrieves information about a dataset.

Parameters

  loc_id | Identifier of the object to locate the dataset within.
  dset_name | The dataset name.
  dims | The dimensions of the dataset.
  type_class | The class identifier. See H5Tget_class_f() for a list of class types.
  type_size | The size of the datatype in bytes.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_dataset_info()

## ◆ h5ltget_dataset_ndims_f()

subroutine h5ltget_dataset_ndims_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer, intent(inout) | rank,
|  | integer | errcode )

Gets the dimensionality of a dataset.

Parameters

  loc_id | Identifier of the object to locate the dataset within.
  dset_name | The dataset name.
  rank | The dimensionality of the dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTget_dataset_ndims()

## ◆ h5ltmake_dataset_f() [1/2]

subroutine h5ltmake_dataset_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer, intent(in) | rank,
|  | integer(hsize_t), dimension(*), intent(in) | dims,
|  | integer(hid_t), intent(in) | type_id,
|  | type(type), dimension(*,*,...), intent(in) | buf,
|  | integer | errcode )

Creates and writes a dataset of a type `type_id`.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  rank | Number of dimensions of dataspace.
  dims | An array of the size of each dimension. Limited to seven dimensions.
  type_id | Identifier of the datatype to use when creating the dataset.
  buf | Buffer with data to be written to the dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTmake_dataset()

## ◆ h5ltmake_dataset_f() [2/2]

subroutine h5ltmake_dataset_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer, intent(in) | rank,
|  | integer(hsize_t), dimension(*), intent(in) | dims,
|  | integer(hid_t), intent(in) | type_id,
|  | type(c_ptr) | buf,
|  | integer | errcode )

Creates and writes a dataset of a type `type_id`.

Attention
  The preferred API, Fortran 2003 version.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  rank | Number of dimensions of dataspace.
  dims | An array of the size of each dimension.
  type_id | Identifier of the datatype to use when creating the dataset.
  buf | Buffer with data to be written to the dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTmake_dataset()

## ◆ h5ltpath_valid_f()

subroutine h5ltpath_valid_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | path,
|  | logical, intent(in) | check_object_valid,
|  | logical, intent(out) | path_valid,
|  | integer, intent(out) | errcode )

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

Parameters

  loc_id | Identifier of an object in the file.
  path | The path to the object to check; links in path may be of any type.
  check_object_valid | Indicates whether to check if the final component of the path resolves to a valid object.
  path_valid | Object status.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTpath_valid()

## ◆ h5ltread_dataset_f() [1/2]

subroutine h5ltread_dataset_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hid_t), intent(in) | type_id,
|  | type(type), dimension(*,*,...), intent(inout) | buf,
|  | integer(hsize_t), dimension(*), intent(in) | dims,
|  | integer | errcode )

Reads a dataset of a type `type_id`.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  type_id | Identifier of the datatype to use when creating the dataset.
  buf | Buffer with data to be written to the dataset.
  dims | An array of the size of each dimension. Limited to seven dimensions.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTread_dataset()

## ◆ h5ltread_dataset_f() [2/2]

subroutine h5ltread_dataset_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hid_t), intent(in) | type_id,
|  | type(c_ptr) | buf,
|  | integer | errcode )

Reads a dataset of a type `type_id`.

Attention
  The preferred API, Fortran 2003 version.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  type_id | Identifier of the datatype to use when creating the dataset.
  buf | Buffer with data to be written to the dataset.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTread_dataset()

## ◆ h5ltset_attribute_double_f()

subroutine h5ltset_attribute_double_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | real(kind=c_double), dimension(*), intent(in), target | buf,
|  | integer(size_t), intent(in) | size,
|  | integer | errcode )

Creates and writes an attribute.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object to attach the attribute.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  size | 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.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTset_attribute_double()

## ◆ h5ltset_attribute_f()

subroutine h5ltset_attribute_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | character(len=*), intent(in) | attr_name,
|  | type(c_ptr) | buf,
|  | character(len=*), intent(in) | buf_type,
|  | integer(size_t), intent(in) | sizeof_buf_type,
|  | integer(size_t), intent(in) | size,
|  | integer, intent(out) | errcode )

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.

Attention
  The preferred API, Fortran 2003 version.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  attr_name | The name of the attribute to create.
  buf | The data buffer.
  buf_type | Valid data types are CHARACTER, INTEGER or REAL. NOTE: only the first character matters and is case insensitive.
  SizeOf_buf_type | Size of `buf's` data type, in bytes.
  size | Size of attribute array.
  errcode | Returns 0 if successful and -1 if it fails.

## ◆ h5ltset_attribute_float_f()

subroutine h5ltset_attribute_float_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | real(kind=c_float), dimension(*), intent(in), target | buf,
|  | integer(size_t), intent(in) | size,
|  | integer | errcode )

Creates and writes an attribute.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object to attach the attribute.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  size | 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.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTset_attribute_float()

## ◆ h5ltset_attribute_int_f()

subroutine h5ltset_attribute_int_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | integer, dimension(*), target | buf,
|  | integer(size_t), intent(in) | size,
|  | integer | errcode )

Creates and writes an attribute.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object to attach the attribute.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  size | 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.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTset_attribute_int()

## ◆ h5ltset_attribute_string_f()

subroutine h5ltset_attribute_string_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | obj_name,
|  | character(len=*), intent(in) | attr_name,
|  | character(len=*), dimension(*), intent(in), target | buf,
|  | integer | errcode )

Creates and writes an attribute.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  loc_id | Identifier of the object (dataset or group) to create the attribute within
  obj_name | The name of the object to attach the attribute.
  attr_name | The attribute name.
  buf | Buffer with data to be written to the attribute.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5LTset_attribute_string()