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 Table (H5TB) Interface

## Detailed Description

See also
  HDF5 Table APIs (H5TB), C-HL API
  HDF5 High Level Table, User Guide

## Modules
module | h5tb
| This module contains Fortran interfaces for H5TB.

## Functions/Subroutines
subroutine | h5tbdelete_field_f (loc_id, dset_name, field_name, errcode)
| Deletes a field from a table.
subroutine | h5tbget_field_info_f (loc_id, dset_name, nfields, field_names, field_sizes, field_offsets, type_size, errcode, maxlen_out)
| Gets information about a table.
subroutine | h5tbget_table_info_f (loc_id, dset_name, nfields, nrecords, errcode)
| Gets the table dimensions.
subroutine | h5tbinsert_field_f (loc_id, dset_name, field_name, field_type, position, buf, errcode)
| Insert a new field into a table.
subroutine | h5tbmake_table_f (table_title, loc_id, dset_name, nfields, nrecords, type_size, field_names, field_offset, field_types, chunk_size, compress, errcode)
| Creates (DOES NOT WRITE) a dataset named `dset_name` attached to the object specified by the identifier `loc_id`.
subroutine | h5tbmake_table_f (table_title, loc_id, dset_name, nfields, nrecords, type_size, field_names, field_offset, field_types, chunk_size, fill_data, compress, data, errcode)
| Creates and writes a dataset named `dset_name` attached to the object specified by the identifier `loc_id`.
subroutine | h5tbread_field_index_f (loc_id, dset_name, field_index, start, nrecords, type_size, buf, errcode)
| Reads field. The fields are identified by index.
subroutine | h5tbread_field_name_f (loc_id, dset_name, field_name, start, nrecords, type_size, buf, errcode)
| Reads one or several fields. The fields are identified by name.
subroutine | h5tbread_table_f (loc_id, dset_name, nfields, dst_size, dst_offset, dst_sizes, dst_buf, errcode)
| Reads a table.
subroutine | h5tbwrite_field_index_f (loc_id, dset_name, field_index, start, nrecords, type_size, buf, errcode)
| Overwrites a field.
subroutine | h5tbwrite_field_name_f (loc_id, dset_name, field_name, start, nrecords, type_size, buf, errcode)
| Overwrites field.

## Function/Subroutine Documentation

## ◆ h5tbdelete_field_f()

subroutine h5tbdelete_field_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | character(len=*), intent(in) | field_name,
|  | integer | errcode )

Deletes a field from a table.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the table.
  field_name | The name of the field to delete.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5TBdelete_field()

## ◆ h5tbget_field_info_f()

subroutine h5tbget_field_info_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(in) | nfields,
|  | character(len=*), dimension(nfields), intent(inout) | field_names,
|  | integer(size_t), dimension(nfields), intent(inout) | field_sizes,
|  | integer(size_t), dimension(nfields), intent(inout) | field_offsets,
|  | integer(size_t), intent(inout) | type_size,
|  | integer | errcode,
|  | integer(size_t), optional | maxlen_out )

Gets information about a table.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to read.
  nfields | The number of fields.
  field_names | An array of character buffers to receive the field names. Each element must be declared with at least HLTB_MAX_FIELD_LEN_F characters. Field names longer than HLTB_MAX_FIELD_LEN_F - 1 characters are silently truncated. A truncated name may inadvertently match a different, shorter field when subsequently passed to h5tbread_fields_name_f() or h5tbwrite_fields_name_f().
  field_sizes | An array containing the size of the fields.
  field_offsets | An array containing the offsets of the fields.
  type_size | The size of the HDF5 datatype associated with the table (i.e., the size in bytes of the HDF5 compound datatype used to define a row, or record, in the table).
  errcode | Returns 0 if successful and -1 if it fails.
  maxlen_out | Maximum character length of the field names.

See C API: H5TBget_field_info()

## ◆ h5tbget_table_info_f()

