# udunits2 Program Guide

## Table of Contents

- 1 Synopsis
- 2 Options
- 3 Description
- 4 See Also
- Index

Next: Synopsis, Previous: (dir), Up: (dir) [Contents][Index]

# udunits2

This manual describes how to use the `udunits2` program. This program allows you to discover the definition of a unit as well as convert numeric values between compatible units.

Copyright 2014 University Corporation for Atmospheric Research and contributors. All rights reserved.

This software was developed by the Unidata Program Center of the University Corporation for Atmospheric Research (UCAR) <http://www.unidata.ucar.edu>.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3) Neither the names of the development group, the copyright holders, nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. 4) This license shall terminate automatically and you may no longer exercise any of the rights granted to you by this license as of the date you commence an action, including a cross-claim or counterclaim, against the copyright holders or any contributor alleging that this software infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of this software with other software or hardware.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.

Next: Options, Previous: Top, Up: Top [Contents][Index]

## 1 Synopsis

    udunits2 -h

    udunits2 [-A|-L|-U] [-r] [-H have] [-W want] [XML_file]

Next: Description, Previous: Synopsis, Up: Top [Contents][Index]

## 2 Options

The following options and arguments are supported:

`-A`

  Use the ASCII character-set.

`-L`

  Use the ISO Latin-1 (ISO-8859-1) character-set.

`-U`

  Use the full Unicode character-set with UTF-8 encoding.

`-h`

  Print a help message.

`-r`

  Reveal any problems with the units database (by default, no error messages are printed during import of the database).

`-H have`

  Use `have` unit for conversion. The default is the reply to the prompt.

`-W want`

  Use `want` unit for conversion. An empty string requests the definition of the `have` unit. The default is the reply to the prompt.

`XML_file`

  The pathname of the XML-formatted units database. If not specified, then the default, compile-time pathname is used.

Next: See Also, Previous: Options, Up: Top [Contents][Index]

## 3 Description

When successfully started without the `-H have` or `-W want` options, the program will print the prompt

    You have:

At this point you can exit the program by entering the end-of-file character (usually control-D) or continue by entering either a value or a unit. (a value comprises a numerical value and a unit. For example,

    You have: 80 km/h
    You want:

At this point, if you enter a blank line, then the program will assume that you entered a unit in the previous line and will print the definition of that unit in terms of the base units of the unit-system that it imported on startup. For example,

    You have: 80 km/h
    You want:
        22.2222222222222 m.s-1
    You have:

Details of the formatting depend on the character-set being used. See Options.

Alternatively, at the “`You want:`” prompt you can enter the unit in which you want the previously-entered value. For example,

    You have: 80 km/h
    You want: mi/h
        80 km/h = 49.7097 mi/h
        x/(mi/h) = 0.621371*(x/(km/h))
    You have:

The first line after “`You want:`” shows the “have” value in the desired “want” unit.

The second line shows the transformation between numerical values in the “have” unit to numerical values in the “want” unit. The symbol “`x`” represents the physical quantity in question. See http://physics.nist.gov/Pubs/SP811/sec07.html.

Next: Complete Index, Previous: Description, Up: Top [Contents][Index]

## 4 See Also

See UDUNITS-2 in The UDUNITS-2 C API Guide, for information on the UDUNITS-2 library, which is used by this program.

Previous: See Also, Up: Top [Contents][Index]

## Index

Jump to: | O S

| Index Entry |  | Section
O |  |
| options: |  | Options
S |  |
| synopsis: |  | Synopsis

Jump to: | O S