API Reference#

Handling of units related to simple climate modelling.

openscm_units.data

Data used within OpenSCM Units

unit_registry#

unit_registry(input_string, case_sensitive=None, **values) = <openscm_units._unit_registry.ScmUnitRegistry object>#

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.

ScmUnitRegistry#

class ScmUnitRegistry(*args, metric_conversions=None, **kwargs)[source]#

Bases: UnitRegistry

Unit registry class.

Provides some convenience methods to add standard units and contexts.

add_standards()[source]#

Add standard units.

Has to be done separately because of pint’s weird initialising.

Return type:

None

enable_contexts(*names_or_contexts, **kwargs)[source]#

Overload pint’s enable_contexts()

This ensures we only add contexts once (the first time they are used) to avoid (unnecessary) operations.

Parameters:
Return type:

None

split_gas_mixture(quantity)[source]#

Split a gas mixture into constituent gases.

Parameters:

quantity (pint.registry.Quantity) – Pint quantity to split

Returns:

list[pint.registry.Quantity] – List of constituent gases