Shared workflow steps
This module builds on the generic workflow
utilities/Workflow
class
to provide steps that can be used for any workflow involving the MESSAGEix-GLOBIOM global model.
These are intended to be configured, adapted, or extended for new projects and applications, instead of duplicate, project-specific code.
Code reference
Common steps for workflows.
- class message_ix_models.model.workflow.Config(demand_scenario: dict = <factory>, reserve_margin: bool = True, solve: dict[str, ~typing.Any] = <factory>)[source]
Common configuration for model workflows across projects.
Currently, the three settings are understood by
solve()
, which is used in ENGAGE, NAVIGATE,transport.workflow
, and possibly other workflows.
- message_ix_models.model.workflow.solve(context: Context, scenario: Scenario, *, config: Config | None = None, set_as_default: bool = False)[source]
Common model solve step for ENGAGE, NAVIGATE, and other workflows.
The steps respond settings from an optional instance of
Config
passed as a keyword argument.Before scenario is solved:
If
Config.reserve_margin
isTrue
,res_marg.main()
is called.If
Config.demand_scenario
is non-empty andconfig.solve["model"]
isMESSAGE-MACRO
, thentransfer_demands()
is called to transfer data from the indicated scenario to scenario. This scenario must exist on the samePlatform
as scenario; the default version is loaded.
Then:
scenario is solved passing
Config.solve
as keyword arguments tomessage_ix.Scenario.solve()
. The keyword argument var_list hasI
,C
, and (ifconfig.solve["model"]
isMESSAGE-MACRO
)GDP
appended.
After scenario is solved without exception:
set_as_default()
is called if the keyword argument set_as_default isTrue
.
- message_ix_models.model.workflow.step_0(context: Context, scenario: Scenario, **kwargs) → Scenario[source]
Preparation step for climate policy workflows.
This is similar to (and shares the name of)
project.engage.workflow.step_0()
, but uses settings specific to the model structure used in SSP 2023–2025 / ScenarioMIP at (5) and (6).Remove the model solution.
Call
remove_emission_bounds
.Update
Config.regions
to match scenario.Call
add_FFI_CO2_accounting
.Call
add_AFOLU_CO2_accounting()
with the default method, currentlyMETHOD.B
.Call
add_alternative_TCE_accounting
with the default method, currentlyMETHOD.B
.Call
add_CO2_emission_constraint
withconstraint_value=0, type_rel="lower"
, effectively preventing negative emissions.
Todo
Merge
project.engage.workflow.step_0()
into this function and generalize with appropriate options/parameters.