diff --git a/docs/source/api/openscm_units.rst b/docs/source/api/openscm_units.rst index 6360813..498e1bf 100644 --- a/docs/source/api/openscm_units.rst +++ b/docs/source/api/openscm_units.rst @@ -11,6 +11,12 @@ API Reference openscm_units.data +unit\_registry +============== + +.. autodata:: unit_registry + + ScmUnitRegistry =============== diff --git a/src/openscm_units/__init__.py b/src/openscm_units/__init__.py index 6165b29..d7b2f5c 100644 --- a/src/openscm_units/__init__.py +++ b/src/openscm_units/__init__.py @@ -3,7 +3,7 @@ """ import importlib.metadata -from ._unit_registry import ScmUnitRegistry, unit_registry +from ._unit_registry import ScmUnitRegistry __version__ = importlib.metadata.version("openscm_units") @@ -11,3 +11,15 @@ "ScmUnitRegistry", "unit_registry", ] + + +unit_registry = ScmUnitRegistry() +""" +Standard unit registry + +The unit registry contains all of the recognised units. Be careful, if you +edit this registry in one place then it will also be edited in any other +places that use :mod:`openscm_units`. If you want multiple, separate registries, +create multiple instances of :class:`ScmUnitRegistry`. +""" +unit_registry.add_standards() diff --git a/src/openscm_units/_unit_registry.py b/src/openscm_units/_unit_registry.py index f624521..1a6b820 100644 --- a/src/openscm_units/_unit_registry.py +++ b/src/openscm_units/_unit_registry.py @@ -514,15 +514,3 @@ def split_gas_mixture( ret.append(quantity / mixture_unit * fraction_pct / 100 * constituent_unit) return ret - - -unit_registry = ScmUnitRegistry() -""" -Standard unit registry - -The unit registry contains all of the recognised units. Be careful, if you -edit this registry in one place then it will also be edited in any other -places that use ``openscm_units``. If you want multiple, separate registries, -create multiple instances of ``ScmUnitRegistry``. -""" -unit_registry.add_standards()