rload_from_hdf5 Subroutine

private subroutine rload_from_hdf5(h5file_id, dset, rdatum, attr)

Arguments

Type IntentOptional AttributesName
integer(kind=HID_T), intent(in) :: h5file_id
character(len=MAX_STRING_LENGTH), intent(in) :: dset
real(kind=rp), intent(out) :: rdatum
character(len=MAX_STRING_LENGTH), intent(out), optional :: attr

Contents

Source Code


Source Code

  subroutine rload_from_hdf5(h5file_id,dset,rdatum,attr)
    INTEGER(HID_T), INTENT(IN) 				:: h5file_id
    CHARACTER(MAX_STRING_LENGTH), INTENT(IN) 		:: dset
    REAL(rp), INTENT(OUT) 				:: rdatum
    REAL 						:: raw_datum
    CHARACTER(MAX_STRING_LENGTH), OPTIONAL, INTENT(OUT) :: attr
    CHARACTER(4) 					:: aname = "Info"
    INTEGER(HID_T) 					:: dset_id
    INTEGER(HID_T) 					:: dspace_id
    INTEGER(HID_T) 					:: aspace_id
    INTEGER(HID_T) 					:: attr_id
    INTEGER(HID_T) 					:: atype_id
    INTEGER(HSIZE_T), DIMENSION(1) 			:: dims = (/1/)
    INTEGER(HSIZE_T), DIMENSION(1) 			:: adims = (/1/)
    INTEGER 						:: h5error

    ! * * * Read datum from file * * *

    call h5dopen_f(h5file_id, TRIM(dset), dset_id, h5error)
    if (h5error .EQ. -1) then
       write(6,'("KORC ERROR: Something went wrong in: rload_from_hdf5 &
            --> h5dopen_f")')
    end if

    call h5dread_f(dset_id, H5T_NATIVE_REAL, raw_datum, dims, h5error)
    if (h5error .EQ. -1) then
       write(6,'("KORC ERROR: Something went wrong in: rload_from_hdf5 &
            --> h5dread_f")')
    end if
    rdatum = REAL(raw_datum,rp)

    call h5dclose_f(dset_id, h5error)
    if (h5error .EQ. -1) then
       write(6,'("KORC ERROR: Something went wrong in: rload_from_hdf5 &
            --> h5dclose_f")')
    end if

    if (PRESENT(attr)) then
       ! * * * Read attribute from file * * *

       ! * * * Read attribute from file * * *
    end if

    ! * * * Read datum from file * * *
  end subroutine rload_from_hdf5