h5md-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h5md-user] Unit attribute versus non-dimensionless quantities


From: Peter Colberg
Subject: Re: [h5md-user] Unit attribute versus non-dimensionless quantities
Date: Thu, 1 Aug 2013 10:58:58 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Felix,

On Thu, Aug 01, 2013 at 09:56:57AM +0200, Felix Höfling wrote:
> I played a bit with h5py, which seems to ignore user-defined types
> unfortunately. The type is immediately converted to a NumPy type,
> and it is not possible (for me) to retrieve the actual HDF5 type of
> the attribute (and the 'unit' attribute of this type):

Yes, the high-level API of h5py abstracts away HDF5 attributes and
datatypes, into native Python values and numpy dtypes, respectively.

However, it is simple to read a unit, e.g., of an attribute:

  import h5py
  f = h5py.File("h5md_units.h5", "r")
  attr = h5py.h5a.open(f.id, "data")
  datatype = h5py.Datatype(attr.get_type())
  print(datatype.attrs["unit"])

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]