UDUnits.jl

Documentation for UDUnits.jl

UDUnits.SystemType
system = System()

Load the default SI unit system. system behaves similar to a dictionary as it supports indexing and the function haskey (to determine if a unit is a valid):

using UDUnits
sys = System()
m = sys["meter"]
haskey(sys,"μm") # returns true
source
UDUnits.formatFunction
s = format(unit::Unit; names = false, definition = false)

Format the unit unit as a string. If names is true, then definition uses the unit names (e.g. meter) instead of symbols (e.g. m). If definition is true, then the unit should be expressed in terms of basic units (m²·kg·s⁻³ instead of W).

source
UDUnits.areconvertibleMethod
bool = areconvertible(from_unit::Unit,to_unit::Unit)

Return true if from_unit and to_unit are convertible, otherwise false.

source
UDUnits.ConverterMethod
converter = Converter(from_unit::Unit,to_unit::Unit)

Creates a converter function of numeric values in the from_unit to equivalent values in the to_unit.

using UDUnits
sys = System()
conv = Converter(sys["m/s"],sys["km/h"])
speed_in_m_per_s = 100.
speed_in_km_per_h = conv(speed_in_m_per_s)
source
UDUnits.expressionFunction
s = expression(conv::Converter; variable = "x")

Return a string representation of the converter conv using the variable variable.

source