get_models_data | R Documentation |
Retrieves temperature data of CMIP3 or CMIP5 models from files of individual model runs, with or without saving a combined data set, or from a combined R data set.
get_models_data(
ensemble = c("cmip3", "cmip5"),
baseline = NULL,
save = FALSE,
data_dir,
subdir = NULL,
cmip3_raw = FALSE,
center_fun = "mean",
convert_fun = kelvin_to_celsius
)
ensemble |
One of "cmip3" or "cmip5" coresponding to the appropriate IPCC model ensemble. |
baseline |
An integer year or, more typically, range of years on which the temperature anomalies will be centered. If |
save |
If |
subdir |
Corresponds to a subdirectory containing a specific set of model runs, with the CMIP3+ default "all members" almost always being preferred; likewise the CMIP5 default "all models". |
cmip3_raw |
Logical. The CMIP3+ "all models" data contains SRES A2 and SRES B1 scenario runs that typically begin in Jan. 2001, so they need to be centered differently from SRES B1; also, the 20C3M scenario runs typically end in Dec. 2000, which needs to be accounted for. If the |
center_fun |
The function used to calculate the central tendency of the model runs at each time point; the default of |
A data frame of CMIP model runs. (Obivously I should give more detail here.)
## Not run:
## The most common uses:
cmip5 <- get_models_data(ensemble="cmip5", baseline=1981:2010, save=FALSE)
cmip3 <- get_models_data(baseline=1981:2010, save=FALSE)
## Other common uses:
cmip3 <- get_models_data(baseline=1981:2010, save=NULL) # Retrieve CMIP3 data without saving combined data set.
cmip3 <- get_models_data(baseline=1981:2010, save=TRUE) # Retrieve CMIP3 data and save as combined data set.
cmip3 <- get_models_data(baseline=1981:2010, save=FALSE) # Load CMIP3 data from combined R data set.
cmip3 <- get_models_data(baseline=NULL, save=TRUE) # Retrieve "raw" CMIP3 data and save as combined data set.
cmip3 <- get_models_data(baseline=NULL, save=FALSE) # Load "raw" CMIP3 data from combined R data set.
cmip5 <- get_models_data(ensemble="cmip5", baseline=1981:2010, save=TRUE, subdir="all members") # Save CMIP5 data from "all members" data set.
cmip5 <- get_models_data(ensemble="cmip5", baseline=1981:2010, save=TRUE, subdir="1 member per model") # Save CMIP5 data from "1 member per model" data set.
## Copy this to the R command line to redo all the data:
cmip3 <- get_models_data(baseline=1981:2010, save=TRUE)
cmip3 <- get_models_data(baseline=NULL, save=TRUE)
cmip3 <- get_models_data(baseline=1981:2010, save=TRUE, subdir="all models")
cmip3 <- get_models_data(baseline=NULL, save=TRUE, subdir="all models")
cmip3 <- get_models_data(baseline=1981:2010, save=TRUE, subdir="multi-model mean")
cmip3 <- get_models_data(baseline=NULL, save=TRUE, subdir="multi-model mean")
cmip5 <- get_models_data(ensemble="cmip5", baseline=1981:2010, save=TRUE)
cmip5 <- get_models_data(ensemble="cmip5", baseline=NULL, save=TRUE)
cmip5 <- get_models_data(ensemble="cmip5", baseline=1981:2010, save=TRUE, subdir="1 member per model")
cmip5 <- get_models_data(ensemble="cmip5", baseline=NULL, save=TRUE, subdir="1 member per model")
cmip5 <- get_models_data(ensemble="cmip5", baseline=1981:2010, save=TRUE, subdir="all members")
cmip5 <- get_models_data(ensemble="cmip5", baseline=NULL, save=TRUE, subdir="all members")
cmip5 <- create_cmip5_tas_tos_data(save_to_package=TRUE)
## Create "meta" files to match up model runs with emissions scenarios. In each model-set directory, double-click on file "cmip(3|5).RData" and run the following code:
x <- "cmip3" # Or:
x <- "cmip5"
write.csv(eval(substitute(data.frame(model=names(attr(cmip, "scenario")), scenario=attr(cmip, "scenario")),
list(cmip=as.symbol(x)))), file=paste(x, "_meta.csv", sep=""), row.names=FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.