HDF5-DIAG: Error detected in HDF5 (1.10.4) thread 0:


#1

Hi Greetings,

I am trying to execute code using H5Dread function,mem id used is H5T_Compound type at runtime I am getting following error,

#000: c:\autotest\hdf5110-stdrelease-dist-10vs15\build\hdfsrc\src\h5dio.c line 199 in H5Dread(): can’t read data
major: Dataset
minor: Read failed
#001: c:\autotest\hdf5110-stdrelease-dist-10vs15\build\hdfsrc\src\h5dio.c line 467 in H5D__read(): unable to set up type info
major: Dataset
minor: Unable to initialize object
#002: c:\autotest\hdf5110-stdrelease-dist-10vs15\build\hdfsrc\src\h5dio.c line 993 in H5D__typeinfo_init(): unable to convert between src and dest datatype
major: Dataset
minor: Feature is unsupported
#003: c:\autotest\hdf5110-stdrelease-dist-10vs15\build\hdfsrc\src\h5t.c line 4546 in H5T_path_find(): can’t find datatype conversion path
major: Datatype
minor: Can’t get value
#004: c:\autotest\hdf5110-stdrelease-dist-10vs15\build\hdfsrc\src\h5t.c line 4762 in H5T__path_find_real(): no appropriate function for conversion path
major: Datatype
minor: Unable to initialize object

following code I used
hid_t dataspace = H5Dget_space(datasetname);
int dimesions = H5Sget_simple_extent_ndims(dataspace);

	 int ndims = H5Sget_simple_extent_dims(dataspace, dims, NULL);
	cout << "number of dimensions " << dims[0] << endl;
	 hid_t memspace = H5Screate_simple(1, dims, NULL);

	vehicle_t  *rdata;
	rdata = (vehicle_t *)malloc(dims[0] * sizeof(vehicle_t));

	hid_t memtype = H5Tcreate(H5T_COMPOUND, sizeof(vehicle_t));

	
	herr_t status = H5Dread(datasetname, memtype,memspace,dataspace, H5P_DEFAULT, rdata);

vechile type is structure


#2

Hi @chandrasekhar.kolapa,

I suspect what is going on is that HDF5 is unable to read from the dataset using your compound type because your compound type has no fields in it. If you know ahead of time what the dataset’s compound datatype consists of in terms of compound fields, or if you need to perform some sort of type conversion on a per-field basis, you can insert these fields into your compound type using H5Tinsert (https://portal.hdfgroup.org/display/HDF5/H5T_INSERT) and the HOFFSET macro. For an example of how to do this, refer to https://bitbucket.hdfgroup.org/projects/HDFFV/repos/hdf5/browse/examples/h5_compound.c.

For your case though, I believe it would be simpler to just retrieve the datatype of the dataset using:

hid_t memtype = H5Dget_type(datasetname);

and then pass that as the memtype to H5Dread.