message_ix_models.model.transport.factor.ScenarioSetting

class message_ix_models.model.transport.factor.ScenarioSetting(setting: dict | None = None, *, default=None, **setting_kw)[source]

Bases: Layer

A layer that transforms a ‘scenario’ identifier to a particular ‘setting’.

This layer handles the common case that multiple ‘scenario’ identifiers may be represented in a model using the same quantification. It uses coords along a dimension named ‘setting’ to represent these distinct quantifications.

The quantify() and apply() methods have special behaviour

__init__(setting: dict | None = None, *, default=None, **setting_kw)[source]

Methods

__init__([setting, default])

apply(other, coords)

quantify() this layer and combine it with other.

of_enum(enum, data_expr, **kwargs)

Create from simpler data for an enumeration.

operation(b, /)

Same as a * b.

quantify(coords)

Return a quantification of the layer.

Attributes

setting

Mapping from scenario identifier to setting label.

default

Default setting.

apply(other, coords)[source]

quantify() this layer and combine it with other.

This drops the ‘setting’ dimension from other.

default: str

Default setting.

classmethod of_enum(enum, data_expr: str, **kwargs)[source]

Create from simpler data for an enumeration.

Parameters:
  • enum – An enumeration, for instance .SSP_2024.

  • data_expr (str) – A string of the form “A=foo B=bar” indicating that the ‘setting’ for enum member “A” is “foo”, and so on.

  • **kwargs – Passed to ScenarioSetting.

operation(b, /)

Same as a * b.

quantify(coords)[source]

Return a quantification of the layer.

The key "scenario" is removed from coords. (This means it is not available to subsequent layers, and also not included in among the dimensions of the Factor.quantify() result.)

The value returned is the value 1.0 with the single dimension ‘setting’ and label obtained by passing the “scenario” coord through setting, or using default if it does not appear.

setting: Dict[Any, str]

Mapping from scenario identifier to setting label.