UDUNITS

Guidance last updated: 18 October 2026

The UDUNITS package supports units of physical quantities. Its C library provides for arithmetic manipulation of units and for conversion of numeric values between compatible units. The package contains an extensive unit database, which is in XML format and user-extendable. The package also contains a command-line utility for investigating units and converting values.

Caution

When compiling R packages that use UDUNITS, choose R and UDUNITS modules with compatible compiler toolchains.

Usage

After connecting to Stanage (see Establishing a SSH connection), start an interactive session:

salloc

You can load a specific version of UDUNITS with the following command:

module load UDUNITS/2.2.28-GCCcore-14.3.0
module load UDUNITS/2.2.28-GCCcore-13.3.0

Unit conversion example

Within an interactive session, load UDUNITS/2.2.28-GCCcore-14.3.0 and run udunits2. Enter 5km at the first prompt and miles at the second:

You have: 5km
You want: miles
5 km = 3.10686 miles
x/miles = 0.621371*(x/km)

Press Ctrl+D to exit. You can also supply the conversion on the command line without answering prompts:

udunits2 -H '5 km' -W miles

For other options, see the UDUNITS program guide.

Installation notes

UDUNITS was installed using Easybuild, build details can be found in $EBROOTUDUNITS/easybuild with a given module loaded.

Direct dependencies for latest version of UDUNITS