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

budget

In step_1(), actual quantity of the carbon budget to be imposed , or the value "calc", in which case the value is calculated from label by ScenarioRunner.calc_budget().

label

Label of the climate policy scenario, often related to a global carbon budget in Gt CO₂ for the 21st century (varies).

reserve_margin

True to call reserve_margin.res_marg.main() in solve().

steps

Which steps of the ENGAGE workflow to run.

tax_emission_scenario

In step_3(), optional information on a second scenario from which to copy tax_emission data.

step_3_type_emission

In step_3(), emission types or categories (type_emission) for which to apply values for tax_emission.

demand_scenario

Information on an optional, other scenario from which to copy demand data in solve() using transfer_demands().

solve

Keyword arguments for message_ix.Scenario.solve() via solve().

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 from label by ScenarioRunner.calc_budget().

demand_scenario: dict

Information on an optional, other scenario from which to copy demand data in solve() using transfer_demands(). Default: empty, do nothing.

classmethod from_dict(data: Mapping)

Construct an instance from data with name manipulation.

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:

str

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.

reserve_margin: bool = True

True to call reserve_margin.res_marg.main() in solve().

solve: dict[str, Any]

Keyword arguments for message_ix.Scenario.solve() via solve().

To replicate the behaviour of the macro_params argument to engage.ScenarioRunner.run(), which in turn sets the convergence_issues argument to engage.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 for tax_emission.

steps: list[int]

Which steps of the ENGAGE workflow to run. Empty list = don’t run any steps.

tax_emission_scenario: dict

In step_3(), optional information on a second scenario from which to copy tax_emission data.

update(**kwargs)

Update attributes in-place.

Raises:

AttributeError – Any of the kwargs are not fields in the data class.