UDUnits.jl
Documentation for UDUnits.jl
UDUnits.System — Typesystem = 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 trueUDUnits.symbol — Functions = symbol(unit::Unit)Returns the symbol of unit.
UDUnits.name — Functions = name(unit::Unit)Returns the name of unit.
UDUnits.format — Functions = 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).
UDUnits.areconvertible — Methodbool = areconvertible(from_unit::Unit,to_unit::Unit)Return true if from_unit and to_unit are convertible, otherwise false.
UDUnits.Converter — Methodconverter = 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)UDUnits.expression — Functions = expression(conv::Converter; variable = "x")Return a string representation of the converter conv using the variable variable.