message_ix_models.project.engage.workflow.PolicyConfig
- class message_ix_models.project.engage.workflow.PolicyConfig(demand_scenario: dict = <factory>, reserve_margin: bool = True, solve: dict[str, ~typing.Any] = <factory>, label: str = '', steps: list[int] = <factory>, budget: int | ~typing.Literal['calc'] = 'calc', tax_emission_scenario: dict = <factory>, step_3_type_emission: list[str] = <factory>)[source]
Bases:
Config
Configuration for the 3-step ENGAGE workflow for climate policy scenarios.
- __init__(demand_scenario: dict = <factory>, reserve_margin: bool = True, solve: dict[str, ~typing.Any] = <factory>, label: str = '', steps: list[int] = <factory>, budget: int | ~typing.Literal['calc'] = 'calc', tax_emission_scenario: dict = <factory>, step_3_type_emission: list[str] = <factory>) None
Methods
__init__
([demand_scenario, reserve_margin, ...])from_dict
(data)Construct an instance from data with name manipulation.
hexdigest
([length])Return a hex digest that is unique for distinct settings on the instance.
read_file
(path[, fail])Update configuration from file.
replace
(**kwargs)Like
dataclasses.replace()
with name manipulation.update
(**kwargs)Update attributes in-place.
Attributes
In
step_1()
, actual quantity of the carbon budget to be imposed , or the value "calc", in which case the value is calculated fromlabel
byScenarioRunner.calc_budget()
.Label of the climate policy scenario, often related to a global carbon budget in Gt CO₂ for the 21st century (varies).
Which steps of the ENGAGE workflow to run.
In
step_3()
, optional information on a second scenario from which to copytax_emission
data.In
step_3()
, emission types or categories (type_emission
) for which to apply values fortax_emission
.Information on an optional, other scenario from which to copy demand data in
solve()
usingtransfer_demands()
.Keyword arguments for
message_ix.Scenario.solve()
viasolve()
.- budget: int | Literal['calc'] = 'calc'
In
step_1()
, actual quantity of the carbon budget to be imposed , or the value “calc”, in which case the value is calculated fromlabel
byScenarioRunner.calc_budget()
.
- demand_scenario: dict
Information on an optional, other scenario from which to copy demand data in
solve()
usingtransfer_demands()
. Default: empty, do nothing.
- hexdigest(length: int = -1) str
Return a hex digest that is unique for distinct settings on the instance.
Uses
dataclasses.asdict()
. This means that if the names of fields defined by a subclass change—including if fields are added or removed—the result will differ.- Returns:
If length is greater than 0, a string of this length; otherwise a 32-character string from
blake2s.hexdigest()
.- Return type:
- label: str = ''
Label of the climate policy scenario, often related to a global carbon budget in Gt CO₂ for the 21st century (varies).
- read_file(path: Path, fail='raise') None
Update configuration from file.
- Parameters:
path – to a
.yaml
file containing a top-level mapping.fail (
str
) – if “raise” (the default), any names in path which do not match attributes of the dataclass raise a ValueError. Otherwise, a message is logged.
- replace(**kwargs)
Like
dataclasses.replace()
with name manipulation.
- solve: dict[str, Any]
Keyword arguments for
message_ix.Scenario.solve()
viasolve()
.To replicate the behaviour of the macro_params argument to
engage.ScenarioRunner.run()
, which in turn sets the convergence_issues argument toengage.ScenarioRunner.solve()
, set max_adjustment to 0.1.
- step_3_type_emission: list[str]
In
step_3()
, emission types or categories (type_emission
) for which to apply values fortax_emission
.
- tax_emission_scenario: dict
In
step_3()
, optional information on a second scenario from which to copytax_emission
data.
- update(**kwargs)
Update attributes in-place.
- Raises:
AttributeError – Any of the kwargs are not fields in the data class.