VOUnits 1.0

Norman Gray norman at astro.gla.ac.uk
Tue Dec 20 04:47:23 PST 2011


On 2011 Dec 19, at 17:08, Norman Gray wrote:

> I'll shortly add some comments to the wiki page.


On second thoughts, here might be more appropriate.

In the New Year, I'll extend the Unity library to include a formal grammar for the VOUnits prescriptions, which appear to be pretty similar to the FITS one.

When developing the grammars, and in particular when categorising the various units, I ended up with an explicit distinction between 'unrecognised', 'deprecated' and 'recommended' units; deprecated units are recognised.  That meant that the 'conformance levels' for a parsed unit expression were 'all units recommended', 'all units recognised', and 'all usage constraints satisfied'.  The first two mean that there are no unrecommended or unrecognised units in the expression, the last that all recognised units are at used in a recommended manner, meaning no SI prefixes where they're not allowed.  These are fairly orthogonal.  That means that 'mfortnight' will parse as a milli-fortnight, be unrecognised, but also satisfy all constraints, since there are none.

I can't think of any other ways of imposing constraints on expressions which are basically valid, other than this way of retrospectively allowing the user to test for conformance levels.

The way the parsing worked, 'pixel' and 'pix' are both parsed as pixels (obviously), but 'pixe', for example, is parsed as a pico-ixe, with the 'ixe' being classed as an unrecognised unit.

The FITS specification, and the draft VOUnit specification both say "The IAU style manual forbids the use of more than one slash (/) character in a units string. However, since normal mathematical precedence rules apply in this context, more than one slash may be used but is discouraged."  There's no way of expressing 'discouraged' in a grammar -- something either is a valid string or it isn't -- so the FITS grammar in this library simply forbids more than one slash, and I suggest that the VOUnit grammar forbid this, too.

There are a few ambiguities in the CDS and OGIP specifications, which I won't expand here, because the VOUnit spec seems to follow the FITS spec most closely.

I wasn't able to deduce from the FITS spec whether m^1.5 was legal or not, because the power is not surrounded by brackets.  I think it's meant to be illegal, and the grammar reflects this.  Perhaps the VOUnit spec could be more precise here.

Similarly, I couldn't work out whether the FITS spec permitted "m**3/kg s^2".  The text suggests that parentheses would be a good idea, but doesn't forbid anything.  The Unity FITS grammar permits this, and parses it as everything to the right of the solidus being the divisor.

I think it would be useful for the VOUnit specification to include the formal grammar we decide on.

My list of 'known units' in the three syntaxes is at <http://www.astro.gla.ac.uk/users/norman/ivoa/unity/grammar/known-units.csv>.  It's in a very compact form, so I mention it here for completeness rather than because it's readable.

All the best,

Norman


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



More information about the semantics mailing list