Get Information From DataType

I have many HDF5 files I need to parse. A portion of my DataType is listed
below. In my H5T_COMPOUND, I have a H5T_ARRAY called iq_data. How in my
code can I get the number of elements in this array? From file to file,
this array can vary in size and not always be 1000 elements. I am trying to
figure out how to do this in C++ preferably but C is fine as well. I can
obviously get the DataType object easily in C++, but don't know how to read
information from this object.

HDF5 "hdfFile.be01" {
GROUP "/" {
   DATATYPE "DRdata" H5T_COMPOUND {
      H5T_ARRAY { [5] H5T_STD_U32LE } "guid";
      H5T_STD_I32LE "version";
      ...
      H5T_STD_U32LE "num_samps";
      ...
      H5T_STD_U32LE "sequence_dummy";
      H5T_ARRAY { [1000] H5T_COMPOUND {
         H5T_IEEE_F32LE "f_i";
         H5T_IEEE_F32LE "f_q";
      } } "iq_data";
   }

Thanks!
Todd Dobmeyer

Hi Todd,

Have you tried getting the ArrayType using CompType::getMemberArrayType, then ArrayType::getArrayDims?

Binh-Minh

···

________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of Todd Dobmeyer <toddatwsu@gmail.com>
Sent: Tuesday, July 19, 2016 2:50 PM
To: HDF Users Discussion List
Subject: [Hdf-forum] Get Information From DataType

I have many HDF5 files I need to parse. A portion of my DataType is listed below. In my H5T_COMPOUND, I have a H5T_ARRAY called iq_data. How in my code can I get the number of elements in this array? From file to file, this array can vary in size and not always be 1000 elements. I am trying to figure out how to do this in C++ preferably but C is fine as well. I can obviously get the DataType object easily in C++, but don't know how to read information from this object.

HDF5 "hdfFile.be01" {
GROUP "/" {
   DATATYPE "DRdata" H5T_COMPOUND {
      H5T_ARRAY { [5] H5T_STD_U32LE } "guid";
      H5T_STD_I32LE "version";
      ...
      H5T_STD_U32LE "num_samps";
      ...
      H5T_STD_U32LE "sequence_dummy";
      H5T_ARRAY { [1000] H5T_COMPOUND {
         H5T_IEEE_F32LE "f_i";
         H5T_IEEE_F32LE "f_q";
      } } "iq_data";
   }

Thanks!
Todd Dobmeyer

Binh-Minh

Thank you so much! I was missing the fact I could call openCompType from my
H5File. I was always just getting the generic DataType object. This worked
perfectly! Thank you again!

Todd

···

On Wed, Jul 20, 2016 at 2:42 AM, Binh-Minh Ribler <bmribler@hdfgroup.org> wrote:

Hi Todd,

Have you tried getting the ArrayType using CompType::getMemberArrayType,
then ArrayType::getArrayDims?

Binh-Minh

------------------------------
*From:* Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of
Todd Dobmeyer <toddatwsu@gmail.com>
*Sent:* Tuesday, July 19, 2016 2:50 PM
*To:* HDF Users Discussion List
*Subject:* [Hdf-forum] Get Information From DataType

I have many HDF5 files I need to parse. A portion of my DataType is listed
below. In my H5T_COMPOUND, I have a H5T_ARRAY called iq_data. How in my
code can I get the number of elements in this array? From file to file,
this array can vary in size and not always be 1000 elements. I am trying to
figure out how to do this in C++ preferably but C is fine as well. I can
obviously get the DataType object easily in C++, but don't know how to read
information from this object.

HDF5 "hdfFile.be01" {
GROUP "/" {
   DATATYPE "DRdata" H5T_COMPOUND {
      H5T_ARRAY { [5] H5T_STD_U32LE } "guid";
      H5T_STD_I32LE "version";
      ...
      H5T_STD_U32LE "num_samps";
      ...
      H5T_STD_U32LE "sequence_dummy";
      H5T_ARRAY { [1000] H5T_COMPOUND {
         H5T_IEEE_F32LE "f_i";
         H5T_IEEE_F32LE "f_q";
      } } "iq_data";
   }

Thanks!
Todd Dobmeyer

_______________________________________________
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

Hi Todd,

I'm glad it worked. You are very welcome. :slight_smile:

Thanks for letting us know.

Binh-Minh

···

________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of Todd Dobmeyer <toddatwsu@gmail.com>
Sent: Wednesday, July 20, 2016 10:50 AM
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] Get Information From DataType

Binh-Minh

Thank you so much! I was missing the fact I could call openCompType from my H5File. I was always just getting the generic DataType object. This worked perfectly! Thank you again!

Todd

On Wed, Jul 20, 2016 at 2:42 AM, Binh-Minh Ribler <bmribler@hdfgroup.org<mailto:bmribler@hdfgroup.org>> wrote:

Hi Todd,

Have you tried getting the ArrayType using CompType::getMemberArrayType, then ArrayType::getArrayDims?

Binh-Minh

________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org<mailto:hdf-forum-bounces@lists.hdfgroup.org>> on behalf of Todd Dobmeyer <toddatwsu@gmail.com<mailto:toddatwsu@gmail.com>>
Sent: Tuesday, July 19, 2016 2:50 PM
To: HDF Users Discussion List
Subject: [Hdf-forum] Get Information From DataType

I have many HDF5 files I need to parse. A portion of my DataType is listed below. In my H5T_COMPOUND, I have a H5T_ARRAY called iq_data. How in my code can I get the number of elements in this array? From file to file, this array can vary in size and not always be 1000 elements. I am trying to figure out how to do this in C++ preferably but C is fine as well. I can obviously get the DataType object easily in C++, but don't know how to read information from this object.

HDF5 "hdfFile.be01" {
GROUP "/" {
   DATATYPE "DRdata" H5T_COMPOUND {
      H5T_ARRAY { [5] H5T_STD_U32LE } "guid";
      H5T_STD_I32LE "version";
      ...
      H5T_STD_U32LE "num_samps";
      ...
      H5T_STD_U32LE "sequence_dummy";
      H5T_ARRAY { [1000] H5T_COMPOUND {
         H5T_IEEE_F32LE "f_i";
         H5T_IEEE_F32LE "f_q";
      } } "iq_data";
   }

Thanks!
Todd Dobmeyer

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