NERACOOS   ERDDAP
Easier access to realtime and historic NERACOOS buoy observations.
   
Brought to you by NOAA IOOS NERACOOS    

ERDDAP > convert > units

Convert UDUNITS to/from Unified Code for Units of Measure (UCUM)

Two common standards for writing units of measure are: On this ERDDAP, most/all datasets use UDUNITS.
In tabledap requests, you can request UDUNITS or UCUM.
 
Convert from UDUNITS to UCUM
UDUNITS:
 

Convert from UCUM to UDUNITS
UCUM:
 

Notes:

 


Want To Do Conversions from within a Computer Program, Script, or Web Page?

If you change the extension of this web page's URL from .html to .txt, and add the query UDUNITS=udunitsString or UCUM=ucumString, ERDDAP will respond with just the text result. Percent Encoding - The parameter values in the URL (the parts after '=' signs) must be properly percent encoded (external link): all characters other than A-Za-z0-9_-!.~'()* must be encoded as %HH, where HH is the 2 digit hexadecimal value of the character, for example, a space becomes %20. Characters above #127 must be converted to UTF-8 bytes, then each UTF-8 byte must be percent encoded (ask a programmer for help). There are web sites that percent encode and decode for you (external link).

 


Comparison of UDUNITS and UCUM Syntax

Issue UDUNITS (external link) UCUM (external link) UDUNITS → UCUM Converter UCUM → UDUNITS Converter
Character Set UDUNITS-1 uses plain ASCII. UDUNITS-2 uses ASCII, ISO 8859-1 (Latin-1), and the UTF-8 encoding of ISO 10646 (Unicode). Plain ASCII All UDUNITS units with just ASCII and ISO 8859-1 characters are converted. The few units with other characters are not converted Most UCUM units are converted.
case-sensitive Yes. When different capitalizations are allowed, the variants are explicitly defined. Yes. The converters work with the case-sensitive ("c/s") form of UCUM units. (No changes needed) (No changes needed)
Plurals and Aliases Supports plurals and aliases for the same unit. Uses just one abbreviation/acronym for each unit. The various plurals and aliases are converted to the corresponding UCUM unit. Unrecognized UDUNITS names are left unchanged. This methods tries to return common, short, single (not plural) UDUNITS aliases. Unrecognized UCUM names are left unchanged.
metric prefixes
(e.g., "kilo" and 'k' mean "times 1000"; "µ" and 'u' means "times 10^-6")
Supported (see UDUNITS-2 udunits2-prefixes.xml) Supported (see the c/s column of the prefix symbol table (external link)) The prefix is converted to its acronym (e.g., 'u') The prefix is left as its acronym (e.g., 'u')
multiplication operators space (most common), '-' (a typo in the spec???), '.', '*', '·' (in UDUNITS-2) '.' space, '*', and '·', are converted to '.' '.' is converted to a space
division operators '/', "per", "PER" '/' "per" and "PER" are converted to '/' (No changes needed)
exponent operators "**", '^', nothing (e.g., m-2 = m^-2) '*' (really!), '^', nothing (e.g., m-2 = m^-2) "**" is converted to '^'. '*' is converted to '^'.
operator precedence Exponents are highest. Then multiplication and division are evaluated left to right. Exponents are highest. Then multiplication and division are evaluated left to right. (No changes needed) (No changes needed)
numbers integer and floating point (e.g., 1.23456e-5) integer only floating point numbers are converted to rational numbers (e.g., 12.34 becomes 1234.10^-2 (remember that '.' means "times") (No changes needed)
_ (underscore) Used within individual unit names. Used to indicate a subscript annotation within a unit name (e.g., "mo_g" for a Gregorian month) (No changes needed) (No changes needed)
' (apostrophe) Not used. Used to separate words in a multi-word name (e.g., "[todd'U]" for a Todd unit) (No changes needed) (No changes needed)
( ) Used to group items. Used to group items. (No changes needed) (No changes needed)
[ ] Not used. Used to enclose groups of symbols that should be treated as a group (e.g., "[in_i]" for an international inch) (No changes needed) (No changes needed)
{ } Not used. Used for annotations (e.g., "%{vol}" for percent by volume). (No changed needed) If the comment is defined in the UCUM standard, it will be converted. If it isn't defined, it will be left intact.

 


Comparison of UDUNITS and UCUM Units

For most units, there is a one-to-one correspondence between units in UDUNITS and UCUM. But there are a few difficulties and special cases:
 
Units UDUNITS (external link) UCUM (external link) UDUNITS → UCUM Converter UCUM → UDUNITS Converter
count "count" is a base unit. No exact equivalent, since it is a dimensionless non-unit. "count" is converted to "{count}" (a dimensionless annotation). "{count}" is converted to "count".
different types of degrees UDUNITS treats degF, degC, degK, degree_north, degree_east, degree_west, degree_true, and their aliases as separate units. Some standards (e.g., COARDS (external link) and CF (external link)), use degree_east and degree_north to identify the longitude and latitude variables in a data file. UCUM recognizes separate temperature degree units (e.g, [degF], Cel, K), but not separate direction degree units. They are all represented by "deg". To distinguish between the various direction degree units, the converter adds a comment to direction degree units (e.g., "degree_north" becomes "deg{north}"). If you append a comment( {east}, {north}, {west}, or {true}), the converter will convert to a direction unit (e.g., "deg{north}" becomes "degree_north"); otherwise, there is no way for the converter to generate direction degree units, so "deg" is converted to "degree".
specific times UDUNITS has a system to specify specific times as
"units since ISO8601Time",
e.g., "seconds since 1970-01-01T00:00:00Z".
UCUM doesn't seem to have a system to specify specific times. The converter converts, e.g.,
"seconds since 1970-01-01T00:00:00Z"
to "s{since 1970-01-01T00:00:00Z}".
The converter converts e.g.,
"s{since 1970-01-01T00:00:00Z}" to
"seconds since 1970-01-01T00:00:00Z".
g In UDUNITS-1, g means free-fall (although it is often mistakenly used to mean "gram").
In UDUNITS-2, g means gram.
g means gram. [g] means free-fall. Nothing is done. g in UDUNITS is assumed to mean gram. g is converted to "gram".
F F means Fahrenheit. F means farad. F is converted to [degF]. F is converted to "farad".
NTU (Nephelometric Turbidity Unit) NTU is not defined. NTU is not defined. NTU is converted to {ntu} following the UCUM method for noting the name of dimensionless (arbitrary) units. {ntu} is converted to NTU.
PSU (Practical Salinity Units) PSU is not defined. PSU is not defined. PSU and psu are converted to {psu} following the UCUM method for noting the name of dimensionless (arbitrary) units. {psu} is converted to PSU.

 


Requesting UDUNITS or UCUM Units from Tabledap

When you request data or a graph from a tabledap dataset, you can request that the units be described via UDUNITS by appending &units("UDUNITS") at the end of the request. Or, you can request that the units be described via UCUM by appending &units("UCUM"). (For details, see the tabledap documentation.) On this ERDDAP, the default for most/all datasets is UDUNITS.

 
ERDDAP, Version 1.82
Disclaimers | Privacy Policy | Contact