subroutine h5tbget_table_info_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(inout) | nfields,
|  | integer(hsize_t), intent(inout) | nrecords,
|  | integer | errcode )

Gets the table dimensions.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to read.
  nfields | The number of fields.
  nrecords | The number of records.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5TBget_table_info()

## ◆ h5tbinsert_field_f()

subroutine h5tbinsert_field_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | character(len=*), intent(in) | field_name,
|  | integer(hid_t), intent(in) | field_type,
|  | integer, intent(in) | position,
|  | type(type), dimension(*), intent(in) | buf,
|  | integer | errcode )

Insert a new field into a table.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the table.
  field_name | The name of the field to insert.
  field_type | The data type of the field.
  position | The zero based index position where to insert the field.
  buf | Buffer with data.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5TBinsert_field()

## ◆ h5tbmake_table_f() [1/2]

subroutine h5tbmake_table_f | ( | character(len=*), intent(in) | table_title,
|  | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(in) | nfields,
|  | integer(hsize_t), intent(in) | nrecords,
|  | integer(size_t), intent(in) | type_size,
|  | character(len=*), dimension(1:nfields), intent(in) | field_names,
|  | integer(size_t), dimension(1:nfields), intent(in) | field_offset,
|  | integer(hid_t), dimension(1:nfields), intent(in) | field_types,
|  | integer(hsize_t), intent(in) | chunk_size,
|  | integer, intent(in) | compress,
|  | integer | errcode )

Creates (DOES NOT WRITE) a dataset named `dset_name` attached to the object specified by the identifier `loc_id`.

Attention
  Obsolete API, use the Fortran 2003 version instead.

Parameters

  table_title | The title of the table.
  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create.
  nfields | The number of fields.
  nrecords | The number of records.
  type_size | The size in bytes of the structure associated with the table. Obtained with sizeof or storage_size.
  field_names | An array containing the names of the fields. Names longer than HLTB_MAX_FIELD_LEN_F - 1 characters are silently truncated when read back by h5tbget_field_info_f().
  field_offset | An array containing the offsets of the fields.
  field_types | An array containing the type of the fields.
  chunk_size | The chunk size.
  compress | Flag that turns compression on or off.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5TBmake_table()

## ◆ h5tbmake_table_f() [2/2]

subroutine h5tbmake_table_f | ( | character(len=*), intent(in) | table_title,
|  | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(in) | nfields,
|  | integer(hsize_t), intent(in) | nrecords,
|  | integer(size_t), intent(in) | type_size,
|  | character(len=*), dimension(1:nfields), intent(in) | field_names,
|  | integer(size_t), dimension(1:nfields), intent(in) | field_offset,
|  | integer(hid_t), dimension(1:nfields), intent(in) | field_types,
|  | integer(hsize_t), intent(in) | chunk_size,
|  | type(c_ptr), intent(in) | fill_data,
|  | integer, intent(in) | compress,
|  | type(c_ptr), intent(in) | data,
|  | integer | errcode )

Creates and writes a dataset named `dset_name` attached to the object specified by the identifier `loc_id`.

Attention
  The preferred API, Fortran 2003 version.

Parameters

  table_title | The title of the table
  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to create
  nfields | The number of fields
  nrecords | The number of records
  type_size | The size in bytes of the structure associated with the table; This value is obtained with sizeof().
  field_names | An array containing the names of the fields. Names longer than HLTB_MAX_FIELD_LEN_F - 1 characters are silently truncated when read back by h5tbget_field_info_f().
  field_offset | An array containing the offsets of the fields
  field_types | An array containing the type of the fields
  chunk_size | The chunk size
  fill_data | Fill values data
  compress | Flag that turns compression on or off
  data | Buffer with data to be written to the table
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5TBmake_table()

## ◆ h5tbread_field_index_f()

subroutine h5tbread_field_index_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer, intent(in) | field_index,
|  | integer(hsize_t), intent(in) | start,
|  | integer(hsize_t), intent(in) | nrecords,
|  | integer(size_t), intent(in) | type_size,
|  | type(type), dimension(*), intent(inout) | buf,
|  | integer | errcode )

