> I'm using [Silo][1] with HDF5, and I'm having trouble accessing some
> of the metadata with h5py. Silo spits out some rather unusual HDF5
> structuring, where it puts a `DATATYPE` inside a `DATATYPE`. Here's an
> excerpt of the output from `h5dump`:
There is a longstanding bug in h5py whereby single elements of
compound types are returned as tuples instead of array scalars, which
I think is what you're bumping in to here. This is one of the things
I'm fixing in h5py 1.4.
Here is an (annoying) workaround for h5py 1.3.1 and earlier. For your
file object 'f' and the names you gave:
group = f['sigma_t']
attr_id = h5py.h5a.open(group.id, 'silo')
data = numpy.array(group.attrs['silo'], dtype=attr_id.dtype)
meshid = data['meshid'] # etc.
Sorry about this. :( In h5py 1.4 you'll be able to do
f['sigma_t'].attrs['silo']['meshid'], as expected.
Andrew