Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672
Hdf rm purpose

Excerpt

Reads raw data from a dataset into a buffer

HTML Wrap
classhdf-rm-content-block
Hdf rm procedure

H5D_READ(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf)

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
Comment

Edit each block below with the corresponding language signature for this function.

If there is no implementation for a given language, simply remove the entire block (left click --> Remove) for that language signature.

Hdf rm c signature
herr_t H5Dreadhid_t dataset_idhid_t mem_type_idhid_t mem_space_idhid_t file_space_idhid_t xfer_plist_idvoid * buf ) 
HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-fortran

Fortran2003:

HTML
<pre><code class="language-fortran"> 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
</code></pre>

Fortran90:

There is no direct Fortran90 counterpart for the C function H5Dread. Instead, that functionality is provided by two Fortran90 subroutines:

h5dread_fPurpose: Reads data other than variable-length data.
h5dread_vl_fPurpose: Reads variable-length data.
HTML
<pre><code class="language-fortran"> 
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</code></pre>
HTML
<pre><code class="language-fortran"> 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

</code></pre>
Hdf rm parameters
hid_t dataset_idIN: Identifier of the dataset read from
hid_t mem_type_idIN: Identifier of the memory datatype
hid_t mem_space_idIN: Identifier of the memory dataspace
hid_t file_space_idIN: 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 * bufOUT: Buffer to receive data read from file
Hdf rm description

H5D_READ 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 identifiervalid dataspace identifiermem_space_id specifies the memory dataspace and the selection within it. file_space_id specifies the selection within the file dataset's dataspace.
H5S_ALLvalid dataspace identifierThe 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 identifierH5S_ALLmem_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_ALLH5S_ALLThe 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.

Hdf rm returnvals

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

Hdf rm anchor
AnchorNameexample

Example:
HTML Wrap
classhdf-rm-section

Coming Soon!

Comment
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_subset.c
showLineNumberstrue
lineStart32
progLangcpp
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathfortran/examples/compound.f90
showLineNumberstrue
lineStart25
progLangplain
lineEnd35
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

Hdf rm history
Release    
Release    Change
1.8.8Fortran updated to Fortran2003.
1.4.2dims parameter added in Fortran interface.