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()
andapply()
methods have special behaviourMethods
__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
Mapping from scenario identifier to setting label.
Default setting.
- apply(other, coords)[source]
quantify()
this layer and combine it with other.This drops the ‘setting’ dimension from other.
- 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 theFactor.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 usingdefault
if it does not appear.