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

| HDF5 Last Updated on 2026-03-23 The HDF5 Field Guide

Loading...
Searching...
No Matches
Array Datatypes
Datatypes (H5T)

## Detailed Description

## Macros
#define | H5Tarray_create H5Tarray_create2
#define | H5Tget_array_dims H5Tget_array_dims2

## Functions
hid_t | H5Tarray_create1 (hid_t base_id, int ndims, const hsize_t dim[], const int perm[])
| Creates an array datatype object.
hid_t | H5Tarray_create2 (hid_t base_id, unsigned ndims, const hsize_t dim[])
| Creates an array datatype object.
int | H5Tget_array_dims1 (hid_t type_id, hsize_t dims[], int perm[])
| Retrieves sizes of array dimensions.
int | H5Tget_array_dims2 (hid_t type_id, hsize_t dims[])
| Retrieves sizes of array dimensions.
int | H5Tget_array_ndims (hid_t type_id)
| Returns the rank of an array datatype.

## Macro Definition Documentation

## ◆ H5Tarray_create

#define H5Tarray_create H5Tarray_create2

H5Tarray_create() is a macro that is mapped to either H5Tarray_create1() or H5Tarray_create2().

See also
  API Compatibility Macros

## ◆ H5Tget_array_dims

#define H5Tget_array_dims H5Tget_array_dims2

H5Tget_array_dims() is a macro that is mapped to either H5Tget_array_dims1() or H5Tget_array_dims2().

See also
  API Compatibility Macros

## Function Documentation

## ◆ H5Tarray_create1()

hid_t H5Tarray_create1 | ( | hid_t | base_id,
|  | int | ndims,
|  | const hsize_t | dim[],
|  | const int | perm[] )

Creates an array datatype object.

Parameters

  [in] | base_id | Datatype identifier for the array base datatype
  [in] | ndims | Rank of the array
  [in] | dim | Size of each array dimension
  [in] | perm | Dimension permutation (Currently not implemented.)

Returns
  Returns a array datatype identifier if successful; otherwise returns H5I_INVALID_HID.

Deprecated
  This function has been renamed from H5Tarray_create() and is deprecated in favor of the macro H5Tarray_create or the function H5Tarray_create2().

H5Tarray_create1() creates a new array datatype object.
`base_id` is the datatype of every element of the array, i.e., of the number at each position in the array.

`rank` is the number of dimensions and the size of each dimension is specified in the array dims. The value of rank is currently limited to H5S_MAX_RANK and must be greater than 0 (zero). All dimension sizes specified in dims must be greater than 0 (zero).

The array `perm` is designed to contain the dimension permutation, i.e. C versus FORTRAN array order. (The parameter perm is currently unused and is not yet implemented.)

Version
  1.8.0 Function H5Tarray_create() renamed to H5Tarray_create1() and deprecated in this release.

Since
  1.4.0

## ◆ H5Tarray_create2()

hid_t H5Tarray_create2 | ( | hid_t | base_id,
|  | unsigned | ndims,
|  | const hsize_t | dim[] )

Creates an array datatype object.

Parameters

  [in] | base_id | Datatype identifier for the array base datatype
  [in] | ndims | Rank of the array
  [in] | dim | Size of each array dimension

Returns
  Returns a array datatype identifier if successful; otherwise returns H5I_INVALID_HID.

H5Tarray_create2() creates a new array datatype object.
`base_id` is the datatype of every element of the array, i.e., of the number at each position in the array.

`ndims` is the number of dimensions and the size of each dimension is specified in the array `dim`. The value of `rank` is currently limited to H5S_MAX_RANK and must be greater than 0 (zero). All dimension sizes specified in `dim` must be greater than 0 (zero).

Since
  1.8.0

## ◆ H5Tget_array_dims1()

int H5Tget_array_dims1 | ( | hid_t | type_id,
|  | hsize_t | dims[],
|  | int | perm[] )

Retrieves sizes of array dimensions.

Parameters

  [in] | type_id | Datatype identifier
  [out] | dims | Sizes of array dimensions
  [out] | perm | Dimension permutations (This parameter is not used.)

Returns
  Returns the non-negative number of dimensions of the array type if successful; otherwise, returns a negative value.

Deprecated
  This function has been renamed from H5Tget_array_dims() and is deprecated in favor of the macro H5Tget_array_dims or the function H5Tget_array_dims2().

H5Tget_array_dims1() returns the sizes of the dimensions and the dimension permutations of the specified array datatype object.

The sizes of the dimensions are returned in the array `dims`.

Version
  1.8.0 Function H5Tarray_create() renamed to H5Tarray_create1() and deprecated in this release.

Since
  1.4.0

## ◆ H5Tget_array_dims2()

int H5Tget_array_dims2 | ( | hid_t | type_id,
|  | hsize_t | dims[] )

Retrieves sizes of array dimensions.

Parameters

  [in] | type_id | Datatype identifier
  [out] | dims | Sizes of array dimensions

Returns
  Returns the non-negative number of dimensions of the array type if successful; otherwise returns a negative value.

H5Tget_array_dims2() returns the sizes of the dimensions of the specified array datatype object in the array `dims`.

Since
  1.2.0

## ◆ H5Tget_array_ndims()

int H5Tget_array_ndims | ( | hid_t | type_id | ) |

Returns the rank of an array datatype.

Parameters

  [in] | type_id | Datatype identifier

Returns
  Returns the rank of the array if successful; otherwise returns a negative value.

H5Tget_array_ndims() returns the rank, i.e., the number of dimensions, of an array datatype object.

Since
  1.2.0