message_ix_models.tools.iea.web.IEA_EWEB
- class message_ix_models.tools.iea.web.IEA_EWEB(source, source_kw)[source]
Bases:
ExoDataSourceProvider of exogenous data from the IEA Extended World Energy Balances.
To use data from this source, call
exo_data.prepare_computer()with the following source_kw:provider: Either ‘IEA’ or ‘OECD’. SeeFILES.edition: one of ‘2021’, ‘2022’, or ‘2023’. SeeFILES.product(optional):strorlistofstr. Select only these labels from the ‘PRODUCT’ dimension.flow(optional):strorlistofstr. Select only these labels from the ‘FLOW’ dimension.transform(optional): either “A” (default) or “B”. Seetransform().regions: must also be given with the value"R12"if givingtransform="B".
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])
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)Prepare c to transform raw data from base_key.
Attributes
Trueiftransform()should aggregate data on the \(n\) dimension.Optional additional dimensions for the returned
Key/Quantity.Identifier for this particular source.
Trueiftransform()should interpolate data on the \(y\) dimension.Key for the returned
Quantity.Primary measure.
- aggregate: bool = True
Trueiftransform()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[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:
key, if any, orConstructed from:
The dimensions \((n, y)\), plus any
extra_dims.
The key for the raw data is the same, with :attr`.id` as an extra tag.
- interpolate: bool = True
Trueiftransform()should interpolate data on the \(y\) dimension.
- key: Key | None = <energy:n-y-product-flow:iea>
Key for the returned
Quantity. Optional. Seeget_keys().
- measure = ''
Primary measure.
- name: str = ''
Name for the returned
Key/Quantity. Optional. Seeget_keys().
- raise_on_extra_kw(kwargs) None
Helper for subclasses to handle the source_kw argument.
Store
aggregateandinterpolate, if they remain in kwargs.Raise
ValueErrorif there are any other, unhandled keyword arguments in kwargs.
- transform(c: Computer, base_key: Key) Key[source]
Prepare c to transform raw data from base_key.
Map IEA
COUNTRYcodes to ISO 3166-1 alpha-3 codes, where such mapping exists. Seeget_mapping()andCOUNTRY_NAME.
The next steps depend on whether
transform="A"ortransform="B"was given with the source_kw.transform="A"(default)Aggregate using “n::groups”—the same as
ExoDataSource.transform(). This operates on the \(n\) labels transformed to alpha-3 codes by step (1) above.
transform="B"Compute intermediate quantities using
transform_B().Aggregate using the groups returned by
get_node_groups_B().
This method does not prepare interpolation or aggregation on \(y\).