back to the MetroloPy documentation home page
Units can be referenced by both name and alias. If a unit name or alias contains a space, '*', or '/' character then the name must be enclosed in square brackets, e.g: '[light year]'. If a unit name or alias contains parentheses and the text inside the parentheses can be interpreted as a Unit then the name must also be enclosed in square brackets. Units can be combined into derived units: spaces or the character '*' represent multiplication, the character '/' represents division and the string '**' represents the power operator. An example of a derived unit reference is 'kg m**2/s' which is equivalent to 'kilogram*metre*metre*second**-1' and to '(kg/s)*m**2'.
Users can also define custom units by creating instances of the Unit class or a sub-class.
The search_units function can list all available units:
from metrolopy import search_units
search_units(fmt='html')