How to write a compound datatype with variable-length fields in HDF5 file

Hi,

I missed to add a very important detail to my previous e-mail. As the sizes of ms_data(1)%biomass(:slight_smile: and ms_data(1)%mortality(:slight_smile: are not equal; also the sizes of ms_data(1)%biomass(:slight_smile: and ms_data(2)%biomass(:slight_smile: are not equal.

Regards,

Ekin

ยทยทยท

On 03/14/2012 01:49 PM, Ekin Akoglu wrote:

Hi,

Please let me put it this way. I have a user-defined type in FORTRAN called "ep_data" of dimension 4, i.e. ep_data(4). It has fields named biomass, pob, qob, ... etc. and so on. Each field holds a scalar value. For instance, if you print "ep_data(1)%biomass", it will give you, let's say, "4". In other words, fields of "ep_data" are not arrays. I succeeded to write this "ep_data" to HDF5 by using compound datatype. So no problem up till here. However, I have another user-defined type called "ms_data" in FORTRAN of size 7, i.e. , "ms_data(7)" and just like "ep_data", it also has fields named biomass, mortality, qob, ... etc. and so on. Differently from "ep_data" type, "ms_data" fields are arrays of different size. For instance, if you print "ms_data(1)%biomass(:)"|, you will get an array of real numbers. And if you print "ms_data(1)%mortality(:)", you also get an array of real numbers of different length that of "biomass" field. So, how can I store "ms_data" in HDF5 format?

For your reference, my FORTRAN implementation of storing "ep_data" is attached.

Regards,

Ekin

On 03/14/2012 10:00 AM, Ekin Akoglu wrote:

Hello,

I am sorry that I could not make myself clear. What I meant to say is that I aim to form a compound datatype which comprises VL (variable length) and fixed-length array fields/datatypes. In the example for creating VL datatype, using a user-defined datatype which includes a pointer is suggested (Example 27 on page 227 in the HDF user manual). That is what I want to avoid but it seems it is the only way. What I want to achieve is summarized in Figure 18 on page 238 in the HDF user manual; a compound datatype built up of numerous VL and atomic datatypes.

Ekin

On 03/14/2012 07:16 AM, brtnfld@hdfgroup.org wrote:

Hi,

suggestions about storing this data as a compound type with variable
length fields without using pointers as explained in
h5ex_t_vlen_F03.f90 [1] example script on HDF GROUP web site. Thank
you in advance for your concerns.

I don't understand what you mean by "not using pointers", do you mean you don't want to use C_LOC and/or F2003 and still do the same thing as h5ex_t_vlen_F03.f90? Can you explain further what in h5ex_t_vlen_F03.f90 you want to avoid doing?

Scot

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

--
*Ekin Akoglu*

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@ims.metu.edu.tr <mailto:ekin@ims.metu.edu.tr>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27

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

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@ims.metu.edu.tr <mailto:ekin@ims.metu.edu.tr>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27

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

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@ims.metu.edu.tr <mailto:ekin@ims.metu.edu.tr>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27