message_ix_models.model.transport.factor.Layer

class message_ix_models.model.transport.factor.Layer[source]

Bases: ABC

Base class for layered assumptions used to build up a factor quantification.

__init__()

Methods

__init__()

apply(other, coords)

quantify() this layer and combine it with other.

quantify(coords)

Return a quantification of the layer.

Attributes

operation

Operation for combining the quantification of this layer with the quantification of the previous layer.

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

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: Callable

Operation for combining the quantification of this layer with the quantification of the previous layer. Used by apply().

Choices might include:

  • operator.mul(): take the product of this layer and previous layer’s values.

  • operator.pow(): raise the previous layer’s values to the values from this layer. This can be used with 0 and 1 to replace certain values in other with 1.0, since other ** 0 = 1.0 and other ** 1 = other.

abstract quantify(coords: Mapping[str, Any]) AttrSeries[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.