HDF5 documents and links 
Introduction to HDF5 
HDF5 User’s Guide 
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   Compatibility Macros 
Collective Calls in Parallel 

H5D: Datasets Interface

Dataset Object API Functions

These functions create and manipulate dataset objects, and set and retrieve their constant or persistent properties.
In the following lists, italic type indicates a configurable macro.

The C Interfaces:
             
Use of these functions is deprecated in Release 1.8.0.

Alphabetical Listing
             

The Fortran Interface:
In general, each Fortran subroutine performs exactly the same task as the corresponding C function.
             


Name: H5Dclose
Signature:
herr_t H5Dclose(hid_t dataset_id )
Purpose:
Closes the specified dataset.
Description:
H5Dclose ends access to a dataset specified by dataset_id and releases resources used by it. Further use of the dataset identifier is illegal in calls to the dataset API.
Parameters:
Returns:
Returns a non-negative value if successful; otherwise returns a negative value.
Fortran90 Interface: h5dclose_f
SUBROUTINE h5dclose_f(dset_id, hdferr)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: dset_id ! Dataset identifier  
  INTEGER, INTENT(OUT) :: hdferr        ! Error code  
                                        ! 0 on success and -1 on failure
END SUBROUTINE h5dclose_f
	

Last modified: 9 October 2014
Name: H5Dcreate

Signature:
hid_t H5Dcreate( hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id )

hid_t H5Dcreate( hid_t loc_id, const char *name, hid_t dtype_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id )

Purpose:
Creates a new dataset and links it to a location in the file.

Description:
H5Dcreate is a macro that is mapped to either H5Dcreate1 or H5Dcreate2, depending on the needs of the application.

Such macros are provided to facilitate application compatibility. Their use and mappings are fully described in “API Compatibility Macros in HDF5”; we urge you to read that document closely.

When both the HDF5 Library and the application are built and installed with no specific compatibility flags, H5Dcreate is mapped to the most recent version of the function, currently H5Dcreate2. If the library and/or application is compiled for Release 1.6 emulation, H5Dcreate will be mapped to H5Dcreate1. Function-specific flags are available to override these settings on a function-by-function basis when the application is compiled.

Specific compile-time compatibility flags and the resulting mappings are as follows:

Compatibility setting H5Dcreate mapping

Global settings
No compatibility flag H5Dcreate2 
Enable deprecated symbols H5Dcreate2 
Disable deprecated symbols H5Dcreate2 
Emulate Release 1.6 interface     H5Dcreate1 

Function-level macros
H5Dcreate_vers = 2 H5Dcreate2
H5Dcreate_vers = 1 H5Dcreate1

A dataset created with this macro should be closed with H5Dclose when the dataset is no longer needed so that resource leaks will not develop.

Fortran90 Interface: h5dcreate_f
SUBROUTINE h5dcreate_f(loc_id, name, type_id, space_id, dset_id, & 
     hdferr, dcpl_id, lcpl_id, dapl_id)

  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
  CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the dataset 
  INTEGER(HID_T), INTENT(IN) :: type_id  ! Datatype identifier 
  INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier 
  INTEGER(HID_T), INTENT(OUT) :: dset_id ! Dataset identifier 
  INTEGER, INTENT(OUT) :: hdferr         ! Error code  
                                         ! 0 on success and -1 on failure
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dcpl_id 
                                         ! Dataset creation property list
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: lcpl_id 
                                         ! Link creation property list
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dapl_id 
                                         ! Dataset access property list
END SUBROUTINE h5dcreate_f
See Also:
“Using Identifiers”

History:
Release     C
1.8.0 The function H5Dcreate renamed to H5Dcreate1 and deprecated in this release.
The macro H5Dcreate and the function H5Dcreate2 introduced in this release.

Last modified: 29 July 2009
Name: H5Dcreate1
Signature:
hid_t H5Dcreate1( hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id )
Purpose:
Creates a dataset at the specified location.
Notice:
This function is deprecated in favor of the function H5Dcreate2 or the macro H5Dcreate.
Description:
H5Dcreate1 creates a data set with a name, name, in the file or in the group specified by the identifier loc_id.

name can be a relative path based at loc_id or an absolute path from the root of the file. Use of this function requires that any intermediate groups specified in the path already exist.

The dataset’s datatype and dataspace are specified by type_id and space_id, respectively. These are the datatype and dataspace of the dataset as it will exist in the file, which may differ from the datatype and dataspace in application memory.

Names within a group are unique: H5Dcreate1 will return an error if a link with the name specified in name already exists at the location specified in loc_id.

As is the case for any object in a group, the length of a dataset name is not limited.

dcpl_id is an H5P_DATASET_CREATE property list created with H5Pcreate1 and initialized with various property list functions described in “H5P: Property List Interface.”

H5Dcreate and H5Dcreate_anon return an error if the dataset’s datatype includes a variable-length (VL) datatype and the fill value is undefined, i.e., set to NULL in the dataset creation property list. Such a VL datatype may be directly included, indirectly included as part of a compound or array datatype, or indirectly included as part of a nested compound or array datatype.

H5Dcreate and H5Dcreate_anon return a dataset identifier for success or a negative value for failure. The dataset identifier should eventually be closed by calling H5Dclose to release resources it uses.

See H5Dcreate_anon for discussion of the differences between H5Dcreate and H5Dcreate_anon.

Fill values and space allocation:
The HDF5 library provides flexible means of specifying a fill value, of specifying when space will be allocated for a dataset, and of specifying when fill values will be written to a dataset. For further information on these topics, see the document Fill Value and Dataset Storage Allocation Issues in HDF5 and the descriptions of the following HDF5 functions in this HDF5 Reference Manual:
  H5Dfill
H5Pset_fill_value
H5Pget_fill_value
H5Pfill_value_defined
H5Pset_fill_time
H5Pget_fill_time
H5Pset_alloc_time
H5Pget_alloc_time
This information is also included in the “HDF5 Datasets” chapter of the new HDF5 User's Guide, which is being prepared for release.

Note:
H5Dcreate and H5Dcreate_anon can fail if there has been an error in setting up an element of the dataset creation property list. In such cases, each item in the property list must be examined to ensure that the setup satisfies all required conditions. This problem is most likely to occur with the use of filters.

For example, either function will fail without a meaningful explanation if the following conditions exist simultaneously:

In such a case, one would refer to the description of H5Pset_szip, looking for any conditions or requirements that might affect the local computing environment.

Parameters:
Returns:
Returns a dataset identifier if successful; otherwise returns a negative value.
Fortran90 Interface: See listing under H5Dcreate.

History:
Release     C
1.8.0 Function H5Dcreate renamed to H5Dcreate1 and deprecated in this release.

Last modified: 9 October 2014
Name: H5Dcreate2

Signature:
hid_t H5Dcreate2( hid_t loc_id, const char *name, hid_t dtype_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id )

Purpose:
Creates a new dataset and links it into the file.

Description:
H5Dcreate2 creates a new dataset named name at the location specified by loc_id, and associates constant and initial persistent properties with that dataset, including dtype_id, the datatype of each data element as stored in the file; space_id, the dataspace of the dataset; and other initial properties as defined in the dataset creation property and access property lists, dcpl_id and dapl_id, respectively. Once created, the dataset is opened for access.

loc_id may be a file identifier, or a group identifier within that file. name may be either an absolute path in the file or a relative path from loc_id naming the dataset.

If dtype_id is either a fixed-length or variable-length string, it is important to set the string length when defining the datatype. String datatypes are derived from H5T_C_S1 (or H5T_FORTRAN_S1 for Fortran codes), which defaults to 1 character in size. See H5Tset_size and “Creating variable-length string datatypes.”

If dtype_id is a committed datatype, and if the file location associated with the committed datatype is different from the file location where the dataset will be created, the datatype is copied and converted to a transient type.

The link creation property list, lcpl_id, governs creation of the link(s) by which the new dataset is accessed and the creation of any intermediate groups that may be missing.

The datatype and dataspace properties and the dataset creation and access property lists are attached to the dataset, so the caller may derive new datatypes, dataspaces, and creation and access properties from the old ones and reuse them in calls to create additional datasets.

Once created, the dataset is ready to receive raw data. Immediately attempting to read raw data from the dataset will probably return the fill value.

To conserve and release resources, the dataset should be closed when access is no longer required.

Parameters:
hid_t loc_id IN: Location identifier
const char *name     IN: Dataset name
hid_t dtype_id IN: Datatype identifier
hid_t space_id IN: Dataspace identifier
hid_t lcpl_id IN: Link creation property list
hid_t dcpl_id IN: Dataset creation property list
hid_t dapl_id IN: Dataset access property list

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

Fortran90 Interface: See listing under H5Dcreate.

See Also:
H5Tset_size
Creating variable-length string datatypes
“Using Identifiers”

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

Last modified: 9 October 2014
Name: H5Dcreate_anon

Signature:
hid_t H5Dcreate_anon( hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id )

Purpose:
Creates a dataset in a file without linking it into the file structure.

Description:
H5Dcreate_anon creates a dataset in the file specified by loc_id.

loc_id may be a file identifier or a group identifier within that file.

The dataset’s datatype and dataspace are specified by type_id and space_id, respectively. These are the datatype and dataspace of the dataset as it will exist in the file, which may differ from the datatype and dataspace in application memory.

Dataset creation properties are specified in the dataset creation property list dcpl_id. Dataset access properties are specified in the dataset access property list dapl_id.

H5Dcreate_anon returns a new dataset identifier. Using this identifier, the new dataset must be linked into the HDF5 file structure with H5Olink or it will be deleted from the file when the file is closed.

See H5Dcreate for further details and considerations on the use of H5Dcreate and H5Dcreate_anon.

The differences between this function and H5Dcreate are as follows:

A dataset created with this function should be closed with H5Dclose when the dataset is no longer needed so that resource leaks will not develop.

Parameters:

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

Fortran90 Interface: h5dcreate_anon_f
SUBROUTINE h5dcreate_anon_f(loc_id, type_id, space_id, dset_id, hdferr, &
                            dcpl_id, dapl_id)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN)  :: loc_id   ! File or group identifier. 
  INTEGER(HID_T), INTENT(IN)  :: type_id  ! Datatype identifier. 
  INTEGER(HID_T), INTENT(IN)  :: space_id ! Dataspace identifier.
  INTEGER(HID_T), INTENT(OUT) :: dset_id  ! Dataset identifier. 
  INTEGER, INTENT(OUT) :: hdferr          ! Error code.  
                                          ! 0 on success and -1 on failure
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dcpl_id  
                                          ! Dataset creation property list 
                                          ! identifier.
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dapl_id  
                                          ! Dataset access property list 
                                          ! identifier.
END SUBROUTINE h5dcreate_anon_f
	  

See Also:
H5Olink
H5Dcreate
“Using Identifiers”

History:
Release     C
1.8.0 Function introduced in this release.

Last modified: 11 February 2010
Name: H5Dextend
Signature:
herr_t H5Dextend( hid_t dataset_id, const hsize_t size[] )

Purpose:
Extends a dataset.

Notice:
This function is deprecated in favor of the function H5Dset_extent.

Description:
H5Dextend verifies that the dataset is at least of size size, extending it if necessary. The dimensionality of size is the same as that of the dataspace of the dataset being changed.

This function can be applied to the following datasets:

Space on disk is immediately allocated for the new dataset extent if the dataset’s space allocation time is set to H5D_ALLOC_TIME_EARLY. Fill values will be written to the dataset if the dataset’s fill time is set to H5D_FILL_TIME_IFSET  or  H5D_FILL_TIME_ALLOC. (See H5Pset_fill_time and H5Pset_alloc_time.)

This function ensures that the dataset dimensions are of at least the sizes specified in size. The function H5Dset_extent must be used if the dataset dimension sizes are are to be reduced.

Parameters:
hid_t dataset_id IN: Identifier of the dataset.
const hsize_t size[]     IN: Array containing the new magnitude of each dimension.

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

Fortran90 Interface: h5dextend_f
SUBROUTINE h5dextend_f(dataset_id, size, hdferr) 
  IMPLICIT NONE 
  INTEGER(HID_T), INTENT(IN) :: dataset_id   ! Dataset identifier
  INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN)  :: size
                                             ! Array containing 
                                             ! dimensions' sizes 
  INTEGER, INTENT(OUT) :: hdferr             ! Error code 
                                             ! 0 on success and -1 on failure
END SUBROUTINE h5dextend_f 
	

History:
Release     C
1.8.0 Function deprecated in this release.
1.8.0 Parameter size syntax changed to 'const hsize_t size[]' in this release.

Name: H5Dfill
Signature:
herr_t H5Dfill( const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_t space_id )
Purpose:
Fills dataspace elements with a fill value in a memory buffer.
Description:
H5Dfill explicitly fills the dataspace selection in memory, space_id, with the fill value specified in fill. If fill is NULL, a fill value of 0 (zero) is used.

fill_type_id specifies the datatype of the fill value.
buf specifies the buffer in which the dataspace elements will be written.
buf_type_id specifies the datatype of those data elements.

Note that if the fill value datatype differs from the memory buffer datatype, the fill value will be converted to the memory buffer datatype before filling the selection.

Note:
Applications sometimes write data only to portions of an allocated dataset. It is often useful in such cases to fill the unused space with a known fill value. See H5Pset_fill_value for further discussion. Other related functions include H5Pget_fill_value, H5Pfill_value_defined, H5Pset_fill_time, H5Pget_fill_time, H5Dcreate, and H5Dcreate_anon.
Parameters:
Returns:
Returns a non-negative value if successful; otherwise returns a negative value.
Fortran90 Interface: h5dfill_f
SUBROUTINE h5dfill_f(fill_value, space_id, buf, hdferr)
  IMPLICIT NONE
  TYPE, INTENET(IN) :: fill_value        ! Fill value; may be have one of the
                                         ! following types:
                                         ! INTEGER, REAL, DOUBLE PRECISION, 
                                         ! CHARACTER
  INTEGER(HID_T), INTENT(IN) :: space_id ! Memory dataspace selection identifier 
  TYPE, DIMENSION(*) :: buf              ! Memory buffer to fill in; must have
                                         ! the same datatype as fill value
  INTEGER, INTENT(OUT) :: hdferr         ! Error code  
                                         ! 0 on success and -1 on failure
