message_ix_models.model.transport.factor.Map

class message_ix_models.model.transport.factor.Map(dim: str, values: dict[str, Layer] | None = None, **value_kwargs: Layer)[source]

Bases: Layer

A layer that maps to different values along dim.

Parameters:
  • dim (str) – Dimension ID.

  • values (optional) – Mapping from labels or coords along dim to other Layers which produce the value(s) for those coords.

  • **value_kwargs – Same as values, but as keyword arguments.

Example

>>> layer = factor.Map(
...     "new_dim",
...     x=factor.Constant(2.0, "y z"),
...     x=factor.Constant(3.0, "y z"),
... )
__init__(dim: str, values: dict[str, Layer] | None = None, **value_kwargs: Layer)[source]

Methods

__init__(dim[, values])

apply(other, coords)

quantify() this layer and combine it with other.

operation(b, /)

Same as a * b.

quantify(coords)

Return a quantification of the layer.

Attributes

dim

values

apply(other: AttrSeries, coords: Mapping[str, Any]) AttrSeries

quantify() this layer and combine it with other.

Subclasses may override this method. The default implementation combines other with the results of quantify() using operation.

operation(b, /)

Same as a * b.

quantify(coords)[source]

Return a quantification of the layer.

The returned value:

  • May have any of the dimensions indicated by coords.

  • For such dimensions, should have some or all of the labels in coords.

Subclasses must implement this method.