Page tree









Sets a data transform expression


H5P_SET_DATA_TRANSFORM ( plist_id, expression )


herr_t H5Pset_data_transform
                     (hid_t plist_id,
                     const char *expression)

Fortran90 Interface: h5pset_data_transform_f

SUBROUTINE h5pset_data_transform_f(plist_id, expression, hdferr)
  INTEGER(HID_T), INTENT(IN) :: plist_id 
                                    ! Identifier of the property list or class
  CHARACTER(LEN=*), INTENT(IN) :: expression  
                                    ! Buffer to hold transform expression
  INTEGER, INTENT(OUT) :: hdferr    ! Error code
                                    ! 0 on success and -1 on failure
END SUBROUTINE h5pset_data_transform_f

hid_t plist_idIN: Identifier of the property list or class
const char *expression  IN: Pointer to the null-terminated data transform expression


H5P_SET_DATA_TRANSFORM sets the data transform to be used for reading and writing data. This function operates on the dataset transfer property lists plist_id.

The expression parameter is a string containing an algebraic expression, such as (5/9.0)*(x-32) or x*(x-5). When a dataset is read or written with this property list, the transform expression is applied with the x being replaced by the values in the dataset. When reading data, the values in the file are not changed and the transformed data is returned to the user.

Data transforms can only be applied to integer or floating-point datasets. Order of operations is obeyed and the only supported operations are +, -, *, and /. Parentheses can be nested arbitrarily and can be used to change precedence.

When writing data back to the dataset, the transformed data is written to the file and there is no way to recover the original values to which the transform was applied.


Success: a non-negative value

Failure: a negative value


examples / h5_dtransform.c [115:122]
 1.10/master  HDFFV/hdf5  Copy
    /* Create the dataset transfer property list */
    dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER);

    /* Set the data transform */
    H5Pset_data_transform(dxpl_id_f_to_c, f_to_c);

    /* Read out the data with the data transform */
    H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillC);

  ! Create the dataset transfer property list and define the
  ! transform expression.
  CALL h5pcreate_f(H5P_DATASET_XFER_F, dxpl, hdferr)
  CALL h5pset_data_transform_f (dxpl, transform, hdferr)
  ! Create the dataset using the default properties.  Unfortunately
  ! we must save as a native type or the transform operation will
  ! fail.
  CALL h5dcreate_f(file, dataset, H5T_NATIVE_INTEGER, space, dset, hdferr)
  ! Write the data to the dataset using the dataset transfer
  ! property list.
  CALL h5dwrite_f(dset, H5T_NATIVE_INTEGER, wdata, dims, hdferr,xfer_prp=dxpl)

Release    Change
1.8.0Function introduced in this release.

--- Last Modified: August 09, 2019 | 01:28 PM