END SUBROUTINE h5dfill_f
	

Last modified: 31 May 2016

Name: H5Dflush

Signature:
herr_t H5Dflush(hid_t dataset_id)

Purpose:
Flushes all buffers associated with a dataset to disk.

Description:
H5Dflush causes all buffers associated with a dataset to be immediately flushed to disk without removing the data from the cache.

Note:
HDF5 does not possess full control over buffering. H5Dflush flushes the internal HDF5 buffers and then asks the operating system (the OS) to flush the system buffers for the open files. After that, the OS is responsible for ensuring that the data is actually flushed to disk.

Parameters:
hid_t dataset_id    IN: Identifier of the dataset to be flushed.

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

Fortran Interface:
None

See Also:



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




Last modified: 11 July 2013
Name: H5Dgather
Signature:
herr_t H5Dgather( hid_t src_space_id, const void * src_buf, hid_t type_id, size_t dst_buf_size, void *dst_buf H5D_gather_func_t op, void * op_data, )

Purpose:
Gathers data from a selection within a memory buffer.

Description:
H5Dgather retrieves data from a selection within the supplied buffer src_buf and passes it to the supplied callback function op in a contiguous form.

src_space_id is a dataspace which defines the extent of src_buf and the selection within it to gather the data from.

type_id is the datatype of the data to be gathered in both the source and destination buffers.

src_buf must be at least as large as the number of elements in the extent of src_space_id times the size in bytes of type_id.

The data is gathered into dst_buf, which needs to be large enough to hold all the data if the callback function op is not provided.

If no callback function is provided, H5Dgather simply gathers the data into dst_buf and returns. If a callback function is provided, H5Dgather repeatedly gathers up to dst_buf_size bytes op to process the serialized data. The prototype of the callback function op is as follows (as defined in the source code file H5Dpublic.h):

herr_t (*H5D_gather_func_t)( const void * dst_buf, size_t dst_buf_bytes_used, void *op_data)

The parameters of this callback function have the following values or meanings:
     dst_buf Pointer to the destination buffer which has been filled with the next set of elements gathered. This will always be identical to the dst_buf passed to H5Dgather.
     dst_buf_bytes_used    Pointer to the number of valid bytes in dst_buf. This number must be a multiple of the datatype size.
     op_data User-defined pointer to data required by the callback function; a pass-through of the op_data pointer provided with the H5Dgather function call.

The callback function should process, store, or otherwise make use of the data returned in dst_buf before it returns, because the buffer will be overwritten unless it is the last call to the callback. This function will be repeatedly called until all gathered elements have been passed to the callback in dst_buf. The callback function should return zero (0) to indicate success, and a negative value to indicate failure.

Programming Note for C++ Developers Using C Functions:

If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine should be returned from normally.

Examples of this kind of routine include callbacks such as H5Pset_elink_cb and H5Pset_type_conv_cb and functions such as H5Tconvert and H5Ewalk2.

Exiting the routine in its normal fashion allows the HDF5 C Library to clean up its work properly. In other words, if the C++ application jumps out of the routine back to the C++ “catch” statement, the The HDF5 C Library is not given the opportunity to close any temporary data structures that were set up when the routine was called. The C++ application should save some state as the routine is started so that any problem that occurs might be diagnosed.

Parameters:
hid_t src_space_id IN: Identifier for the dataspace describing both the dimensions of the source buffer and the selection within the source buffer to gather data from.
const void *src_buf IN: Source buffer which the data will be gathered from.
hid_t type_id IN: Identifier for the datatype describing the data in both the source and definition buffers. This is only used to calculate the element size.
size_t dst_buf_size IN: Size in bytes of dst_buf.
void *dst_buf OUT: Destination buffer where the gathered data will be placed.
H5D_gather_func_t op    IN: Callback function which handles the gathered data.
Optional if dst_buf is large enough to hold all of the gathered data; required otherwise.
void * op_data IN: User-defined pointer to data required by op.

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

See Also:
H5Dscatter

History:
Release     Change
1.8.11 C function introduced.

Last modified: 9 October 2014
Name: H5Dget_access_plist

Signature:
hid_t H5Dget_access_plist( hid_t dataset_id )

Purpose:
Returns the dataset access property list associated with a dataset.

Description:
H5Dget_access_plist returns a copy of the dataset access property list used to open the specified dataset. Modifications to the returned property list will have no effect on the dataset it was retrieved from.

The chunk cache parameters in the returned property lists will be those used by the dataset. If the properties in the file access property list were used to determine the dataset's chunk cache configuration, then those properties will be present in the returned dataset access property list. If the dataset does not use a chunked layout, then the chunk cache properties will be set to the default. The chunk cache properties in the returned list are considered to be “set”, and any use of this list will override the corresponding properties in the file’s file access property list.

All link access properties in the returned list will be set to the default values.

The access property list identifier should be released with H5Pclose when the identifier is no longer needed so that resource leaks will not develop.

Parameters:
hid_t dataset_id      IN: Identifier of the dataset to get access property list of.

Returns:
Returns a dataset access property list identifier if successful; otherwise returns a negative value.

Example Usage:
The following code retrieves the dataset access property list used to open the dataset dataset_id into dapl_id:
dapl_id = H5Dget_access_plist(dataset_id);

See Also:
“Dataset Access Properties” in the “H5P: Property List Interface” chapter of the HDF5 Reference Manual
“Using Identifiers”

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

Last modified: 9 October 2014
Name: H5Dget_create_plist

Signature:
hid_t H5Dget_create_plist(hid_t dataset_id )

Purpose:
Returns an identifier for a copy of the dataset creation property list for a dataset.

Description:
H5Dget_create_plist returns an identifier for a copy of the dataset creation property list associated with the dataset specified by dataset_id.

The creation property list identifier should be released with H5Pclose.

Parameters:

Returns:
Returns a dataset creation property list identifier if successful; otherwise returns a negative value.

Fortran90 Interface: h5dget_create_plist_f
SUBROUTINE h5dget_create_plist_f(dataset_id, creation_id, hdferr) 
  IMPLICIT NONE 
  INTEGER(HID_T), INTENT(IN) :: dataset_id    ! Dataset identifier
  INTEGER(HID_T), INTENT(OUT) :: creation_id  ! Dataset creation
                                              ! property list identifier
  INTEGER, INTENT(OUT) :: hdferr              ! Error code 
                                              ! 0 on success and -1 on failure
END SUBROUTINE h5dget_create_plist_f  
	
See Also:
“Using Identifiers”

Last modified: 17 August 2010
Name: H5Dget_offset
Signature:
haddr_t H5Dget_offset( hid_t dset_id )

Purpose:
Returns dataset address in file.

Description:
H5Dget_offset returns the address in the file of the dataset dset_id. That address is expressed as the offset in bytes from the beginning of the file.

