Get Information From DataType

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Get Information From DataType

Todd Dobmeyer
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.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Information From DataType

Binh-Minh Ribler

Hi Todd,


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


Binh-Minh



From: Hdf-forum <[hidden email]> on behalf of Todd Dobmeyer <[hidden email]>
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.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Information From DataType

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 <[hidden email]> wrote:

Hi Todd,


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


Binh-Minh



From: Hdf-forum <[hidden email]> on behalf of Todd Dobmeyer <[hidden email]>
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.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5


_______________________________________________
Hdf-forum is for HDF software users discussion.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Get Information From DataType

Binh-Minh Ribler

Hi Todd,


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

Thanks for letting us know.


Binh-Minh



From: Hdf-forum <[hidden email]> on behalf of Todd Dobmeyer <[hidden email]>
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 <[hidden email]> wrote:

Hi Todd,


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


Binh-Minh



From: Hdf-forum <[hidden email]> on behalf of Todd Dobmeyer <[hidden email]>
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.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5


_______________________________________________
Hdf-forum is for HDF software users discussion.
[hidden email]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
Loading...