message_ix_models.tools.iea.web.IEA_EWEB

class message_ix_models.tools.iea.web.IEA_EWEB(source, source_kw)[source]

Bases: ExoDataSource

Provider of exogenous data from the IEA Extended World Energy Balances.

To use data from this source, call exo_data.prepare_computer() with the source_kw:

  • “provider”: Either “IEA” or “OECD”. See FILES.

  • “edition”: one of “2021”, “2022”, or “2023”. See FILES.

  • “product”: str or list of str.

  • “flow”: str or list of str.

The returned data have the extra dimensions “product” and “flow”, and are not aggregated by year.

Example

>>> keys = prepare_computer(
...     context,
...     computer,
...     source="IEA_EWEB",
...     source_kw=dict(
...         provider="OECD", edition="2022", product="CHARCOAL", flow="RESIDENT"
...     ),
... )
>>> result = computer.get(keys[0])
__init__(source, source_kw)[source]

Initialize the data source.

Methods

__init__(source, source_kw)

Initialize the data source.

get_keys()

Return the target keys for the (1) raw and (2) transformed data.

raise_on_extra_kw(kwargs)

Helper for subclasses to handle the source_kw argument.

transform(c, base_key)

Aggregate only; do not interpolate on "y".

Attributes

aggregate

True if transform() should aggregate data on the \(n\) dimension.

extra_dims

Optional additional dimensions for the returned Key/Quantity.

id

Identifier for this particular source.

interpolate

True if transform() should interpolate data on the \(y\) dimension.

key

Key for the returned Quantity.

name

aggregate: bool = True

True if transform() should aggregate data on the \(n\) dimension.

extra_dims: tuple[str, ...] = ()

Optional additional dimensions for the returned Key/Quantity. If not set by __init__(), the dimensions are \((n, y)\).

get_keys() tuple[genno.core.key.Key, genno.core.key.Key]

Return the target keys for the (1) raw and (2) transformed data.

Subclasses may override this method to provide different targets keys. In the default implementation, the key for the transformed data is:

  1. key, if any, or

  2. Constructed from:

    • name or measure in lower-case.

    • The dimensions \((n, y)\), plus any extra_dims.

The key for the raw data is the same, with :attr`.id` as an extra tag.

id: str = 'IEA_EWEB'

Identifier for this particular source.

interpolate: bool = True

True if transform() should interpolate data on the \(y\) dimension.

key: Key | None = 'energy:n-y-product-flow:iea'

Key for the returned Quantity. Optional. See get_keys().

raise_on_extra_kw(kwargs) None

Helper for subclasses to handle the source_kw argument.

  1. Store aggregate and interpolate, if they remain in kwargs.

  2. Raise ValueError if there are any other, unhandled keyword arguments in kwargs.

transform(c: genno.Computer, base_key: genno.Key) genno.Key[source]

Aggregate only; do not interpolate on “y”.