Reproduce the RES (model.bare)

In contrast to model.create, this module creates the RES ‘from scratch’. create_res() begins by creating a new, totally empty Scenario and adding data to it (instead of cloning and modifying an existing scenario).

Note

Currently, the Scenario returned by create_res()

  • is not complete, nor the official/preferred version of MESSAGEix-GLOBIOM, and as such must not be used for actual research,

  • however, it should be used for creating unit tests of other code that is designed to operate on MESSAGEix-GLOBIOM scenarios; code that works against the bare RES should also work against MESSAGEix-GLOBIOM scenarios.

bare.get_spec() can also be used directly, to get a description of the RES based on certain settings/options, but without any need to connect to a database, load an existing Scenario, or call bare.create_res(). This can be useful in code that processes data into a form compatible with MESSAGEix-GLOBIOM.

Configuration

The code obeys the settings on the model.Config instance stored at context.model.

Code reference

message_ix_models.model.bare.SETTINGS = {'regions': ['R14', 'ADVANCE', 'B210-R11', 'ISR', 'R11', 'R12', 'R17', 'R20', 'R32', 'RCP', 'ZMB'], 'res_with_dummies': [False, True], 'years': ['B', 'A']}

Deprecated; use model.Config instead.

message_ix_models.model.bare.create_res(context, quiet=True)[source]

Create a ‘bare’ MESSAGEix-GLOBIOM reference energy system (RES).

Parameters:
  • context (Context) –

    model.Config.scenario_info determines the model name and scenario name of the created Scenario. If not provided, the defaults are:

    • Model name generated by name().

    • Scenario name “baseline”.

  • quiet (bool, optional) – Passed to quiet argument of build.apply_spec().

Returns:

A scenario as described by bare.get_spec(), prepared using apply_spec().

Return type:

message_ix.Scenario

message_ix_models.model.bare.name(context, *, unique: bool = False) str[source]

Generate a candidate name for a model given context.

The name has a form like:

MESSAGEix-GLOBIOM R99 YA +D
MESSAGEix-GLOBIOM R99 YA a1b2c

where:

message_ix_models.model.bare.get_spec(context) Spec[source]

Return the spec for the MESSAGE-GLOBIOM global model RES.

If Config.res_with_dummies is set, additional elements are added:

  • commodity: “dummy”

  • technology: “dummy”, “dummy supply”

These may be used for testing purposes, but should not be used in production models.

Return type:

dict of ScenarioInfo objects

Since the RES is the base for all variants of MESSAGEix-GLOBIOM, the ‘require’ and ‘remove’ portions of the spec are empty.

For the ‘add’ section, message_ix_models.model.structure.get_codes() is used to retrieve data from the YAML files in message_ix_models.

Settings are retrieved from context, as above.

message_ix_models.model.data.get_data(scenario, context, spec, **options)[source]

Data for the bare RES.

Todo

With ixmp#212 merged, some model.bare code could be moved to a new class and method like MESSAGE_GLOBIOM.initialize().