Parameters:
hid_t dset_id     IN: Dataset identifier.

Returns:
Returns the offset in bytes; otherwise returns HADDR_UNDEF, a negative value.

Fortran90 Interface:
None.

History:
Release     C
1.6.0 Function introduced in this release.

Last modified: 9 October 2014
Name: H5Dget_space

Signature:
hid_t H5Dget_space( hid_t dataset_id )

Purpose:
Returns an identifier for a copy of the dataspace for a dataset.

Description:
H5Dget_space makes a copy of the dataspace of the dataset specified by dataset_id. The function returns an identifier for the new copy of the dataspace.

A dataspace identifier returned from this function should be released with H5Sclose when the identifier is no longer needed so that resource leaks will not occur.

Parameters:
hid_t dataset_id     IN: Identifier of the dataset to query.

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

Fortran90 Interface: h5dget_space_f
SUBROUTINE h5dget_space_f(dataset_id, dataspace_id, hdferr) 
  IMPLICIT NONE 
  INTEGER(HID_T), INTENT(IN) :: dataset_id      ! Dataset identifier
  INTEGER(HID_T), INTENT(OUT) :: dataspace_id   ! Dataspace identifier
  INTEGER, INTENT(OUT) :: hdferr                ! Error code 
                                                ! 0 on success and -1 on failure
END SUBROUTINE h5dget_space_f
    
See Also:
“Using Identifiers”

Name: H5Dget_space_status
Signature:
herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *status)
Purpose:
Determines whether space has been allocated for a dataset.
Description:
H5Dget_space_status determines whether space has been allocated for the dataset dset_id.

Space allocation status is returned in status, which will have one of the following values:

     H5D_SPACE_STATUS_NOT_ALLOCATED Space has not been allocated for this dataset.
H5D_SPACE_STATUS_ALLOCATED Space has been allocated for this dataset.
H5D_SPACE_STATUS_PART_ALLOCATED   Space has been partially allocated for this dataset. (Used only for datasets with chunked storage.)
Parameters:
Returns:
Returns a non-negative value if successful; otherwise returns a negative value.
Fortran90 Interface: h5dget_space_status_f
SUBROUTINE h5dget_space_status_f(dset_id, flag, hdferr)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: dset_id  ! Dataset identifier 
  INTEGER, INTENET(OUT)      :: flag     ! Status flag ; possible values:
                                         ! H5D_SPACE_STS_ERROR_F
                                         ! H5D_SPACE_STS_NOT_ALLOCATED_F
                                         ! H5D_SPACE_STS_PART_ALLOCATED_F
                                         ! H5D_SPACE_STS_ALLOCATED_F
  INTEGER, INTENT(OUT) :: hdferr         ! Error code  
                                         ! 0 on success and -1 on failure
END SUBROUTINE h5dget_space_status_f
	
History:

Last modified: 25 October 2011
Name: H5Dget_storage_size
Signature:
hsize_t H5Dget_storage_size( hid_t dataset_id )

Purpose:
Returns the amount of storage allocated for a dataset.

Description:
H5Dget_storage_size returns the amount of storage, in bytes, that is allocated in the file for the raw data of the dataset specified by dataset_id.

Note that the amount of storage in this case is the storage allocated in the written file, which will typically differ from the space required to hold a dataset in working memory.

H5Dget_storage_size reports only the space required to store the data; the report does not include any metadata.

The return value may be zero if no data has been stored.

Caution:
Note that H5Dget_storage_size is not generally an appropriate function to use when determining the amount of memory required to work with a dataset. In such circumstances, you must determine the number of data points in a dataset and the size of an individual data element. H5Sget_simple_extent_npoints and H5Tget_size can be used to get that information.

Parameters:
hid_t dataset_id     IN: Identifier of the dataset to query.

Returns:
Returns the amount of storage space, in bytes, allocated for the dataset, not counting metadata; otherwise returns 0 (zero).

Note that H5Dget_storage_size does not differentiate between 0 (zero), the value returned for the storage size of a dataset with no stored values, and 0 (zero), the value returned to indicate an error.

Fortran90 Interface: h5dget_storage_size_f
SUBROUTINE h5dget_storage_size_f(dset_id, size, hdferr)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: dset_id  ! Dataset identifier  
  INTEGER(HSIZE_T), INTENT(OUT)  :: size ! Amount of storage required 
                                         ! for dataset
  INTEGER, INTENT(OUT) :: hdferr         ! Error code  
                                         ! 0 on success and -1 on failure
END SUBROUTINE h5dget_storage_size_f
    

History:
Release     Fortran90
1.4.5 Function introduced in this release.

Last modified: 9 October 2014
Name: H5Dget_type

Signature:
hid_t H5Dget_type(hid_t dataset_id )

Purpose:
Returns an identifier for a copy of the datatype for a dataset.

Description:
H5Dget_type returns an identifier for a copy of the datatype for a dataset. The datatype should be released with the H5Tclose function.

If a dataset has a named datatype, then an identifier to the opened datatype is returned. Otherwise, the returned datatype is read-only. If atomization of the datatype fails, then the datatype is closed.

A datatype identifier returned from this function should be released with H5Tclose when the identifier is no longer needed so that resource leaks will not occur.

Parameters:

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

Fortran90 Interface: h5dget_type_f
SUBROUTINE h5dget_type_f(dataset_id, datatype_id, hdferr) 
  IMPLICIT NONE 
  INTEGER(HID_T), INTENT(IN) :: dataset_id    ! Dataset identifier
  INTEGER(HID_T), INTENT(OUT) :: datatype_id  ! Datatype identifier
  INTEGER, INTENT(OUT) :: hdferr              ! Error code 
                                              ! 0 on success and -1 on failure
END SUBROUTINE h5dget_type_f 
    
See Also:
“Using Identifiers”

Name: H5Diterate
Signature:
herr_t H5Diterate( void *buf, hid_t type_id, hid_t space_id, H5D_operator_t operator, void *operator_data )

Purpose:
Iterates over all selected elements in a dataspace.

Description:
H5Diterate iterates over all the data elements in the memory buffer buf, executing the callback function operator once for each such data element.

The protoype of the callback function operator is as follows (as defined in the source code file H5Lpublic.h):

herr_t (*H5D_operator_t)(void elem, hid_t type_id, unsigned ndim,
                         const hsize_t *point, void *operator_data)

The parameters of this callback function have the following values or meanings:
     void *elem      IN/OUT: Pointer to the memory buffer containing the current data element
  hid_t type_id   IN: Datatype identifier for the elements stored in elem
  unsigned ndim   IN: Number of dimensions for the point array
  const hsize_t *point   IN: Array containing the location of the element within the original dataspace
  void *operator_data   IN/OUT: Pointer to any user-defined data associated with the operation

The possible return values from the callback function, and the effect of each, are as follows:

The H5Diterate operator_data parameter is a user-defined pointer to the data required to process dataset elements in the course of the iteration. If operator needs to pass data back to the application, such data can be returned in this same buffer. This pointer is passed back to each step of the iteration in the operator callback function’s operator_data parameter.

