How to store array of mixed integer and float

I have the following data structure that I would like to store into a single HDF5 data set:

struct {
int v1
int v2
int v3
int v4
float v5
int v6
}

What would be the best way to do this? I know there is a way to store a "custom" data type but I am coming up empty finding out how to do this. Also what are the downsides to using a custom data type with respect to portability across architectures?

Thanks for any help

···

___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

Mike,

You can use HDF5 compound datatype. It is portable across architectures. Please see C example h5ex_t_cpxcmpd.c at http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api18-c.html under the Datatypes section how to use it. User's Guide also has a section on compound datatypes (under the Datatypes link).

Elena

···

On Mar 24, 2011, at 9:25 AM, Michael Jackson wrote:

I have the following data structure that I would like to store into a single HDF5 data set:

struct {
int v1
int v2
int v3
int v4
float v5
int v6
}

What would be the best way to do this? I know there is a way to store a "custom" data type but I am coming up empty finding out how to do this. Also what are the downsides to using a custom data type with respect to portability across architectures?

Thanks for any help
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

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

Will that work with the HDF5 1.6 library?

···

___________________________________________________________
Mike Jackson www.bluequartz.net

On Mar 24, 2011, at 10:34 AM, Elena Pourmal wrote:

Mike,

You can use HDF5 compound datatype. It is portable across architectures. Please see C example h5ex_t_cpxcmpd.c at http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api18-c.html under the Datatypes section how to use it. User's Guide also has a section on compound datatypes (under the Datatypes link).

Elena
On Mar 24, 2011, at 9:25 AM, Michael Jackson wrote:

I have the following data structure that I would like to store into a single HDF5 data set:

struct {
int v1
int v2
int v3
int v4
float v5
int v6
}

What would be the best way to do this? I know there is a way to store a "custom" data type but I am coming up empty finding out how to do this. Also what are the downsides to using a custom data type with respect to portability across architectures?

Thanks for any help
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

_______________________________________________
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

Will that work with the HDF5 1.6 library?

Not quite. See 1.6 counterpart here http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api16-c.html

···

On Mar 24, 2011, at 10:30 AM, Michael Jackson wrote:

___________________________________________________________
Mike Jackson www.bluequartz.net

On Mar 24, 2011, at 10:34 AM, Elena Pourmal wrote:

Mike,

You can use HDF5 compound datatype. It is portable across architectures. Please see C example h5ex_t_cpxcmpd.c at http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/api18-c.html under the Datatypes section how to use it. User's Guide also has a section on compound datatypes (under the Datatypes link).

Elena
On Mar 24, 2011, at 9:25 AM, Michael Jackson wrote:

I have the following data structure that I would like to store into a single HDF5 data set:

struct {
int v1
int v2
int v3
int v4
float v5
int v6
}

What would be the best way to do this? I know there is a way to store a "custom" data type but I am coming up empty finding out how to do this. Also what are the downsides to using a custom data type with respect to portability across architectures?

Thanks for any help
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

_______________________________________________
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

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