message_ix_models.tools.iea.eei.IEA_EEI
- class message_ix_models.tools.iea.eei.IEA_EEI(source, source_kw)[source]
Bases:
ExoDataSource
Provider of exogenous data from the IEA Energy Efficiency Indicators data source.
To use data from this source, call
exo_data.prepare_computer()
with the arguments:source: “IEA_EEI”.
source_kw including:
measure: name of a measure or indicator in the data.
broadcast_map (optional): name of a
Key
containing a mapping forgenno.operator.broadcast_map()
.plot (optional, default
False
): add a task with the key “plot IEA_EEI debug” to generate diagnostic plot usingPlot
.aggregate, interpolate: see
ExoDataSource.transform()
.
- __init__(source, source_kw)[source]
Handle source and source_kw.
An implementation must:
Raise
ValueError
if it does not recognize or cannot handle the arguments in source or source_kw.Recognize and handle (if possible) a “measure” keyword in source_kw from
MEASURES
.
It may:
Transform these into other values, for instance by mapping certain values to others, applying regular expressions, or other operations.
Store those values as instance attributes for use in
__call__()
.Set
name
and/orextra_dims
to control the behaviour ofprepare_computer()
.Log messages that give information that may help to debug a
ValueError
for source or source_kw that cannot be handled.
It should not actually load data or perform any time- or memory-intensive operations; these should only be triggered by
__call__()
.
Methods
__init__
(source, source_kw)Handle source and source_kw.
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
By default, do not aggregate.
Optional additional dimensions for the returned
Key
/Quantity
.Identifier for this particular source.
By default, do not interpolate.
- extra_dims: Tuple[str, ...] = ()
Optional additional dimensions for the returned
Key
/Quantity
. If not set by__init__()
, the dimensions are \((n, y)\).
- name: str = ''
Optional name for the returned
Key
/Quantity
. If not set by__init__()
, then the “measure” keyword is used.
- raise_on_extra_kw(kwargs) None
Helper for subclasses to handle the source_kw argument.
Store
aggregate
andinterpolate
, if they remain in kwargs.Raise
ValueError
if 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.
base_key identifies the
Quantity
that is returned by__call__()
. Before the data is returned,transform()
allows the data source to add additional tasks or computations to c that further transform the data. (These operations may be done in__call__()
directly, buttransform()
allows use of othergenno
operators and conveniences.)The default implementation:
If
aggregate
isTrue
, aggregates the data (genno.operator.aggregate()
) on the \(n\) dimension using the key “n::groups”.If
interpolate
isTrue
, interpolates the data (genno.operator.interpolate()
) on the \(y\) dimension using “y::coords”.