Unlike other HDF5 iterators, this iteration operation cannot be restarted at the point of exit; a second H5Diterate call will always restart at the beginning.

Parameters:

Returns:
Returns the return value of the last operator if it was non-zero, or zero if all elements have been processed. Otherwise returns a negative value.

Fortran90 Interface:
None.

History:

Last modified: 9 October 2014
Name: H5Dopen

Signature:
hid_t H5Dopen( hid_t loc_id, const char *name )

hid_t H5Dopen( hid_t loc_id, const char *name, hid_t dapl_id )

Purpose:
Opens an existing dataset.

Description:
H5Dopen is a macro that is mapped to either H5Dopen1 or H5Dopen2, depending on the needs of the application.

Such macros are provided to facilitate application compatibility. Their use and mappings are fully described in “API Compatibility Macros in HDF5”; we urge you to read that document closely.

When both the HDF5 Library and the application are built and installed with no specific compatibility flags, H5Dopen is mapped to the most recent version of the function, currently H5Dopen2. If the library and/or application is compiled for Release 1.6 emulation, H5Dopen will be mapped to H5Dopen1. Function-specific flags are available to override these settings on a function-by-function basis when the application is compiled.

Specific compile-time compatibility flags and the resulting mappings are as follows:

Compatibility setting H5Dopen mapping

Global settings
No compatibility flag H5Dopen2 
Enable deprecated symbols H5Dopen2 
Disable deprecated symbols H5Dopen2 
Emulate Release 1.6 interface     H5Dopen1 

Function-level macros
H5Dopen_vers = 2 H5Dopen2
H5Dopen_vers = 1 H5Dopen1

A dataset opened with this macro should be closed with H5Dclose when the dataset is no longer needed so that resource leaks will not develop.

Fortran90 Interface: h5dopen_f
SUBROUTINE h5dopen_f(loc_id, name, dset_id, hdferr, dapl_id)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
  CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the dataset 
  INTEGER(HID_T), INTENT(OUT) :: dset_id ! Dataset identifier
  INTEGER, INTENT(OUT) :: hdferr         ! Error code: 
                                         ! 0 on success and -1 on failure
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: dapl_id 
                                         ! Dataset access property list
END SUBROUTINE h5dopen_f
    
See Also:
“Using Identifiers”

History:
Release     C
1.8.0 The function H5Dopen renamed to H5Dopen1 and deprecated in this release.
The macro H5Dopen and the function H5Dopen2 introduced in this release.

Last modified: 28 August 2012
Name: H5Dopen1

Signature:
hid_t H5Dopen1( hid_t loc_id, const char *name )

Purpose:
Opens an existing dataset.

Notice:
This function is deprecated in favor of the function H5Dopen2 or the macro H5Dopen.

Description:
H5Dopen1 opens an existing dataset for access in the file or group specified in loc_id. name is a dataset name and is used to identify the dataset in the file.

A dataset opened with this function should be closed with H5Dclose when the dataset is no longer needed so that resource leaks will not develop.

Parameters:

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

Fortran90 Interface: See listing under H5Dopen.

History:
Release     C
1.8.0 Function H5Dopen renamed to H5Dopen1 and deprecated in this release.

Last modified: 9 October 2014
Name: H5Dopen2

Signature:
hid_t H5Dopen2( hid_t loc_id, const char *name, hid_t dapl_id )

Purpose:
Opens an existing dataset.

Description:
H5Dopen2 opens the existing dataset specified by a location identifier and name, loc_id and name, respectively.

The dataset access property list, dapl_id, provides information regarding access to the dataset.

To conserve and release resources, the dataset should be closed when access is no longer required.

Parameters:
hid_t loc_id IN: Location identifier
const char *name     IN: Dataset name
hid_t dapl_id IN: Dataset access property list

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

Fortran90 Interface:
See listing under H5Dopen.

See Also:
“Using Identifiers”

History:
Release     C
1.8.0 Function introduced in this release.

Last modified: 16 September 2014
Name: H5Dread
Signature:
herr_t H5Dread( hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, void * buf )

Purpose:
Reads raw data from a dataset into a buffer.

Description:
H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into an application memory buffer buf. Data transfer properties are defined by the argument xfer_plist_id. The memory datatype of the (partial) dataset is identified by the identifier mem_type_id. The part of the dataset to read is defined by mem_space_id and file_space_id.

file_space_id is used to specify only the selection within the file dataset's dataspace. Any dataspace specified in file_space_id is ignored by the library and the dataset's dataspace is always used. file_space_id can be the constant H5S_ALL. which indicates that the entire file dataspace, as defined by the current dimensions of the dataset, is to be selected.

mem_space_id is used to specify both the memory dataspace and the selection within that dataspace. mem_space_id can be the constant H5S_ALL, in which case the file dataspace is used for the memory dataspace and the selection defined with file_space_id is used for the selection within that dataspace.

If raw data storage space has not been allocated for the dataset and a fill value has been defined, the returned buffer buf is filled with the fill value.

The behavior of the library for the various combinations of valid dataspace identifiers and H5S_ALL for the mem_space_id and the file_space_id parameters is described below:

mem_space_id   file_space_id   Behavior
valid dataspace identifier valid dataspace identifier mem_space_id specifies the memory dataspace and the selection within it. file_space_id specifies the selection within the file dataset's dataspace.
H5S_ALL valid dataspace identifier The file dataset's dataspace is used for the memory dataspace and the selection specified with file_space_id specifies the selection within it. The combination of the file dataset's dataspace and the selection from file_space_id is used for memory also.
valid dataspace identifier H5S_ALL mem_space_id specifies the memory dataspace and the selection within it. The selection within the file dataset's dataspace is set to the "all" selection.
H5S_ALL H5S_ALL The file dataset's dataspace is used for the memory dataspace and the selection within the memory dataspace is set to the "all" selection. The selection within the file dataset's dataspace is set to the "all" selection.

Setting an H5S_ALL selection indicates that the entire dataspace, as defined by the current dimensions of a dataspace, will be selected. The number of elements selected in the memory dataspace must match the number of elements selected in the file dataspace.

xfer_plist_id can be the constant H5P_DEFAULT. in which case the default data transfer properties are used.

Datatype conversion takes place at the time of a read or write and is automatic. See the “Data Transfer: Datatype Conversion and Selection” section in the “HDF5 Datatypes” chapter of the HDF5 User’s Guide for a discussion of data conversion.

Parameters:
hid_t dataset_id IN: Identifier of the dataset read from.
hid_t mem_type_id IN: Identifier of the memory datatype.
hid_t mem_space_id IN: Identifier of the memory dataspace.
hid_t file_space_id IN: Identifier of the dataset's dataspace in the file.
hid_t xfer_plist_id     IN: Identifier of a transfer property list for this I/O operation.
void * buf OUT: Buffer to receive data read from file.

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

Fortran90 Interface: h5dread_f, h5dread_vl_f
There is no direct Fortran90 couterpart for the C function H5Dread. Instead, that functionality is provided by two Fortran90 subroutines:
h5dread_f    Purpose: Reads data other than variable-length data.
h5dread_vl_f    Purpose: Reads variable-length data.

