gcages.ar6.scm_running#
Simple climate model (SCM) running part of the AR6 workflow
Classes:
| Name | Description |
|---|---|
AR6SCMRunner |
Simple climate model runner that follows the same logic as was used in AR6 |
Functions:
| Name | Description |
|---|---|
check_ar6_magicc7_version |
Check that the MAGICC7 version is what was used in AR6 |
load_ar6_magicc_probabilistic_config |
Load the probabilistic config used with MAGICC in AR6 |
Attributes:
| Name | Type | Description |
|---|---|---|
DEFAULT_OUTPUT_VARIABLES |
tuple[str, ...]
|
Default output variables |
DEFAULT_OUTPUT_VARIABLES
module-attribute
#
DEFAULT_OUTPUT_VARIABLES: tuple[str, ...] = (
"Surface Air Temperature Change",
"Surface Air Ocean Blended Temperature Change",
"Effective Radiative Forcing",
"Effective Radiative Forcing|Anthropogenic",
"Effective Radiative Forcing|Aerosols",
"Effective Radiative Forcing|Aerosols|Direct Effect",
"Effective Radiative Forcing|Aerosols|Direct Effect|BC",
"Effective Radiative Forcing|Aerosols|Direct Effect|OC",
"Effective Radiative Forcing|Aerosols|Direct Effect|SOx",
"Effective Radiative Forcing|Aerosols|Indirect Effect",
"Effective Radiative Forcing|Greenhouse Gases",
"Effective Radiative Forcing|CO2",
"Effective Radiative Forcing|CH4",
"Effective Radiative Forcing|N2O",
"Effective Radiative Forcing|F-Gases",
"Effective Radiative Forcing|Montreal Protocol Halogen Gases",
"Effective Radiative Forcing|Ozone",
"Heat Uptake",
"Atmospheric Concentrations|CO2",
"Atmospheric Concentrations|CH4",
"Atmospheric Concentrations|N2O",
"Net Atmosphere to Land Flux|CO2",
"Net Atmosphere to Ocean Flux|CO2",
"Net Land to Atmosphere Flux|CO2|Earth System Feedbacks|Permafrost",
"Net Land to Atmosphere Flux|CH4|Earth System Feedbacks|Permafrost",
)
Default output variables
Note that it can be a bit of work to get these variables to actually appear in the output, depending on which simple climate model you're using.
AR6SCMRunner #
Simple climate model runner that follows the same logic as was used in AR6
If you want exactly the same behaviour as in AR6,
initialise using from_ar6_config
Methods:
| Name | Description |
|---|---|
__call__ |
Run the simple climate model |
from_ar6_config |
Initialise from the config used in AR6 |
Attributes:
| Name | Type | Description |
|---|---|---|
batch_size_scenarios |
int | None
|
The number of scenarios to run at a time |
climate_models_cfgs |
dict[str, list[dict[str, Any]]]
|
Climate models to run and the configuration to use with them |
db |
OpenSCMDB | None
|
Database in which to store the output of the runs |
force_interpolate_to_yearly |
bool
|
Should we interpolate scenarios we run to yearly steps before running the SCMs. |
harmonisation_year |
int | None
|
Year in which the data was harmonised |
historical_emissions |
DataFrame | None
|
Historical emissions used for harmonisation |
n_processes |
int | None
|
Number of processes to use for parallel processing. |
output_variables |
tuple[str, ...]
|
Variables to include in the output |
progress |
bool
|
Should progress bars be shown for each operation? |
res_column_type |
type
|
Type to cast the result's column type to |
run_checks |
bool
|
If |
verbose |
bool
|
Should verbose messages be printed? |
Source code in src/gcages/ar6/scm_running.py
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 155 156 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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
batch_size_scenarios
class-attribute
instance-attribute
#
batch_size_scenarios: int | None = None
The number of scenarios to run at a time
Smaller batch sizes use less memory, but take longer overall (all else being equal).
If not supplied, all scenarios are run simultaneously.
climate_models_cfgs
class-attribute
instance-attribute
#
climate_models_cfgs: dict[str, list[dict[str, Any]]] = (
field(
repr=lambda x: join(
f"{climate_model}: {len(cfgs)} configurations"
for (climate_model, cfgs) in items()
)
)
)
Climate models to run and the configuration to use with them
db
class-attribute
instance-attribute
#
db: OpenSCMDB | None = None
Database in which to store the output of the runs
If not supplied, output of the runs is not stored.
force_interpolate_to_yearly
class-attribute
instance-attribute
#
force_interpolate_to_yearly: bool = True
Should we interpolate scenarios we run to yearly steps before running the SCMs.
harmonisation_year
class-attribute
instance-attribute
#
harmonisation_year: int | None = None
Year in which the data was harmonised
Only required if run_checks is True to check
that the data to run is harmonised.
historical_emissions
class-attribute
instance-attribute
#
historical_emissions: DataFrame | None = None
Historical emissions used for harmonisation
Only required if run_checks is True to check
that the data to run is harmonised.
n_processes
class-attribute
instance-attribute
#
Number of processes to use for parallel processing.
Set to None to process in serial.
output_variables
instance-attribute
#
Variables to include in the output
progress
class-attribute
instance-attribute
#
progress: bool = True
Should progress bars be shown for each operation?
res_column_type
class-attribute
instance-attribute
#
Type to cast the result's column type to
run_checks
class-attribute
instance-attribute
#
run_checks: bool = True
If True, run checks on both input and output data
If you are sure about your workflow, you can disable the checks to speed things up (but we don't recommend this unless you really are confident about what you're doing).
verbose
class-attribute
instance-attribute
#
verbose: bool = True
Should verbose messages be printed?
This is a temporary hack while we think about how to handle logging
__call__ #
Run the simple climate model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_emissions
|
DataFrame
|
Emissions to run |
required |
force_rerun
|
bool
|
Force scenarios to re-run (i.e. disable caching). |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Raw results from the simple climate model |
Source code in src/gcages/ar6/scm_running.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
from_ar6_config
classmethod
#
from_ar6_config(
magicc_exe_path: Path,
magicc_prob_distribution_path: Path,
output_variables: tuple[
str, ...
] = DEFAULT_OUTPUT_VARIABLES,
batch_size_scenarios: int | None = None,
db: OpenSCMDB | None = None,
historical_emissions: DataFrame | None = None,
harmonisation_year: int | None = None,
verbose: bool = True,
run_checks: bool = True,
progress: bool = True,
n_processes: int | None = cpu_count(),
) -> AR6SCMRunner
Initialise from the config used in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magicc_exe_path
|
Path
|
Path to the MAGICC executable to use. This should be a MAGICC v7.5.3 executable. |
required |
magicc_prob_distribution_path
|
Path
|
Path to the MAGICC probabilistic distribution. This should be the AR6 probabilistic distribution. |
required |
output_variables
|
tuple[str, ...]
|
Variables to include in the output |
DEFAULT_OUTPUT_VARIABLES
|
batch_size_scenarios
|
int | None
|
The number of scenarios to run at a time |
None
|
db
|
OpenSCMDB | None
|
Database to use for storing results. If not supplied, raw outputs are not stored. |
None
|
historical_emissions
|
DataFrame | None
|
Historical emissions used for harmonisation Only required if |
None
|
harmonisation_year
|
int | None
|
Year in which the data was harmonised Only required if |
None
|
verbose
|
bool
|
Should verbose messages be printed? This is a temporary hack while we think about how to handle logging |
True
|
run_checks
|
bool
|
Should checks of the input and output data be performed? If this is turned off, things are faster, but error messages are much less clear if things go wrong. |
True
|
progress
|
bool
|
Should progress bars be shown for each operation? |
True
|
n_processes
|
int | None
|
Number of processes to use for parallel processing. Set to |
cpu_count()
|
Returns:
| Type | Description |
|---|---|
AR6SCMRunner
|
Initialised SCM runner |
Source code in src/gcages/ar6/scm_running.py
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
check_ar6_magicc7_version #
Check that the MAGICC7 version is what was used in AR6
Source code in src/gcages/ar6/scm_running.py
load_ar6_magicc_probabilistic_config #
Load the probabilistic config used with MAGICC in AR6
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
Path
|
Filepath from which to load the probabilistic configuration |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
Probabilistic configuration used with MAGICC in AR6 |
Raises:
| Type | Description |
|---|---|
AssertionError
|
|