help for reading a dataset with f90 code

Hello,
this looks like a simple problem but it got me stuck. I am trying to read
a dataset but to my understanding there is some problem with conversion of
data between file format (big endian) and my linux (little endian)
h5dump output looks like that

HDF5
"IVAOT_npp_d20151206_t0500124_e0501366_b21279_c20151206065638288374_noaa_ops.h5"
{
GROUP "/" {
...
   GROUP "All_Data" {
      GROUP "VIIRS-Aeros-Opt-Thick-IP_All" {
....

         DATASET "faot550" {
            DATATYPE H5T_IEEE_F32BE
            DATASPACE SIMPLE { ( 768, 3200 ) / ( H5S_UNLIMITED,
H5S_UNLIMITED ) }
         }
...

I want to read content of faot550.
The program looks like below and all seems to work fine until I attempt to
read the dataset

Thanks for any suggestions/help
Mark

...

  CHARACTER(LEN=80), PARAMETER :: dataset_aod = &
       &"/All_Data/VIIRS-Aeros-Opt-Thick-IP_All/faot550"

  TYPE(C_PTR) :: f_ptr_aod

  INTEGER(HID_T) :: file_aod, filetype_aod, memtype_aod, space_aod,
dset_aod, &
       &group_aod, attr_aod ! Handles

  REAL, DIMENSION(:,:), ALLOCATABLE, TARGET :: rdata_aod
  INTEGER(HSIZE_T), DIMENSION(1:2) :: dims_aod,maxdims

  TYPE(C_PTR) :: f_ptr_aod
  REAL, DIMENSION(:,:), ALLOCATABLE, TARGET :: rdata_aod

...

  CALL h5open_f(hdferr)
  PRINT *,hdferr
  CALL h5fopen_f(filename_aod, H5F_ACC_RDONLY_F, file_aod, hdferr)
  PRINT *,hdferr
  CALL h5dopen_f(file_aod, dataset_aod, dset_aod, hdferr)
  PRINT *,hdferr
  CALL h5dget_space_f (dset_aod, space_aod, hdferr)
  PRINT *,hdferr
  CALL h5sget_simple_extent_ndims_f(space_aod, rank_aod, hdferr)
  PRINT *,hdferr,rank_aod
  CALL h5sget_simple_extent_dims_f(space_aod, dims_aod, maxdims, hdferr)
  PRINT *,hdferr,dims_aod,maxdims
  CALL h5tarray_create_f(H5T_NATIVE_REAL, rank_aod, dims_aod, memtype_aod,
hdferr)
  PRINT *,hdferr,memtype_aod, rank_aod, dims_aod
  ALLOCATE(rdata_aod(dims_aod(1),dims_aod(2)))
  PRINT *,SIZE(rdata_aod(1,:)),SIZE(rdata_aod(:,1))
  f_ptr_aod = C_LOC(rdata_aod(1,1))
  CALL h5dread_f (dset_aod, memtype_aod, f_ptr_aod, hdferr)
  PRINT *,hdferr

....

           0
           0
           0
           0
           0 2
           2 3200 768
-1
                    -1
           0 50331790 2 3200
  768
         768 3200
HDF5-DIAG: Error detected in HDF5 (1.8.14) thread 0:
  #000: H5Dio.c line 173 in H5Dread(): can't read data
    major: Dataset
    minor: Read failed
  #001: H5Dio.c line 425 in H5D__read(): unable to set up type info
    major: Dataset
    minor: Unable to initialize object
  #002: H5Dio.c line 957 in H5D__typeinfo_init(): unable to convert between
src and dest datat\
ype
    major: Dataset
    minor: Feature is unsupported
  #003: H5T.c line 4532 in H5T_path_find(): no appropriate function for
conversion path
    major: Datatype
    minor: Unable to initialize object
  #002: H5Dio.c line 957 in H5D__typeinfo_init(): unable to convert between
src and dest datat\
ype
    major: Dataset
    minor: Feature is unsupported
  #003: H5T.c line 4532 in H5T_path_find(): no appropriate function for
conversion path
    major: Datatype
    minor: Unable to initialize object
          -1

Your dataset is just a two-dimensional array of reals; it does not an array of "arrays of reals” (This is the datatype you construct with the H5tcreate_array_f call.)

Just use H5T_NATIVE_REAL instead of memtype_aod in the h5dread_f call.

Elena

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Feb 4, 2016, at 12:00 PM, M P <mzp3769@gmail.com> wrote:

Hello,
this looks like a simple problem but it got me stuck. I am trying to read a dataset but to my understanding there is some problem with conversion of data between file format (big endian) and my linux (little endian)
h5dump output looks like that

HDF5 "IVAOT_npp_d20151206_t0500124_e0501366_b21279_c20151206065638288374_noaa_ops.h5" {
GROUP "/" {
...
   GROUP "All_Data" {
      GROUP "VIIRS-Aeros-Opt-Thick-IP_All" {
....

         DATASET "faot550" {
            DATATYPE H5T_IEEE_F32BE
            DATASPACE SIMPLE { ( 768, 3200 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
         }
...

I want to read content of faot550.
The program looks like below and all seems to work fine until I attempt to read the dataset

Thanks for any suggestions/help
Mark

...

  CHARACTER(LEN=80), PARAMETER :: dataset_aod = &
       &"/All_Data/VIIRS-Aeros-Opt-Thick-IP_All/faot550"

  TYPE(C_PTR) :: f_ptr_aod

  INTEGER(HID_T) :: file_aod, filetype_aod, memtype_aod, space_aod, dset_aod, &
       &group_aod, attr_aod ! Handles

  REAL, DIMENSION(:,:), ALLOCATABLE, TARGET :: rdata_aod
  INTEGER(HSIZE_T), DIMENSION(1:2) :: dims_aod,maxdims

  TYPE(C_PTR) :: f_ptr_aod
  REAL, DIMENSION(:,:), ALLOCATABLE, TARGET :: rdata_aod

...

  CALL h5open_f(hdferr)
  PRINT *,hdferr
  CALL h5fopen_f(filename_aod, H5F_ACC_RDONLY_F, file_aod, hdferr)
  PRINT *,hdferr
  CALL h5dopen_f(file_aod, dataset_aod, dset_aod, hdferr)
  PRINT *,hdferr
  CALL h5dget_space_f (dset_aod, space_aod, hdferr)
  PRINT *,hdferr
  CALL h5sget_simple_extent_ndims_f(space_aod, rank_aod, hdferr)
  PRINT *,hdferr,rank_aod
  CALL h5sget_simple_extent_dims_f(space_aod, dims_aod, maxdims, hdferr)
  PRINT *,hdferr,dims_aod,maxdims
  CALL h5tarray_create_f(H5T_NATIVE_REAL, rank_aod, dims_aod, memtype_aod, hdferr)
  PRINT *,hdferr,memtype_aod, rank_aod, dims_aod
  ALLOCATE(rdata_aod(dims_aod(1),dims_aod(2)))
  PRINT *,SIZE(rdata_aod(1,:)),SIZE(rdata_aod(:,1))
  f_ptr_aod = C_LOC(rdata_aod(1,1))
  CALL h5dread_f (dset_aod, memtype_aod, f_ptr_aod, hdferr)
  PRINT *,hdferr

....

           0
           0
           0
           0
           0 2
           2 3200 768 -1
                    -1
           0 50331790 2 3200 768
         768 3200
HDF5-DIAG: Error detected in HDF5 (1.8.14) thread 0:
  #000: H5Dio.c line 173 in H5Dread(): can't read data
    major: Dataset
    minor: Read failed
  #001: H5Dio.c line 425 in H5D__read(): unable to set up type info
    major: Dataset
    minor: Unable to initialize object
  #002: H5Dio.c line 957 in H5D__typeinfo_init(): unable to convert between src and dest datat\
ype
    major: Dataset
    minor: Feature is unsupported
  #003: H5T.c line 4532 in H5T_path_find(): no appropriate function for conversion path
    major: Datatype
    minor: Unable to initialize object
  #002: H5Dio.c line 957 in H5D__typeinfo_init(): unable to convert between src and dest datat\
ype
    major: Dataset
    minor: Feature is unsupported
  #003: H5T.c line 4532 in H5T_path_find(): no appropriate function for conversion path
    major: Datatype
    minor: Unable to initialize object
          -1

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5