Check Type of Data in Dataset?

I created and successfully wrote out a dataset of type
H5T_NATIVE_DOUBLE -- if I run h5dump I can verify that the datatype is
H5T_IEEE_F64LE, and all of my data is there. If I then try to get the
datatype with the following code

... code that created the dataset ...
hid_t dtype_id = H5Dget_type( dataset_id );
std::cout << dtype_id << std::endl;
std::cout << H5T_IEEE_F64LE << std::endl;

the values do not match up. I think I have a conceptual
misunderstanding of what H5Dget_type returns. Is there some
programatic way I can get the datatype of a dataset, and verify that
indeed contains double precision numbers?

Thank you for your advice.

That ID is a handle. It is a value that is only valid at runtime - that far I understood HDF5.
For checking types for equality there are things like H5Tequal(...) - but I had not much of expected success when using that myself in a single case.

···

-----Ursprüngliche Nachricht-----
hid_t dtype_id = H5Dget_type( dataset_id ); std::cout << dtype_id << std::endl; std::cout << H5T_IEEE_F64LE << std::endl;

Thanks for the pointer to H5Tequal. The following code seems to do the
trick:

hid_t dtype_id = H5Dget_type( dataset_id );
bool is_native_double = H5Tequal( dtype_id, H5T_NATIVE_DOUBLE ) > 0;
H5Tclose( dtype_id );
...

···

On Mon, Jul 28, 2014 at 9:00 AM, Stohr, Alexander <Alexander.Stohr@hdle.com> wrote:

That ID is a handle. It is a value that is only valid at runtime - that
far I understood HDF5.
For checking types for equality there are things like H5Tequal(...) - but
I had not much of expected success when using that myself in a single case.

-----Ursprüngliche Nachricht-----
hid_t dtype_id = H5Dget_type( dataset_id ); std::cout << dtype_id <<
std::endl; std::cout << H5T_IEEE_F64LE << std::endl;

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org

http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5