SUBROUTINE h5dread_f(dset_id, mem_type_id, buf, dims, hdferr, & 
                     mem_space_id, file_space_id, xfer_prp)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: dset_id     ! Dataset identifier
  INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier
  TYPE, INTENT(INOUT) :: buf                ! Data buffer; may be a scalar 
                                            ! or an array
  DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN)  :: dims 
                                            ! Array to hold corresponding 
                                            ! dimension sizes of data 
                                            ! buffer buf 
                                            ! dim(k) has value of the k-th 
                                            ! dimension of buffer buf
                                            ! Values are ignored if buf is 
                                            ! a scalar
  INTEGER, INTENT(OUT) :: hdferr            ! Error code 
                                            ! 0 on success and -1 on failure
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id 
                                            ! Memory dataspace identfier 
                                            ! Default value is H5S_ALL_F 
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id 
                                            ! File dataspace identfier 
                                            ! Default value is H5S_ALL_F
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp 
                                            ! Transfer property list identifier
                                            ! Default value is H5P_DEFAULT_F 
END SUBROUTINE h5dread_f
	

SUBROUTINE h5dread_vl_f(dset_id, mem_type_id, buf, dims, len, hdferr, & 
                     mem_space_id, file_space_id, xfer_prp)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: dset_id     ! Dataset identifier
  INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier
  TYPE, INTENT(INOUT), & DIMENSION(dims(1),dims(2)) :: buf
                                            ! Data buffer; may be a scalar 
                                            ! or an array
                                            ! TYPE must be one of the following
                                            !     INTEGER
                                            !     REAL
                                            !     CHARACTER

  INTEGER(HSIZE_T), INTENT(IN), DIMENSION(2)  :: dims 
                                            ! Array to hold corresponding 
                                            ! dimension sizes of data 
                                            ! buffer buf 
                                            ! dim(k) has value of the k-th 
                                            ! dimension of buffer buf
                                            ! Values are ignored if buf is 
                                            ! a scalar
  INTEGER(SIZE_T), INTENT(INOUT), DIMENSION(*)  :: len 
                                            ! Array to store length of
                                            ! each element
  INTEGER, INTENT(OUT) :: hdferr            ! Error code 
                                            ! 0 on success and -1 on failure
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id 
                                            ! Memory dataspace identfier 
                                            ! Default value is H5S_ALL_F 
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id 
                                            ! File dataspace identfier 
                                            ! Default value is H5S_ALL_F
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp 
                                            ! Transfer property list identifier
                                            ! Default value is H5P_DEFAULT_F
END SUBROUTINE h5dread_vl_f
        

Fortran2003 Interface: h5dread_f
Signature:

  SUBROUTINE h5dread_f(dset_id, mem_type_id, buf, hdferr, &
                       mem_space_id, file_space_id, xfer_prp)
    INTEGER(HID_T), INTENT(IN)              :: dset_id
    INTEGER(HID_T), INTENT(IN)              :: mem_type_id
    TYPE(C_PTR)   , INTENT(INOUT)           :: buf
    INTEGER       , INTENT(OUT)             :: hdferr
    INTEGER(HID_T), INTENT(IN)   , OPTIONAL :: mem_space_id
    INTEGER(HID_T), INTENT(IN)   , OPTIONAL :: file_space_id
    INTEGER(HID_T), INTENT(IN)   , OPTIONAL :: xfer_prp

Inputs:

  dset_id       - Identifier of the dataset read from.
  mem_type_id   - Identifier of the memory datatype.

Outputs:

  buf           - Buffer to receive data read from file.
  hdferr        - Returns 0 if successful and -1 if fails

Optional parameters:

  mem_space_id  - Identifier of the memory dataspace.
  file_space_id - Identifier of the dataset's dataspace in the file.
  xfer_prp      - Identifier of a transfer property list for this I/O operation.

History:
Release     Change
1.8.8 Fortran updated to Fortran2003.
1.4.2 dims parameter added in Fortran interface.

Last modified: 31 May 2016

Name: H5Drefresh

Signature:
herr_t H5Drefresh(hid_t dataset_id)

Purpose:
Refreshes all buffers associated with a dataset.

Description:
H5Drefresh causes all buffers associated with a dataset to be cleared and immediately re-loaded with updated contents from disk.

This function essentially closes the dataset, evicts all metadata associated with it from the cache, and then re-opens the dataset. The reopened dataset is automatically re-registered with the same identifier.

Parameters:

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

Fortran Interface:
None

See Also:



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




Last modified: 11 July 2013
Name: H5Dscatter
Signature:
herr_t H5Dscatter( H5D_scatter_func_t op, void * op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf )

Purpose:
Scatters data into a selection within a memory buffer.

Description:
H5Dscatter retrieves data from the supplied callback op and scatters it to the supplied buffer dst_buf in a manner similar to data being written to a dataset.

dst_space_id is a dataspace which defines the extent of dst_buf and the selection within it to scatter the data to.

type_id is the datatype of the data to be scattered in both the source and destination buffers.

dst_buf must be at least as large as the number of elements in the extent of dst_space_id times the size in bytes of type_id.

To retrieve the data to be scattered, H5Dscatter repeatedly calls op, which should return a valid source buffer, until enough data to fill the selection has been retrieved. The prototype of the callback function op is as follows (as defined in the source code file H5Dpublic.h):

herr_t (*H5D_scatter_func_t)( const void ** src_buf/*out*/, size_t *src_buf_bytes_used/*out*/, void *op_data)

The parameters of this callback function have the following values or meanings:
     src_buf Pointer to the buffer holding the next set of elements to scatter.
On entry, the value of *src_buf is undefined. The callback function should set *src_buf to point to the next set of elements.
     src_buf_bytes_used    Pointer to the number of valid bytes in src_buf.
On entry, the value of *src_buf_bytes_used is undefined. The callback function should set *src_buf_bytes_used to the number of valid bytes in src_buf. This number must be a multiple of the datatype size.
     op_data User-defined pointer to data required by the callback function; a pass-through of the op_data pointer provided with the H5Dscatter function call.

The callback function should always return at least one element in src_buf, and must not return more elements than are remaining to be scattered. This function will be repeatedly called until all elements to be scattered have been returned. The callback function should return zero (0) to indicate success, and a negative value to indicate failure.

Programming Note for C++ Developers Using C Functions:

If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine should be returned from normally.

Examples of this kind of routine include callbacks such as H5Pset_elink_cb and H5Pset_type_conv_cb and functions such as H5Tconvert and H5Ewalk2.

Exiting the routine in its normal fashion allows the HDF5 C Library to clean up its work properly. In other words, if the C++ application jumps out of the routine back to the C++ “catch” statement, the HDF5 C Library is not given the opportunity to close any temporary data structures that were set up when the routine was called. The C++ application should save some state as the routine is started so that any problem that occurs might be diagnosed.

