HDF5 "../data.mat" {
GROUP "/" {
DATASET "a" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
ATTRIBUTE "myattribute" {
DATATYPE H5T_STRING {
STRSIZE 6;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
}
}
DATASET "b" {
...
}
}
}
But when I try to create a string type
strtype = h5t.create(h5t.STRING,6)
python complains "ValueError: Class must be COMPOUND or OPAQUE"...
Looking at
http://h5py.alfven.org/docs/low/h5t.html#datatype-class-codes, there
exists h5t.STRING, but it does not work. Is there something wrong with
my function calls?
Regards.
> But when I try to create a string type
>
> strtype = h5t.create(h5t.STRING,6)
>
> python complains "ValueError: Class must be COMPOUND or OPAQUE"... Looking
> at http://h5py.alfven.org/docs/low/h5t.html#datatype-class-codes, there
> exists h5t.STRING, but it does not work. Is there something wrong with my
> function calls?
It's a quirk of HDF5. You have to copy one of the existing low-level
string types. If you want a null-terminated fixed length C string,
you would do:
strtype = h5py.h5t.C_S1.copy()
strtype.set_size(6)
I agree this behavior is silly but it's exactly how the HDF5 C
interface works. :(
Andrew
Strange, but if it works, i will use it!
Thanks Andrew!
--
Lorenzo Luengo C.
Ingeniero Civil Electr�nico
Cel: 98270385