Home

Awesome

UnitfulUS

Build Status Coverage Status codecov.io

A supplemental units package for Unitful.jl.

Defined units

All units defined are suffixed with _us.

Special features

This package defines a string macro @us_str that only searches for units from this package. @u_str is the only exported symbol from the package. When using the string macro, omit the _us suffix from units, as the macro will append it for you.

Usage examples:

julia> using Unitful.DefaultSymbols, UnitfulUS

julia> us"gal" == UnitfulUS.gal_us
true

julia> 1us"gal" |> m^3
473176473//125000000000 m^3

As can be seen, the us string macro aids in the distinction of U.S. gallons from other possible definitions of the gallon (Imperial gallon). Note that because this package registers with the @u_str macro, you can mix units from this package and the Unitful defaults so long as you include the _us suffix on units from this package:

julia> using Unitful, UnitfulUS

julia> 1.0u"kg/gal_us"
1.0 kg galᵘˢ