error reading hdf5 in C++

I'm trying to read in from an hdf5 generated with HDF5 Version: 1.8.4 on
ubuntu x86_64-pc-linux-gnu system in C++.
     
     H5::H5File h5file = H5::H5File();
     h5file.openFile(dbfile, H5F_ACC_RDWR );
     H5::Group group = h5file.openGroup("/vessel_graph/vertex_properties");
     H5::DataSet dataset_centre = group.openDataSet( "centre");
     H5::DataSpace dataspace = dataset_centre.getSpace();
     int rank = dataspace.getSimpleExtentNdims();
     hsize_t dims_out[2];
     int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);

     // Define the memory dataspace.
     H5::DataSpace memspace( rank, dims_out );
     float centres[(unsigned long)(dims_out[0])][(unsigned
long)(dims_out[1])];
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

     dataset_centre.close();
     group.close();
     h5file.close();

The code is reading the centers correctly into the float centres however ad
the line "dataset_centre.read()" it's throwing this error:
     HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 139812794677152:
       #000: ../../../src/H5T.c line 1707 in H5Tclose(): immutable datatype
         major: Invalid arguments to routine
         minor: Bad value
     DataType::~DataType - H5Tclose failed

It seems to be a warning since the code continues to execute and read
correctly. But I don't understand where this error is coming from or how to
fix it. Any idea?
Thank you in advance,
Sahar

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/error-reading-hdf5-in-C-tp2667201p2667201.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Hi Sahar,

Please try using PredType::NATIVE_FLOAT instead of the C type
H5T_NATIVE_FLOAT in the following statement:
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

Thanks,
Binh-Minh

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of sghanavati
Sent: Friday, March 11, 2011 5:45 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] error reading hdf5 in C++

I'm trying to read in from an hdf5 generated with HDF5 Version: 1.8.4 on
ubuntu x86_64-pc-linux-gnu system in C++.
     
     H5::H5File h5file = H5::H5File();
     h5file.openFile(dbfile, H5F_ACC_RDWR );
     H5::Group group = h5file.openGroup("/vessel_graph/vertex_properties");
     H5::DataSet dataset_centre = group.openDataSet( "centre");
     H5::DataSpace dataspace = dataset_centre.getSpace();
     int rank = dataspace.getSimpleExtentNdims();
     hsize_t dims_out[2];
     int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);

     // Define the memory dataspace.
     H5::DataSpace memspace( rank, dims_out );
     float centres[(unsigned long)(dims_out[0])][(unsigned
long)(dims_out[1])];
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

     dataset_centre.close();
     group.close();
     h5file.close();

The code is reading the centers correctly into the float centres however ad
the line "dataset_centre.read()" it's throwing this error:
     HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 139812794677152:
       #000: ../../../src/H5T.c line 1707 in H5Tclose(): immutable datatype
         major: Invalid arguments to routine
         minor: Bad value
     DataType::~DataType - H5Tclose failed

It seems to be a warning since the code continues to execute and read
correctly. But I don't understand where this error is coming from or how to
fix it. Any idea?
Thank you in advance,
Sahar

--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/error-reading-hdf5-in-C-tp2667201p2667
201.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

Hi Binh-Minh,
Thanks for your reply.
However, when I try using PredType::NATIVE_FLOAT instead of the C type H5T_NATIVE_FLOAT, i get an error during compiling as follows:
error: ‘PredType’ has not been declared.
Do you know what's wrong?
Thanks
Sahar

···

----- Original Message -----
From: Binh-Minh Ribler <bmribler@hdfgroup.org>
Sent: Fri, 3/11/2011 8:48pm
To: 'HDF Users Discussion List' <hdf-forum@hdfgroup.org>
Subject: Re: [Hdf-forum] error reading hdf5 in C++

Hi Sahar,

Please try using PredType::NATIVE_FLOAT instead of the C type
H5T_NATIVE_FLOAT in the following statement:
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

Thanks,
Binh-Minh

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of sghanavati
Sent: Friday, March 11, 2011 5:45 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] error reading hdf5 in C++

