Skip to contents

This function will fetch results and return them as a data frame. The core must be active in order for this to work; attempting to fetch results from a core that has been shut down will cause an error.

Usage

fetchvars(core, dates, vars = NULL, scenario = NULL)

Arguments

core

Hector core object

dates

Vector of dates to fetch; this will be automatically trimmed to dates that are between the start date and the latest date currently run. Set to NA to return data with no associated dates such as model parameters.

vars

List (or vector) of capability strings defining the variables to be fetched in the result.

scenario

Optional scenario name. If not specified, the name element of the Hector core object will be used.

Details

The variables to fetch should be given as a sequence of character strings corresponding to the capabilities declared by hector components. These strings should be generated using the capability identifier functions (see below for a list of documentation pages for these).

The list of variables to fetch if you don't specify vars is stored in the hector.default.fetchvars option. If this option is also unset, then the default variable list is CO2 concentration, total radiative forcing, CO2 forcing, and global mean temperature. To see a list of the potential vars see data(inputstable) and data(fxntable).

Examples

if (FALSE) {
ini <- system.file(package = "hector", "input/hector_ssp245.ini")
hc <- newcore(ini)
run(hc)
out <- fetchvars(core = hc, dates = 1900:2100, vars = c(GLOBAL_TAS(), NPP()))
print(out)
}