message_ix_models.model.buildings.config.Config
- class message_ix_models.model.buildings.config.Config(sturm_scenario: str, code: str = 'R', climate_scenario: str = 'BL', clone: bool = False, code_dir: Path = <factory>, data_paths: DataPaths = <factory>, max_iterations: int = 0, method: METHOD = METHOD.A, with_materials: bool = True, _output_path: Path | None = None, run_access: bool = False, solve: dict[str, ~typing.Any]=<factory>, solve_config: Config = <factory>, ssp: str = 'SSP2', sturm_method: METHOD = METHOD.RSCRIPT_A)[source]
Bases:
ConfigHelperConfiguration options for
buildingscode.The code responds to values set on an instance of this class.
- Raises:
FileNotFoundError – if
code_dirpoints to a non-existent directory.
- __init__(sturm_scenario: str, code: str = 'R', climate_scenario: str = 'BL', clone: bool = False, code_dir: Path = <factory>, data_paths: DataPaths = <factory>, max_iterations: int = 0, method: METHOD = METHOD.A, with_materials: bool = True, _output_path: Path | None = None, run_access: bool = False, solve: dict[str, ~typing.Any]=<factory>, solve_config: Config = <factory>, ssp: str = 'SSP2', sturm_method: METHOD = METHOD.RSCRIPT_A) None[source]
Methods
__init__(sturm_scenario, code, ...)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[, key])Update configuration from file.
replace(**kwargs)Like
dataclasses.replace()with name manipulation.set_output_path(context)Set
_output_pathbased on context.update([arg])Update attributes in-place.
Attributes
Climate scenario.
Trueif the base scenario should be cloned.STURM / MESSAGEix-Buildings scenario key written to
scenario_config.yaml.Maximum number of iterations of the ACCESS–STURM–MESSAGE loop.
Code path to use in
buildings.build.main().Run the ACCESS model on every iteration.
The expected path to a directory of STURM R code, within
code_dir.The expected path to a directory with STURM input files.
Method for running STURM.
Trueif the MESSAGEix-Materials + MESSAGEix-Buildings combination is activeName or ID of STURM scenario to run.
Path to the MESSAGEix-Buildings code and data.
Paths to input data files.
Keyword arguments for
message_ix.Scenario.solve().Similar to solve, but using another config class.
- code: str = 'R'[source]
STURM / MESSAGEix-Buildings scenario key written to
scenario_config.yaml. This is thestrID of a code incirceular.structure.CL_SCENARIO, for instance"R".
- code_dir: Path[source]
Path to the MESSAGEix-Buildings code and data.
If not set explicitly, this is populated using
_code_dir_factory().
- classmethod from_dict(data: Mapping)[source]
Construct an instance from data with name manipulation.
- hexdigest(length: int = -1) str[source]
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. The returned value should be the same across versions of Python.- Returns:
If length is greater than 0, a string of this length; otherwise a 32-character string from
blake2s.hexdigest().- Return type:
- max_iterations: int = 0[source]
Maximum number of iterations of the ACCESS–STURM–MESSAGE loop. Set to 1 for once-through mode.
- method: METHOD = 1[source]
Code path to use in
buildings.build.main().
- read_file(path: Path, key: str = '') None[source]
Update configuration from file.
- Parameters:
path – to a
.yamlfile containing a top-level mapping.key – if given, read data not from the top level of the file, but from a sub- mapping under the top-level key key.
optional – if given, read data not from the top level of the file, but from a sub- mapping under the top-level key key.
- replace(**kwargs)[source]
Like
dataclasses.replace()with name manipulation.
- solve: dict[str, Any][source]
Keyword arguments for
message_ix.Scenario.solve(). Set model=”MESSAGE_MACRO” to solve scenarios using MESSAGE_MACRO.
- property sturm_code_dir: Path[source]
The expected path to a directory of STURM R code, within
code_dir.
- sturm_method: METHOD = 2[source]
Method for running STURM. See
sturm.run().