h5md-user
[Top][All Lists]
Advanced

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

Re: [h5md-user] units module


From: Felix Höfling
Subject: Re: [h5md-user] units module
Date: Mon, 14 Oct 2013 16:13:44 +0200
User-agent: Opera Mail/12.15 (Linux)

Am 11.10.2013, 17:06 Uhr, schrieb Peter Colberg
<address@hidden>:

Hi,

Before adding a units module to the repository that defines an
optional unit system for the "unit" attributes, I would like to
solicit feedback from the H5MD community.

The idea is to have a module named "units" that carries a module
attribute "system" that defines the unit system. Rather than having
a separate module for each unit system, this way a program can query
the unit system by reading the attribute "/h5md/modules/address@hidden".

The module would initially support the unit system "si". Here the
question is whether and how to define the format of the unit strings.
Konrad suggested the udunits2 package earlier. It seems a good basis:

http://www.unidata.ucar.edu/software/udunits/udunits-2/udunits2lib.html#Syntax

The udunits2 grammar is very flexible. It would probably be sensible
to define a smaller grammar, so programs wishing to interpret units do
not have to use the udunits2 library due to the complexity of parsing.

Debian ships with a udunits-bin package if you wish to try the syntax.

Peter


The package brings an impressive collection of units, SI-base, SI-derived, SI-accepted, non-SI, ... it knows even about Poise and Dyne ;-) I can hardly see anything that is missing -- except for "Lennard-Jones" units which usually are kind of abstract and without a conversion to physical units (I'm not talking about Argon ...)

http://www.unidata.ucar.edu/software/udunits/udunits-2/udunits2.html#Database

The syntax looks quite natural to me, a human has a good chance to readily grip the meaning.

Using the package as a reference for how the unit strings are to specified seems reasonable. I'm a bit unsure whether the spec of the units module should depend on an external package, or whether we should copy all the strings verbosely (i.e., converting the XML files to a pretty table).

One task that the units module (or the udunits library) should be able to do: convert between units, e.g., recognise that "1 N m = 1 Pa = 10⁻⁵ bar"? At least the conversion factor is listed in one of the XMLs. Without such a functionality, the automatic parsing would be of limited value.

Restricting the set of units to "SI-base" or "SI-base plus SI-derived" makes sense. But we have to think about arbitrary combinations of sets of units, one part of the H5MD file may want to use SI-base with SI-derived, but mix it with SI-accepted (e.g., because these data come from another source). I tend to make the "system" attribute a list rather than a single entry.

Cheers,

Felix



reply via email to

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