confusion with the datatypes

Hi,

I am writing my data as (1.6.x):

status = H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, (double*)data);

Checking back as:

hid_t dataset = H5Dopen(file, name.c_str());
if(dataset<0) fail();
hid_t datatype = H5Dget_type(dataset);
hid_t native_type = H5Tget_native_type(datatype, H5T_DIR_ASCEND);

I am frustrated to find that native_type is nothing from what's listed in the docu:

"H5Tget_native_type selects the matching native datatype from the following list:

         H5T_NATIVE_CHAR
         H5T_NATIVE_SHORT
         H5T_NATIVE_INT
         H5T_NATIVE_LONG
         H5T_NATIVE_LLONG

         H5T_NATIVE_UCHAR
         H5T_NATIVE_USHORT
         H5T_NATIVE_UINT
         H5T_NATIVE_ULONG
         H5T_NATIVE_ULLONG

         H5T_NATIVE_FLOAT
         H5T_NATIVE_DOUBLE
         H5T_NATIVE_LDOUBLE"

It is just a value from the moon 201326869 while all the above are in the range 201326600-201326636

It is not the first time I am stuck with the the HDF5 datatypes and I wonder what I miss / why it is so confusing. In particular, I find telling H5T_INTEGER from H5T_NATIVE_INT not something to care about by a regular user.

Thanks for any clarifications,

with regards,

···

--
Dominik Szczerba, Ph.D.
Biomedical Simulation Group
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Dominik,

Hi,

I am writing my data as (1.6.x):

status = H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, (double*)data);

Checking back as:

hid_t dataset = H5Dopen(file, name.c_str());
if(dataset<0) fail();
hid_t datatype = H5Dget_type(dataset);
hid_t native_type = H5Tget_native_type(datatype, H5T_DIR_ASCEND);

I am frustrated to find that native_type is nothing from what's listed in the docu:

"H5Tget_native_type selects the matching native datatype from the following list:

       H5T_NATIVE_CHAR
       H5T_NATIVE_SHORT
       H5T_NATIVE_INT
       H5T_NATIVE_LONG
       H5T_NATIVE_LLONG

       H5T_NATIVE_UCHAR
       H5T_NATIVE_USHORT
       H5T_NATIVE_UINT
       H5T_NATIVE_ULONG
       H5T_NATIVE_ULLONG

       H5T_NATIVE_FLOAT
       H5T_NATIVE_DOUBLE
       H5T_NATIVE_LDOUBLE"

It is just a value from the moon 201326869 while all the above are in the range 201326600-201326636

It is not the first time I am stuck with the the HDF5 datatypes and I wonder what I miss / why it is so confusing. In particular, I find telling H5T_INTEGER from H5T_NATIVE_INT not something to care about by a regular user.

  I'm not certain that I'm replying to your underlying concern, but maybe this will help: The IDs for datatypes (including the global IDs like H5T_NATIVE_INT, H5T_NATIVE_LONG, etc) should be treated like pointers to objects (in C++, for example). Thus, it doesn't make any sense to compare the IDs for equality, instead you should use the H5Tequal() API routine to check whether two datatypes are equal.

  Quincey

···

On Jun 6, 2008, at 4:00 PM, Dominik Szczerba wrote:

Thanks for any clarifications,

with regards,

--
Dominik Szczerba, Ph.D.
Biomedical Simulation Group
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Well yes, as always, I get the right answer here.
But I do maintain my opinion, that while hdf5 is really something great for standarization of datasets, it could be a bit more intuitive to use for an end user :slight_smile:
Thanks a lot and best regards,
Dominik

Quincey Koziol wrote:

···

Hi Dominik,

On Jun 6, 2008, at 4:00 PM, Dominik Szczerba wrote:

Hi,

I am writing my data as (1.6.x):

status = H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, (double*)data);

Checking back as:

hid_t dataset = H5Dopen(file, name.c_str());
if(dataset<0) fail();
hid_t datatype = H5Dget_type(dataset);
hid_t native_type = H5Tget_native_type(datatype, H5T_DIR_ASCEND);

I am frustrated to find that native_type is nothing from what's listed in the docu:

"H5Tget_native_type selects the matching native datatype from the following list:

       H5T_NATIVE_CHAR
       H5T_NATIVE_SHORT
       H5T_NATIVE_INT
       H5T_NATIVE_LONG
       H5T_NATIVE_LLONG

       H5T_NATIVE_UCHAR
       H5T_NATIVE_USHORT
       H5T_NATIVE_UINT
       H5T_NATIVE_ULONG
       H5T_NATIVE_ULLONG

       H5T_NATIVE_FLOAT
       H5T_NATIVE_DOUBLE
       H5T_NATIVE_LDOUBLE"

It is just a value from the moon 201326869 while all the above are in the range 201326600-201326636

It is not the first time I am stuck with the the HDF5 datatypes and I wonder what I miss / why it is so confusing. In particular, I find telling H5T_INTEGER from H5T_NATIVE_INT not something to care about by a regular user.

    I'm not certain that I'm replying to your underlying concern, but maybe this will help: The IDs for datatypes (including the global IDs like H5T_NATIVE_INT, H5T_NATIVE_LONG, etc) should be treated like pointers to objects (in C++, for example). Thus, it doesn't make any sense to compare the IDs for equality, instead you should use the H5Tequal() API routine to check whether two datatypes are equal.

    Quincey

Thanks for any clarifications,

with regards,

--
Dominik Szczerba, Ph.D.
Biomedical Simulation Group
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

--
Dominik Szczerba, Ph.D.
Biomedical Simulation Group
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi