Package 'rOpenscmRunner'

Title: Run different simple climate models from R using a unified interface
Description: Using openscm-runner, you can run different simple climate models using a unified API. It supports emissions-driven runs only. rOpenscmRunner is a wrapper to easily use openscm-runner from R.
Authors: Mika Pflüger [aut, cre]
Maintainer: Mika Pflüger <[email protected]>
License: BSD_3_clause + file LICENSE
Version: 0.3.3
Built: 2024-11-03 03:50:40 UTC
Source: https://github.com/pik-piam/rOpenscmRunner

Help Index


rOpenscmRunner: Run different simple climate models from R using a unified interface

Description

Using openscm-runner, you can run different simple climate models using a unified API. It supports emissions-driven runs only. rOpenscmRunner is a wrapper to easily use openscm-runner from R.

Author(s)

Maintainer: Mika Pflüger [email protected]

See Also

Useful links:


run

Description

Run one or multiple climate models over one or multiple emissions scenarios.

Usage

run(
  climateModelsConfigs,
  scenarios,
  outputVariables = list("Surface Temperature"),
  outConfig = NULL,
  returnRaw = FALSE
)

Arguments

climateModelsConfigs

Named list where the names are climate models and the corresponding list member is a configuration or list of configurations to use for this model. Use NULL to denote the default configuration with no changes. Climate model names supported: CiceroSCM, FaIR, and MAGICC7. The supported configuration settings depend on the used climate model, please refer to their respective documentation.

scenarios

DataFrame containing one or multiple emissions scenarios to simulate. The data shoud be in IAMC format, i.e. a wide data frame with the years as columns. Index columns that are additionally required are "model", "scenario", "region", "variable", and "unit". The "variable" must also follow the IAMC format naming conventions, e.g. "Emissions|CO2" for the 'total CO2 emissions (not including CCS)'.

outputVariables

A list of variables to include in the output.

outConfig

Named list where the names are climate models and the corresponding list member is a list of configuration values to include in the output in the metadata. Optional, default: don't include input variables in the output metadata.

returnRaw

Boolean to control the return type. By default (returnRaw = FALSE), run() returns a named list result, where result$df is a data frame which contains the result in the same format as the input scenarios, and result$metadata is a named list of metadata generated during the run. If returnRaw is TRUE, run() returns a python scmdata.ScmRun object.

Details

Some simple climate models need certain information to run. Use the setup function to supply this information before attempting to use run.

Author(s)

Mika Pflüger

Examples

## Not run: 
# create very minimal emissions scenario.
df <- data.frame(
 model = c("rand", "rand"),
 scenario = c("weirdEMI", "weirdEMI"),
 region = c("World", "World"),
 variable = c("Emissions|CO2", "Emissions|CH4"),
 unit = c("Mt CO2 / yr", "Mt CH4 / yr"),
 "2015" = c(9., 12.),
 "2020" = c(10., 11.),
 check.names = FALSE)

# simulate the scenario using MAGICC7 with default settings.
run(climateModelsConfigs = list(MAGICC7 = NULL), scenarios = df)

# simulate the scenario using MAGICC7 with default settings but "somesetting" set to "12"
run(climateModelsConfigs = list(MAGICC7 = list(somesetting = "12")), scenarios = df)

# simulate the scenario with MAGICC7 and FaIR, each with two different sets of configurations
# where in MAGICC7 we change "somesetting" and in FaIR we change "fairsetting".
# Also include the changed configuration settings in the output.
run(climateModelsConfigs = list(MAGICC7 = list(list(somesetting = "12"),
                                                 list(somesetting = "13")),
                                FaIR = list(list(fairsetting = "slr"),
                                              list(fairsetting = "noslr"))),
    scenarios = df,
    outConfig = list(MAGICC7 = list("somesetting"), FaIR = list("fairsetting")))

## End(Not run)

setup

Description

Prepare rOpenscmRunner to run climate models.

Usage

setup(
  magiccExecutable7 = NULL,
  magiccWorkerNumber = NULL,
  magiccWorkerRootDir = NULL
)

Arguments

magiccExecutable7

The file path of a MAGICC version 7 executable file (with corresponding config file structure around it). You have to supply this if you intend to run MAGICC version 7. Instead of using this function to supply it, you can also set the environment variable MAGICC_EXECUTABLE_7 before starting your R session.

magiccWorkerNumber

The number of processes which should be started when running MAGICC. By default, as many processes are started as there are processors in your system. Instead of using this function to supply the setting, you can also set the environment variable MAGICC_WORKER_NUMBER before starting your R session.

magiccWorkerRootDir

The path to a folder where the temporary directories to run MAGICC will be created. Needs to be provided for MAGICC to work. Instead of using this function to supply the setting, you can also set the environment variable MAGICC_WORKER_ROOT_DIR before starting your R session.

Details

Some simple climate models need certain information to run. This function provides a unified interface to supply this information.

Author(s)

Mika Pflüger

Examples

setup(magiccExecutable7 = "/path/to/magicc/bin/magicc", magiccWorkerNumber = 4)