⇐ ⇒

[CF-metadata] "Andrew Clegg": udunits 1 or 2 for CF?

From: Steve Emmerson <steve>
Date: Wed, 03 Mar 2010 13:29:03 -0700

Andrew,

> I'm running into some problems regarding units in CF-compliant files.
> Up until now I've been using udunits 1 to check units, but I recently
> tried the CF checker which uses udunits2. There are some unit strings
> which are valid in one but not the other. In particular, I am dealing
> with milligrams per cubic meter. In udunits1, I used 'ukg m-3', which
> udunits2 rejects as invalid. udunits2 accepts 'mg m-3' (which is much
> better!), but udunits1 interprets this as to do with gravity. Because
> of this, I can't include a unit string which is generally compatible >
with udunits...

> I would guess that udunits2 is the preferred option, given that
> udunits1 is deprecated. Should the CF conventions be updated to
> specify udunits 2?

The UDUNITS-1 library had a bug in it. The bug was that "g" was
interpreted as meaning "gravity" (i.e., "standard_free_fall") rather
than "gram". This was corrected in version 1.12.10 of the UDUNITS-1
package, which was released on 2009-09-17.

The UDUNITS-2 package did not have this bug from the outset.

If you create a CF file that uses "g" for "gram", then it will be
correctly interpreted by the UDUNITS-2 library and also by the UDUNITS-1
library from version 1.12.10 on.

Applications that use the UDUNITS-1 library prior to version 1.12.10 can
be easily modified to interpret "g" as "gram" by removing the following
entry from the UDUNITS-1 database ($prefix/etc/udunits.dat):

g S gravity # approx. should ...

I hope this helps.

Regards,
Steve Emmerson
UDUNITS developer
Received on Wed Mar 03 2010 - 13:29:03 GMT

This archive was generated by hypermail 2.3.0 : Tue Sep 13 2022 - 23:02:41 BST

⇐ ⇒