I'm trying to read in from an hdf5 generated with HDF5 Version: 1.8.4 on
ubuntu x86_64-pc-linux-gnu system in C++.
     
     H5::H5File h5file = H5::H5File();
     h5file.openFile(dbfile, H5F_ACC_RDWR );
     H5::Group group = h5file.openGroup("/vessel_graph/vertex_properties");
     H5::DataSet dataset_centre = group.openDataSet( "centre");
     H5::DataSpace dataspace = dataset_centre.getSpace();
     int rank = dataspace.getSimpleExtentNdims();
     hsize_t dims_out[2];
     int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);

     // Define the memory dataspace.
     H5::DataSpace memspace( rank, dims_out );
     float centres[(unsigned long)(dims_out[0])][(unsigned
long)(dims_out[1])];
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

     dataset_centre.close();
     group.close();
     h5file.close();

The code is reading the centers correctly into the float centres however ad
the line "dataset_centre.read()" it's throwing this error:
     HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 139812794677152:
       #000: ../../../src/H5T.c line 1707 in H5Tclose(): immutable datatype
         major: Invalid arguments to routine
         minor: Bad value
     DataType::~DataType - H5Tclose failed

It seems to be a warning since the code continues to execute and read
correctly. But I don't understand where this error is coming from or how to
fix it. Any idea?
Thank you in advance,
Sahar

--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/error-reading-hdf5-in-C-tp2667201p2667
201.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi Sahar,

It seemed that there is a typo here: H5::PredType instead of PredType. Or,
you could use "using namespace H5;"

Binh-Minh

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of Sahar Ghanavati
Sent: Monday, March 14, 2011 9:39 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] error reading hdf5 in C++

Hi Binh-Minh,
Thanks for your reply.
However, when I try using PredType::NATIVE_FLOAT instead of the C type
H5T_NATIVE_FLOAT, i get an error during compiling as follows:
error: 'PredType' has not been declared.
Do you know what's wrong?
Thanks
Sahar

----- Original Message -----
From: Binh-Minh Ribler <bmribler@hdfgroup.org>
Sent: Fri, 3/11/2011 8:48pm
To: 'HDF Users Discussion List' <hdf-forum@hdfgroup.org>
Subject: Re: [Hdf-forum] error reading hdf5 in C++

Hi Sahar,

Please try using PredType::NATIVE_FLOAT instead of the C type
H5T_NATIVE_FLOAT in the following statement:
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

Thanks,
Binh-Minh

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-bounces@hdfgroup.org]
On Behalf Of sghanavati
Sent: Friday, March 11, 2011 5:45 PM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] error reading hdf5 in C++

I'm trying to read in from an hdf5 generated with HDF5 Version: 1.8.4 on
ubuntu x86_64-pc-linux-gnu system in C++.
     
     H5::H5File h5file = H5::H5File();
     h5file.openFile(dbfile, H5F_ACC_RDWR );
     H5::Group group = h5file.openGroup("/vessel_graph/vertex_properties");
     H5::DataSet dataset_centre = group.openDataSet( "centre");
     H5::DataSpace dataspace = dataset_centre.getSpace();
     int rank = dataspace.getSimpleExtentNdims();
     hsize_t dims_out[2];
     int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);

     // Define the memory dataspace.
     H5::DataSpace memspace( rank, dims_out );
     float centres[(unsigned long)(dims_out[0])][(unsigned
long)(dims_out[1])];
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

     dataset_centre.close();
     group.close();
     h5file.close();

The code is reading the centers correctly into the float centres however ad
the line "dataset_centre.read()" it's throwing this error:
     HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 139812794677152:
       #000: ../../../src/H5T.c line 1707 in H5Tclose(): immutable datatype
         major: Invalid arguments to routine
         minor: Bad value
     DataType::~DataType - H5Tclose failed

It seems to be a warning since the code continues to execute and read
correctly. But I don't understand where this error is coming from or how to
fix it. Any idea?
Thank you in advance,
Sahar

--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/error-reading-hdf5-in-C-tp2667201p2667
201.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org