Reference
1 Unit systems
units.read_xml([path])-
Reads a units database in XML format and returns a unit system. If the path to the database is ommitted, the function reads the path specified in the environment variable
UDUNITS2_XML_PATH; or, if unset, the default database. system:get_dimensionless_unit_one()-
Returns the unit of dimension 1.
system:get_unit_by_name(s)-
Returns the unit that matches the given name in a case-insensitive manner.
system:get_unit_by_symbol(s)-
Returns the unit that matches the given symbol in a case-sensitive manner.
system:parse(s[, encoding])-
Parses the given unit string and returns the corresponding unit. A second, optional argument
encodingspecifies the character encoding of the string.encodingmay be any of the following:- “ascii”;
- “iso_8859_1”;
- “latin1” (an alias of “iso_8859_1”);
- “utf8” (the default).
2 Units
x * unit-
Returns a unit that equals
unitscaled byx. unit * x-
Returns a unit that equals
unitscaled byx. unit1 * unit2-
Returns a unit that equals the product of the two units.
x / unit-
Returns a unit that equals the inverse of
unitscaled byx. unit / x-
Returns a unit that equals
unitscaled by the inverse ofx. unit1 / unit2-
Returns a unit that equals the quotient of the two units.
unit ^ n-
Returns a unit that equals
unitraised to the power ofn. unit % x-
Returns a unit that equals
unitoffset byx. unit1 == unit2-
Returns true if the two units belong to the same unit system and are equal; otherwise returns false.
tostring(unit)-
Returns a string representation of
unitin ASCII character encoding.