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,
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.
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_FORTRAN_S1 for Fortran codes), which defaults to 1 character in size. See H5T_SET_SIZE and Creating variable-length string datatypes.
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.