Closed
Description
I didn't realise that there are functions for getting and setting a global pint registry (see pint/#880).
For xarray integration, the ideal eventual usage in my opinion would be to enable pint-xarray by default when both pint and xarray are imported, and pint-xarray is installed, so you only need do
import pint
import xarray
ds = open_mfdataset(files).quantify()
Not having to do
ureg = pint.UnitRegistry()
ds = open_mfdataset(files).quantify(unit_registry=ureg)
would be nice I think.
But that would mean initialising the default registry either during quantify
, or during the module imports. set_application_registry()
means that particular users can still change it after imports, and get_application_registry()
can be called from within quantify
calls.
Metadata
Metadata
Assignees
Labels
No labels