subroutine rload_2d_array_from_hdf5(h5file_id,dset,rdata,attr)
INTEGER(HID_T), INTENT(IN) :: h5file_id
CHARACTER(MAX_STRING_LENGTH), INTENT(IN) :: dset
REAL(rp), DIMENSION(:,:), ALLOCATABLE, INTENT(INOUT) :: rdata
REAL, DIMENSION(:,:), ALLOCATABLE :: raw_data
CHARACTER(MAX_STRING_LENGTH), OPTIONAL, DIMENSION(:), ALLOCATABLE, INTENT(IN) :: attr
CHARACTER(MAX_STRING_LENGTH) :: aname
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(2) :: dims
INTEGER(HSIZE_T), DIMENSION(2) :: adims
INTEGER :: h5error
dims = shape(rdata)
ALLOCATE( raw_data(dims(1),dims(2)) )
! * * * Read data from file * * *
call h5dopen_f(h5file_id, TRIM(dset), dset_id, h5error)
if (h5error .EQ. -1) then
write(output_unit_write,'("KORC ERROR: Something went wrong in: rload_from_hdf5 --> h5dopen_f")')
call KORC_ABORT(14)
end if
call h5dread_f(dset_id, H5T_NATIVE_REAL, raw_data, dims, h5error)
if (h5error .EQ. -1) then
write(output_unit_write,'("KORC ERROR: Something went wrong in: rload_from_hdf5 --> h5dread_f")')
call KORC_ABORT(14)
end if
rdata = REAL(raw_data,rp)
call h5dclose_f(dset_id, h5error)
if (h5error .EQ. -1) then
write(output_unit_write,'("KORC ERROR: Something went wrong in: rload_from_hdf5 --> h5dclose_f")')
call KORC_ABORT(14)
end if
DEALLOCATE( raw_data )
if (PRESENT(attr)) then
! * * * Read data attribute(s) from file * * *
end if
! * * * Read data from file * * *
end subroutine rload_2d_array_from_hdf5