aquakin.parse_units#
- aquakin.parse_units(text)[source]#
Parse a unit string into a
Dimension, orNoneif unknown.- Parameters:
text (str) – A unit string in any of the shipped dialects, e.g.
"g_COD/m3","1/d","M-1 s-1","m3/(g_COD*d)","gO2^0.5/m/d","mol/L". The display form is accepted too: Unicode superscripts (m³) and the multiplication dot (g_COD·m⁻³==g_COD*m-3).- Returns:
The parsed dimension.
"-"(or"1") is the dimensionlessDimension(). A blank string, or any string this tolerant parser cannot fully consume, returnsNone(treated as unknown / skipped by the check) rather than raising.- Return type:
Dimension or None