On Jul 27, 2016, at 1:18 PM, Blankenship, Clay B. (MSFC-ZP11)[USRA]
<[email protected]<mailto:[email protected]>> wrote:
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)
The compiled version of the your hdf library does not have an interface for
h5dread_f where “dataset” is INTEGER*2 (you would have to send the config.log
to see why). Newer versions of HDF5, 1.8.17 and 1.10.0, provide a
comprehensive number of interface for all available KINDS. In fact, 1.10.0 was
revamped to auto-generate the interfaces for all available KINDS (REAL AND
INTEGER) for arrays up to 7 dimensions.
However, if you can upgrade to 1.8.8 then you can use the F2003 interface for
h5dread_f where you pass a pointer as the argument for the buffer, that way you
can avoid worrying about matching interfaces. This is the recommended practice.
Matching interfaces is not feasible in HDF5 for F2003 because array ranks can
be up to 15 (or even 31 for some compilers).
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
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5