Reads field. The fields are identified by index.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to read.
  field_index | The indexes of the fields to read.
  start | The start record to read from.
  nrecords | The number of records to read.
  type_size | The size in bytes of the structure associated with the table. Obtained with sizeof or storage_size.
  buf | Buffer with data.
  errcode | Returns 0 if successful and -1 if it fails.

See similar C API: H5TBread_fields_index()

## ◆ h5tbread_field_name_f()

subroutine h5tbread_field_name_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | character(len=*), intent(in) | field_name,
|  | integer(hsize_t), intent(in) | start,
|  | integer(hsize_t), intent(in) | nrecords,
|  | integer(size_t), intent(in) | type_size,
|  | type(type), dimension(*), intent(inout) | buf,
|  | integer | errcode )

Reads one or several fields. The fields are identified by name.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to read.
  field_name | An array containing the names of the fields to read.
  start | The start record to read from.
  nrecords | The number of records to read.
  type_size | The size in bytes of the structure associated with the table. Obtained with sizeof or storage_size.
  buf | Buffer with data
  errcode | Returns 0 if successful and -1 if it fails.

See similar C API: H5TBread_fields_name()

## ◆ h5tbread_table_f()

subroutine h5tbread_table_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer(hsize_t), intent(in) | nfields,
|  | integer(size_t), intent(in) | dst_size,
|  | integer(size_t), dimension(1:nfields), intent(in) | dst_offset,
|  | integer(size_t), dimension(1:nfields), intent(in) | dst_sizes,
|  | type(c_ptr) | dst_buf,
|  | integer | errcode )

Reads a table.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to read
  nfields | Number of fields, i.e., size of dst_offset and dst_sizes arrays.
  dst_size | The size of the structure type, as calculated by sizeof or storage_size
  dst_offset | An array containing the offsets of the fields. These offsets can be calculated with H5OFFSETOF.
  dst_sizes | An array containing the sizes of the fields. These sizes can be calculated with sizeof or storage_size.
  dst_buf | Pointer to buffer with data.
  errcode | Returns 0 if successful and -1 if it fails.

See C API: H5TBread_table()

## ◆ h5tbwrite_field_index_f()

subroutine h5tbwrite_field_index_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | integer, intent(in) | field_index,
|  | integer(hsize_t), intent(in) | start,
|  | integer(hsize_t), intent(in) | nrecords,
|  | integer(size_t), intent(in) | type_size,
|  | integer, dimension(*), intent(in) | buf,
|  | integer | errcode )

Overwrites a field.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to overwrite.
  field_index | The indexe of the fields to write.
  start | The zero based index record to start writing.
  nrecords | The number of records to write.
  type_size | The size of the structure type, as calculated by sizeof or storage_size.
  buf | Buffer with data.
  errcode | Returns 0 if successful and -1 if it fails.

See similar C API: H5TBwrite_fields_index()

## ◆ h5tbwrite_field_name_f()

subroutine h5tbwrite_field_name_f | ( | integer(hid_t), intent(in) | loc_id,
|  | character(len=*), intent(in) | dset_name,
|  | character(len=*), intent(in) | field_name,
|  | integer(hsize_t), intent(in) | start,
|  | integer(hsize_t), intent(in) | nrecords,
|  | integer(size_t), intent(in) | type_size,
|  | type(type), dimension(*), intent(in) | buf,
|  | integer | errcode )

Overwrites field.

Parameters

  loc_id | Location identifier. The identifier may be that of a file or group.
  dset_name | The name of the dataset to overwrite
  field_name | The names of the fields to write
  start | The zero index record to start writing
  nrecords | The number of records to write
  type_size | The size of the structure type, as calculated by sizeof or storage_size.
  buf | Buffer with data.
  errcode | Returns 0 if successful and -1 if it fails.

See similar C API: H5TBwrite_fields_name()