how to create VLEN and fixed-length string types

Hello, I am trying to re-create the types below from an Hdf5 file created by another software package (output below was generated from h5dump) but am not quite sure on how to define them. I am using h5dotnet wrappers (though c examples would help).

1) This appears to be a fixed-length string. It seems straightforward enough, but the h5dotnet docs suggest using ascii character arrays which give a different type signature. Any reason the h5t_c_s1 type cannot be used in c#?

2) Not clear what this type is and how the sizes are specified or mean.

Thanks.
--Jim

ATTRIBUTE "attribute1" {

         DATATYPE H5T_STRING {

            STRSIZE 6;

            STRPAD H5T_STR_NULLTERM;

            CSET H5T_CSET_ASCII;

            CTYPE H5T_C_S1;

         }

         DATASPACE SCALAR

         DATA {

         (0): "valuea"

         }

      }

      ATTRIBUTE "attribute2" {

         DATATYPE H5T_VLEN { H5T_STRING {

            STRSIZE 1;

            STRPAD H5T_STR_NULLTERM;

            CSET H5T_CSET_ASCII;

            CTYPE H5T_C_S1;

         }}

         DATASPACE SIMPLE { ( 5 ) / ( 5 ) }

         DATA {

         (0): ("f", "i", "e", "l", "d", "1"), ("f", "i", "e", "l", "d", "2"),

         (2): ("f", "i", "e", "l", "d", "3"), ("f", "i", "e", "l", "d", "4"),

         (4): ("f", "i", "e", "l", "d", "5")

         }

      }

Hi Jim,

···

On Nov 26, 2014, at 11:48 AM, Rowe, Jim <J.Rowe@questintegrity.com<mailto:J.Rowe@questintegrity.com>> wrote:

Hello, I am trying to re-create the types below from an Hdf5 file created by another software package (output below was generated from h5dump) but am not quite sure on how to define them. I am using h5dotnet wrappers (though c examples would help).

1) This appears to be a fixed-length string. It seems straightforward enough, but the h5dotnet docs suggest using ascii character arrays which give a different type signature. Any reason the h5t_c_s1 type cannot be used in c#?
2) Not clear what this type is and how the sizes are specified or mean.
May be the following C examples will help.

For the fixed size attribute type please see http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_stringatt.c.

Please replace lines

    filetype = H5Tcopy (H5T_FORTRAN_S1);
    status = H5Tset_size (filetype, SDIM - 1);
with

    filetype = H5Tcopy (H5T_C_S1);
    status = H5Tset_size (memtype, SDIM);

to get the type similar to yours.

For the second type, please see http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/hdf5-examples/1_8/C/H5T/h5ex_t_vlenatt.c.

You will need to use H5T_C_S1 base type in the H5Tvlen_create calls and play with data initialization.

Please let me know if you need further help.

Elena
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks.
--Jim

ATTRIBUTE "attribute1" {
         DATATYPE H5T_STRING {
            STRSIZE 6;
            STRPAD H5T_STR_NULLTERM;
            CSET H5T_CSET_ASCII;
            CTYPE H5T_C_S1;
         }
         DATASPACE SCALAR
         DATA {
         (0): "valuea"
         }
      }

      ATTRIBUTE "attribute2" {
         DATATYPE H5T_VLEN { H5T_STRING {
            STRSIZE 1;
            STRPAD H5T_STR_NULLTERM;
            CSET H5T_CSET_ASCII;
            CTYPE H5T_C_S1;
         }}
         DATASPACE SIMPLE { ( 5 ) / ( 5 ) }
         DATA {
         (0): ("f", "i", "e", "l", "d", "1"), ("f", "i", "e", "l", "d", "2"),
         (2): ("f", "i", "e", "l", "d", "3"), ("f", "i", "e", "l", "d", "4"),
         (4): ("f", "i", "e", "l", "d", "5")
         }
      }
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5