AeroMAPS¶
Initialization module for the AeroMAPS package.
This module provides factory functions to create AeroMAPS processes: - create_process: Auto-detects single vs multi-regional mode from config - create_multi_regional_process: Explicit multi-regional process creation
create_process ¶
create_process(configuration_file=None, custom_models=None, optimisation=False, multi_regional=False, disable_execution_statistics=None)
Create an AeroMAPS process, auto-detecting single vs multi-regional mode.
This factory function automatically creates the appropriate process type based on the configuration file contents or the multi_regional parameter. If the configuration file contains a 'regionalisation' section, a MultiRegionalProcess is created; otherwise, a standard AeroMAPSProcess is created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration_file
|
str
|
Path to the configuration file (default is None). |
None
|
custom_models
|
dict
|
Dictionary of additional models to be used. These are merged with
the standard models loaded from the configuration file's
|
None
|
optimisation
|
bool
|
Whether to enable optimisation (default is False). Note: Only supported for single-region mode currently. |
False
|
multi_regional
|
bool
|
Whether to force multi-regional mode (default is False). This can also be auto-detected from the configuration file's 'regionalisation' section. |
False
|
disable_execution_statistics
|
bool
|
Whether to disable GEMSEO's execution statistics shared memory. If None (default), automatically enabled for multi-regional mode to avoid semaphore exhaustion with many disciplines. |
None
|
Returns:
| Type | Description |
|---|---|
AeroMAPSProcess or MultiRegionalProcess
|
The appropriate process instance based on the configuration. |
Examples:
>>> # Single-region process
>>> process = create_process(configuration_file="config.yaml")
>>> process.compute()
>>>
>>> # Multi-regional process (auto-detected from config)
>>> process = create_process(configuration_file="config_with_regionalisation.yaml")
>>> process.compute()
>>> process.regional_processes["FR"].plot("co2_emissions")
Source code in aeromaps/__init__.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
create_multi_regional_process ¶
create_multi_regional_process(configuration_file, custom_models=None, disable_execution_statistics=None)
Create a multi-regional AeroMAPS process explicitly.
Use this function when you specifically want a MultiRegionalProcess with access to its multi-regional API (regional_processes, etc.).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration_file
|
str
|
Path to the configuration file with 'regionalisation' section. |
required |
custom_models
|
dict
|
Dictionary of additional models to be used. |
None
|
disable_execution_statistics
|
bool
|
Whether to disable GEMSEO's execution statistics. |
None
|
Returns:
| Type | Description |
|---|---|
MultiRegionalProcess
|
A configured multi-regional process instance. |
Examples:
>>> process = create_multi_regional_process("config.yaml")
>>> process.compute(parallel=True, max_workers=4)
>>>
>>> # Access regional data
>>> for region_id in process.list_regions():
... regional_proc = process.regional_processes[region_id]
... print(f"{region_id}: {regional_proc.data['vector_outputs']['co2_emissions'].iloc[-1]}")
>>>
>>> # Get aggregated global results
>>> global_outputs = process.get_global_outputs()
Source code in aeromaps/__init__.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
assemble_processes ¶
assemble_processes(processes)
Create a MultiProcess manager for scenario comparison.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
processes
|
dict or list
|
Dictionary mapping scenario names to AeroMAPSProcess objects, or a list of AeroMAPSProcess objects. |
required |
Returns:
| Type | Description |
|---|---|
AeroMAPSProcessesAssembly
|
An instance of the MultiProcess class for managing multiple scenarios. |
Examples:
>>> process1 = create_process(configuration_file="config1.yaml")
>>> process2 = create_process(configuration_file="config2.yaml")
>>> process1.compute()
>>> process2.compute()
>>> multi = assemble_processes({"scenario_1": process1, "scenario_2": process2})
>>> multi.list_available_plots()
>>> multi.plot("co2_emissions_comparison")
Source code in aeromaps/__init__.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |