DatasetExists_HDF5 Function

public function DatasetExists_HDF5(fileId, datasetName) result(exists)

Report whether a link exists at datasetName in an open file.

ReadArray_HDF5 does not check the status of its h5dopen_f, so asking it for an absent dataset reads through an invalid identifier: the target array is left as it was and the HDF5 error stack is dumped to stderr. Callers that can legitimately meet a file without a given dataset - the model pickup readers, reading a file written by an earlier version of a model that carried fewer solution variables - use this to ask first and report the omission themselves.

A path with missing intermediate groups reports .false. rather than failing, as does any error from the link query itself.

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: fileId
character, intent(in) :: datasetName

Return Value logical


Calls

proc~~datasetexists_hdf5~~CallsGraph proc~datasetexists_hdf5 DatasetExists_HDF5 h5lexists_f h5lexists_f proc~datasetexists_hdf5->h5lexists_f

Called by

proc~~datasetexists_hdf5~~CalledByGraph proc~datasetexists_hdf5 DatasetExists_HDF5 proc~read_dgmodel2d_t Read_DGModel2D_t proc~read_dgmodel2d_t->proc~datasetexists_hdf5 proc~read_dgmodel3d_t Read_DGModel3D_t proc~read_dgmodel3d_t->proc~datasetexists_hdf5

Contents

Source Code


Source Code

  function DatasetExists_HDF5(fileId,datasetName) result(exists)
    !! Report whether a link exists at datasetName in an open file.
    !!
    !! ReadArray_HDF5 does not check the status of its h5dopen_f, so asking it
    !! for an absent dataset reads through an invalid identifier: the target
    !! array is left as it was and the HDF5 error stack is dumped to stderr.
    !! Callers that can legitimately meet a file without a given dataset - the
    !! model pickup readers, reading a file written by an earlier version of a
    !! model that carried fewer solution variables - use this to ask first and
    !! report the omission themselves.
    !!
    !! A path with missing intermediate groups reports .false. rather than
    !! failing, as does any error from the link query itself.
    implicit none
    integer(HID_T),intent(in) :: fileId
    character(*),intent(in) :: datasetName
    logical :: exists
    ! Local
    integer :: error

    call h5lexists_f(fileId,trim(datasetName),exists,error)
    if(error /= 0) exists = .false.

  endfunction DatasetExists_HDF5