Page tree

 

JAVA

FORTRAN

C++

C

 

Link

H5D_CREATE2

Creates a new dataset and links it into the file

Procedure:

H5D_CREATE2(loc_id, name, dtype_id, space_id, lcpl_id, dcpl_id, dapl_id)

Signature:

hid_t H5Dcreate2hid_t loc_idconst char *namehid_t dtype_idhid_t space_idhid_t lcpl_idhid_t dcpl_idhid_t dapl_id ) 

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

Parameters:
hid_t loc_idIN: Location identifier; may be a file, group, dataset, named datatype, or attribute
const char *name    IN: Dataset name
hid_t dtype_idIN: Datatype identifier
hid_t space_idIN: Dataspace identifier
hid_t lcpl_idIN: Link creation property list
hid_t dcpl_idIN: Dataset creation property list
hid_t dapl_idIN: Dataset access property list

Description:

H5D_CREATE2 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, group, dataset, named datatype or attribute.  If an attribute, dataset, or named datatype is specified for loc_id then the dataset will be created at the location where the attribute, dataset, or named datatype is attached. 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 H5T_SET_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.

Returns:

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

Example:

 

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

--- Last Modified: October 23, 2020 | 02:48 PM