-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Some units consists of multiple set of parenthesis, with exponents -1 (e.g. next line). However they are not parsed correctly by pint.
gsw-xarray/gsw_xarray/_attributes.py
Line 651 in 08a1341
"units": "(kg/m^3)(g/kg)^-1", |
import cf_xarray.units # must be imported before pint_xarray
import pint_xarray
from pint_xarray import unit_registry as ureg
ureg('(kg/m^3)*(g/kg)^-1')
outputs (what we want):
1.0 kilogram2/(gram meter3)
but without the star
ureg('(kg/m^3)(g/kg)^-1')
output
1.0 meter3/gram
I opened an issue in pint about this: hgrecco/pint#1730. In the meantime, we should replace these unit with either a '*' between the parenthesis, or with an extra set of parenthesis.
Any opinion on which solution we should implement?
Metadata
Metadata
Assignees
Labels
No labels