Greetings...I am trying to read an HDF5 data field in Fortran which is a 16-bit integer. I have the analogous subroutines working for 4-byte reals and this routine worked for a 4-byte integer, but when I tried to switch it to a 2-byte integer, I get a compile error.
Here is the subroutine I am trying to read that data with:
subroutine get_dataset_int(fileid,dsetname,maxpts,n_ease,dataset,istatus) !int version
use hdf5
implicit none
integer(HID_T) :: fileid,dsetid,datatype,space_id
integer, intent(in) :: maxpts
integer, intent(out) :: n_ease
character(*), intent(in) :: dsetname
integer*2 , intent(out) :: dataset(maxpts)
integer(HSIZE_T), dimension(1) :: dims
integer(SIZE_T) :: mysize
integer :: istatus
!Open Dataset
!write(*,*)'opening dataset ',trim(dsetname),' in file#',fileid
call h5dopen_f(fileid,dsetname,dsetid,istatus)
call h5dget_type_f(dsetid,datatype,istatus)
!call h5tget_size_f(datatype,mysize,istatus)
call h5dget_space_f(dsetid,space_id,istatus)
call h5sget_simple_extent_npoints_f(space_id,mysize,istatus)
n_ease=mysize
dims(1)=n_ease
!Read Dataset
!write(*,*)'reading from ',trim(dsetname)
call h5dread_f(dsetid,H5T_STD_U16LE,dataset,dims,istatus)
!close dataset
call h5dclose_f(dsetid,istatus)
return !istatus will be 0 here
end subroutine get_dataset_int
I am getting this compile error.
mpif90 -f90=ifort -c -xSSE4.2 -g -no-ansi-alias -ip -ftz -fp-model precise -w -nomixed_str_len_arg -names lowercase -convert big_endian -assume byterecl -DSPMD -DHIDE_SHR_MSG -DNO_SHR_VMATH -DIFC -I/usr/local/tools/intel/hdfeos-2.18/include -I/usr/local/tools/intel/hdf-4.2.6/include -I/usr/local/tools/intel/hdf5-1.8.7/include testhdf.F90
testhdf.F90(211): error #6285: There is no matching specific subroutine for this generic subroutine call. [H5DREAD_F]
call h5dread_f(dsetid,H5T_STD_U16LE,dataset,dims,istatus)
-------^
compilation aborted for testhdf.F90 (code 1)
It compiles fine if the integer variable “dataset” is a default (4-byte) integer, but when I specify integer*2 or integer(kind=2) it does not compile. What am I doing wrong?
Thanks,
Clay
···
--
Clay Blankenship * USRA Research Scientist
clay.blankenship@nasa.gov * 256-961-7638
320 Sparkman Drive * Huntsville, AL 35805 USA
NASA-MSFC Short-Term Prediction Research and Transition (SPoRT) Center