Hi,
I'm new to hdf5/h5py, so I apologize if I've overlooked something trivial. I'm trying to write a file that can be read by a specific program (imaris). It appears that the program will reject files unless attributes are encoded with as NULLTERM strings. here is an h5dump from one of the attributes in a file written by the application that I am trying to emulate:
HDF5 "imaris.ims" {
ATTRIBUTE "DataSetDirectoryName" {
DATATYPE H5T_STRING {
STRSIZE 1;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 7 ) / ( 7 ) }
DATA {
(0): "D", "a", "t", "a", "S", "e", "t"
}
}
}
After reading through the h5py
docs about strings and playing around a bit, I'm able to create a special_dtype with null-terminated storage, ASCII type, or fixed length, etc... but I can't seem to combine
all of the properties I need my datatype to have at the same time: fixed length, nullterm, ascii, with a dataspace that has the shape of the string length (as shown in the dump above). The only way I've been able to get the program to read a file written by h5py is to create a custom build where I have manually edited h5py/h5t.pyx to set the H5T_strpad setting to H5T_STR_NULLTERM. So my question are:
1) is there a simpler way to achieve what I need with special_dtypes? Or is the hard-coded H5T_STR_NULLPAD setting going to prevent that unless I make a custom build as I have?
2) if a custom build is required, is it possible to do this with a configuration flag during build, rather than editing the source code?
thanks for any suggestions!