Learn R Programming

wux (version 2.2-1)

CMIP5toModelinput: Creates a "modelinput" input file based on CMIP5 data on your disk to be further processed by models2wux.

Description

This function creates a "modelinput" list (written into a file). That file can then be used to have all the relevant CMIP5 model information available for "models2wux". The input for this function is the directory where CMIP5fromESGF saves all the data. It is crucial for this funcion that the data is saved in the same directory strucure as created by "CMIP5fromESGF" (GCMname/RCP) . This function works for CMIP5 data on monthly basis only and can currently process only the parameters "air_temperature" and "precipitation_amount".

Usage

CMIP5toModelinput(filedir = NULL, save.to = NULL, verbose = FALSE)

Arguments

filedir
Direcotry where the CMIP5 data are being stored. It is crucial for this funcion that the data is saved in the same directory strucure as created by CMIP5fromESGF.
save.to
character. Filename to safe the modelinupt.
verbose
boolean. For additional information printed on the screen.

Details

This function is based on the data obtained by CMIP5fromESGF. However, it is also possible to download the data manually and run this function. The directory structure must look like this: "GCMname/RCP" (e.g. /tmp/CMIP5/NorESM1-M/rcp85).

In the background a PYTHON script is executed. You can find the file by typing the command system.file("exec", "cmip5_to_wux_modeldict.py", package="wux")

References

Karl E. Taylor, Ronald J. Stouffer, and Gerald A. Meehl, 2012: An Overview of CMIP5 and the Experiment Design. Bull. Amer. Meteor. Soc., 93, 485-498. doi: http://dx.doi.org/10.1175/BAMS-D-11-00094.1

Examples

Run this code
## Not run: 
# ## download temperature fields of two example GCMs (NorESM1-M and
# ## CanESM2) with the  RCP 8.5 and the historical run
# ## into your temporary directory. This command will create a folder
# ## "CMIP5" in "~/tmp" with two subfolders for each model again with
# ## two subfolders for each experiment.
# CMIP5fromESGF(save.to = "~/tmp/CMIP5/",
#               models = c("NorESM1-M", "CanESM2"),
#               variables = c("tas"),
#               experiments= c("historical", "rcp85"))
# 
# ## create the corresponding modelinput list:
# CMIP5toModelinput(filedir = "~/tmp/CMIP5",
#                   save.to = "~/tmp/CMIP5_modelinput.R")
# 
# ## End(Not run)

Run the code above in your browser using DataLab