Parameters:
H5D_scatter_func_t op    IN: Callback function which provides data to be scattered.
void *op_data IN: User-defined pointer to data required by op.
hid_t type_id IN: Identifier for the datatype describing the data in both the source and definition buffers. This is only used to calculate the element size.
hid_t dst_space_id IN: Identifier for the dataspace describing both the dimensions of the destination buffer and the selection within the destination buffer that data will be scattered to.
void *dst_buf OUT: Destination buffer which the data will be scattered to.

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

See Also:
H5Dgather

History:
Release     Change
1.8.11 C function introduced.

Last modified: 13 August 2013
Name: H5Dset_extent
Signature:
herr_t H5Dset_extent( hid_t dset_id, const hsize_t size[] )

Purpose:
Changes the sizes of a dataset’s dimensions.

Description:
H5Dset_extent sets the current dimensions of the chunked dataset dset_id to the sizes specified in size.

size is a 1-dimensional array with n elements, where n is the rank of the dataset’s current dataspace.

This function can be applied to the following datasets:

Space on disk is immediately allocated for the new dataset extent if the dataset’s space allocation time is set to H5D_ALLOC_TIME_EARLY.

Fill values will be written to the dataset in either of the following situations, but not otherwise:

Notes:
  • If the sizes specified in size are smaller than the dataset’s current dimension sizes, H5Dset_extent will reduce the dataset’s dimension sizes to the specified values. It is the user application’s responsibility to ensure that valuable data is not lost as H5Dset_extent does not check.

  • Except for external datasets, H5Dset_extent is for use with chunked datasets only, not contiguous datasets.

  • If a dataset is open for either writing or reading data when H5Dset_extent is called, the dataset’s dataspace must be refreshed before more data is written to the dataset and should be refreshed before any further data is read. This can be accomplished with a call to H5Dget_space.
  • Parameters:
    hid_t dset_id IN: Dataset identifier
    const hsize_t size[]     IN: Array containing the new magnitude of each dimension of the dataset.

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

    Fortran90 Interface: H5Dset_extent
    SUBROUTINE h5dset_extent_f(dataset_id, size, hdferr)
      IMPLICIT NONE 
      INTEGER(HID_T), INTENT(IN) :: dataset_id   ! Dataset identifier
      INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: size 
                                                 ! Array containing 
                                                 ! dimensions’ sizes   
      INTEGER, INTENT(OUT) :: hdferr             ! Error code:
                                                 ! 0 on success and -1 on failure
    END SUBROUTINE h5dset_extent_f
        

    See Also:
    H5Pset_alloc_time
    H5Pset_fill_time
    H5Pset_fill_value
               H5Screate_simple
    H5Dget_space

    History:
    Release     Change
    1.6.0 Function implemented but not supported in this release.
    1.8.0 Function supported in this release.

    Last modified: 21 August 2012
    Name: H5Dvlen_get_buf_size
    Signature:
    herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size )

    Purpose:
    Determines the number of bytes required to store variable-length (VL) data.

    Description:
    H5Dvlen_get_buf_size determines the number of bytes required to store the VL data from the dataset, using the space_id for the selection in the dataset on disk and the type_id for the memory representation of the VL data in memory.

    *size is returned with the number of bytes required to store the VL data in memory.

    Parameters:

    Last modified: 28 September 2011
    Name: H5Dvlen_reclaim
    Signature:
    herr_t H5Dvlen_reclaim( hid_t type_id, hid_t space_id, hid_t plist_id, void *buf )

    Purpose:
    Reclaims variable-length (VL) datatype memory buffers.

    Description:
    H5Dvlen_reclaim reclaims memory buffers created to store VL datatypes.

    The type_id must be the datatype stored in the buffer. The space_id describes the selection for the memory buffer to free the VL datatypes within. The plist_id is the dataset transfer property list which was used for the I/O transfer to create the buffer. And buf is the pointer to the buffer to be reclaimed.

    The VL structures (hvl_t) in the user's buffer are modified to zero out the VL information after the memory has been reclaimed.

    If nested VL datatypes were used to create the buffer, this routine frees them from the bottom up, releasing all the memory without creating memory leaks.

    Parameters:
    hid_t type_id IN: Identifier of the datatype.
    hid_t space_id     IN: Identifier of the dataspace.
    hid_t plist_id IN: Identifier of the property list used to create the buffer.
    void *buf IN: Pointer to the buffer to be reclaimed.

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

    Fortran2003 Interface: h5dvlen_reclaim_f
    Signature:

      SUBROUTINE h5dvlen_reclaim_f(type_id, space_id, plist_id, buf, hdferr)
        INTEGER(HID_T), INTENT(IN)    :: type_id
        INTEGER(HID_T), INTENT(IN)    :: space_id
        INTEGER(HID_T), INTENT(IN)    :: plist_id
        TYPE(C_PTR)   , INTENT(INOUT) :: buf
        INTEGER       , INTENT(OUT)   :: hdferr
    

    Inputs:

      type_id  - Identifier of the datatype. 
      space_id - Identifier of the dataspace. 
      plist_id - Identifier of the property list used to create the buffer. 
      buf      - Pointer to the buffer to be reclaimed. 
    

    Outputs:

      hdferr   - Returns 0 if successful and -1 if fails
    

    History:
    Release     Change
    1.8.8 Fortran interface added.

    Last modified: 16 September 2014
    Name: H5Dwrite
    Signature:
    herr_t H5Dwrite( hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, const void * buf )

    Purpose:
    Writes raw data from a buffer to a dataset.

    Description:
    H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer buf into the file. Data transfer properties are defined by the argument xfer_plist_id. The memory datatype of the (partial) dataset is identified by the identifier mem_type_id. The part of the dataset to write is defined by mem_space_id and file_space_id.

    If mem_type_id is either a fixed-length or variable-length string, it is important to set the string length when defining the datatype. String datatypes are derived from H5T_C_S1 (or H5T_FORTRAN_S1 for Fortran codes), which defaults to 1 character in size. See H5Tset_size and “Creating variable-length string datatypes.”

    file_space_id is used to specify only the selection within the file dataset's dataspace. Any dataspace specified in file_space_id is ignored by the library and the dataset's dataspace is always used. file_space_id can be the constant H5S_ALL. which indicates that the entire file dataspace, as defined by the current dimensions of the dataset, is to be selected.

    mem_space_id is used to specify both the memory dataspace and the selection within that dataspace. mem_space_id can be the constant H5S_ALL, in which case the file dataspace is used for the memory dataspace and the selection defined with file_space_id is used for the selection within that dataspace.

    The behavior of the library for the various combinations of valid dataspace IDs and H5S_ALL for the mem_space_id and the file_space_id parameters is described below:

    mem_space_id   file_space_id   Behavior
    valid dataspace identifier valid dataspace identifier mem_space_id specifies the memory dataspace and the selection within it. file_space_id specifies the selection within the file dataset's dataspace.
    H5S_ALL valid dataspace identifier The file dataset's dataspace is used for the memory dataspace and the selection specified with file_space_id specifies the selection within it. The combination of the file dataset's dataspace and the selection from file_space_id is used for memory also.
    valid dataspace identifier H5S_ALL mem_space_id specifies the memory dataspace and the selection within it. The selection within the file dataset's dataspace is set to the "all" selection.
    H5S_ALL H5S_ALL The file dataset's dataspace is used for the memory dataspace and the selection within the memory dataspace is set to the "all" selection. The selection within the file dataset's dataspace is set to the "all" selection.

    Setting an "all" selection indicates that the entire dataspace, as defined by the current dimensions of a dataspace, will be selected. The number of elements selected in the memory dataspace must match the number of elements selected in the file dataspace.

    xfer_plist_id can be the constant H5P_DEFAULT. in which case the default data transfer properties are used.

    Writing to an dataset will fail if the HDF5 file was not opened with write access permissions.

    Datatype conversion takes place at the time of a read or write and is automatic. See the “Data Transfer: Datatype Conversion and Selection” section in the “HDF5 Datatypes” chapter of the HDF5 User’s Guide for a discussion of data conversion.

    If the dataset's space allocation time is set to H5D_ALLOC_TIME_LATE or H5D_ALLOC_TIME_INCR and the space for the dataset has not yet been allocated, that space is allocated when the first raw data is written to the dataset. Unused space in the dataset will be written with fill values at the same time if the dataset's fill time is set to H5D_FILL_TIME_IFSET or H5D_FILL_TIME_ALLOC. (Also see H5Pset_fill_time and H5Pset_alloc_time.)

    If a dataset's storage layout is 'compact', care must be taken when writing data to the dataset in parallel. A compact dataset's raw data is cached in memory and may be flushed to the file from any of the parallel processes, so parallel applications should always attempt to write identical data to the dataset from all processes.

    Parameters:
    hid_t dataset_id IN: Identifier of the dataset to write to.
    hid_t mem_type_id IN: Identifier of the memory datatype.
    hid_t mem_space_id IN: Identifier of the memory dataspace.
    hid_t file_space_id     IN: Identifier of the dataset's dataspace in the file.
    hid_t xfer_plist_id IN: Identifier of a transfer property list for this I/O operation.
    const void * buf IN: Buffer with data to be written to the file.

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

    Fortran90 Interface: h5dwrite_f, h5dwrite_vl_f
    There is no direct Fortran90 couterpart for the C function H5Dwrite. Instead, that functionality is provided by two Fortran90 subroutines:
    h5dwrite_f    Purpose: Writes data other than variable-length data.
    h5dwrite_vl_f    Purpose: Writes variable-length data.
    
    SUBROUTINE h5dwrite_f(dset_id, mem_type_id, buf, dims, hdferr, & 
                          mem_space_id, file_space_id, xfer_prp)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: dset_id      ! Dataset identifier
      INTEGER(HID_T), INTENT(IN) :: mem_type_id  ! Memory datatype identifier
      TYPE, INTENT(IN) :: buf                    ! Data buffer; may be a scalar 
                                                 ! or an array
      DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN)  :: dims 
                                                 ! Array to hold corresponding 
                                                 ! dimension sizes of data 
                                                 ! buffer buf; dim(k) has value 
                                                 ! of the k-th dimension of 
                                                 ! buffer buf; values are 
                                                 ! ignored if buf is a scalar
      INTEGER, INTENT(OUT) :: hdferr             ! Error code 
                                                 ! 0 on success and -1 on failure
    
      INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id 
                                                 ! Memory dataspace identfier 
                                                 ! Default value is H5S_ALL_F
      INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id 
                                                 ! File dataspace identfier 
                                                 ! Default value is H5S_ALL_F
      INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp 
                                                 ! Transfer property list 
                                                 ! identifier; default value 
                                                 ! is H5P_DEFAULT_F 
    END SUBROUTINE h5dwrite_f
    	
    
    SUBROUTINE h5dwrite_vl_f(dset_id, mem_type_id, buf, dims, len, hdferr, & 
                         mem_space_id, file_space_id, xfer_prp)
      IMPLICIT NONE
      INTEGER(HID_T), INTENT(IN) :: dset_id     ! Dataset identifier
      INTEGER(HID_T), INTENT(IN) :: mem_type_id ! Memory datatype identifier
      TYPE, INTENT(IN), & DIMENSION(dims(1),dims(2)) :: buf
                                                ! Data buffer; may be a scalar 
                                                ! or an array
                                                ! TYPE must be one of the following
                                                !     INTEGER
                                                !     REAL
                                                !     CHARACTER
      INTEGER(HSIZE_T), INTENT(IN), DIMENSION(2)  :: dims 
                                                ! Array to hold corresponding 
                                                ! dimension sizes of data 
                                                ! buffer buf 
                                                ! dim(k) has value of the k-th 
                                                ! dimension of buffer buf
                                                ! Values are ignored if buf is 
                                                ! a scalar
      INTEGER(SIZE_T), INTENT(IN), DIMENSION(*)  :: len 
                                                ! Array to store length of
                                                ! each element
      INTEGER, INTENT(OUT) :: hdferr            ! Error code 
                                                ! 0 on success and -1 on failure
      INTEGER(HID_T), OPTIONAL, INTENT(IN) :: mem_space_id 
                                                ! Memory dataspace identfier 
                                                ! Default value is H5S_ALL_F 
      INTEGER(HID_T), OPTIONAL, INTENT(IN) :: file_space_id 
                                                ! File dataspace identfier 
                                                ! Default value is H5S_ALL_F
      INTEGER(HID_T), OPTIONAL, INTENT(IN) :: xfer_prp 
                                                ! Transfer property list identifier
                                                ! Default value is H5P_DEFAULT_F
    END SUBROUTINE h5dwrite_vl_f
            
    Fortran2003 Interface: h5dwrite_f
    Signature:

      SUBROUTINE h5dwrite_f(dset_id, mem_type_id, buf, hdferr, &
                            mem_space_id, file_space_id, xfer_prp)
        INTEGER(HID_T), INTENT(IN)              :: dset_id
        INTEGER(HID_T), INTENT(IN)              :: mem_type_id
        TYPE(C_PTR)   , INTENT(IN)              :: buf
        INTEGER       , INTENT(OUT)             :: hdferr
        INTEGER(HID_T), INTENT(IN)   , OPTIONAL :: mem_space_id
        INTEGER(HID_T), INTENT(IN)   , OPTIONAL :: file_space_id
        INTEGER(HID_T), INTENT(IN)   , OPTIONAL :: xfer_prp
    

    Inputs:

      dset_id       - Identifier of the dataset to write to.
      mem_type_id   - Identifier of the memory datatype.
      buf           - Buffer with data to be written to the file.
    

    Outputs:

      hdferr        - Returns 0 if successful and -1 if fails
    

    Optional parameters:

      mem_space_id  - Identifier of the memory dataspace.
      file_space_id - Identifier of the dataset's dataspace in the file.
      xfer_prp      - Identifier of a transfer property list for this I/O operation.
    

    See Also:
    Creating variable-length string datatypes
    H5Tset_size

    History:
    Release     Change
    1.8.8 Fortran updated to Fortran2003.
    1.4.2 dims parameter added in Fortran interface.

    HDF5 documents and links 
    Introduction to HDF5 
    HDF5 User’s Guide 
    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   Compatibility Macros 
    Collective Calls in Parallel 

    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