Is it possible to default the output if a unit with pint to a derived unit? For example, if I compute a pressure by dividing a force and area, I would like it to display in "psi" by default.
import pint
ureg = pint.UnitRegistry()
ureg.default_format = ".1f~"
s = 42*ureg.pound_force / (4.2*ureg.inch**2)
s # shows 'lbf/in2', but I would like 'psi' w/o using to('psi')
The current master branch of pint has this capability!
import pint
ureg = pint.UnitRegistry(autoconvert_to_preferred=True)
ureg.default_format = ".1f~"
ureg.default_preferred_units = [ureg.psi]
s = 42*ureg.pound_force / (4.2*ureg.inch**2)
s # 10 psi