Learn R Programming

RCMIP5 (version 1.2.0)

cmip5data: The 'cmip5data' class

Description

This constructor has two functions. First, given a list, it makes the list a cmip5data-class object (no check is made that the list has appropriate fields though). Second, if given a numeric value(s), it returns sample/ example data in the newly constructed object. This is used extensively by the testing code.

Usage

cmip5data(x = list(), lonlat = TRUE, lonsize = 10, latsize = 10, Z = FALSE, Zsize = 5, time = TRUE, monthly = TRUE, randomize = FALSE, irregular = FALSE, verbose = FALSE, loadAs = "data.frame")

Arguments

x
A list or numeric. If x is a list then the fields are expected to match those of the returned cmip5data object. If x is a numeric sample data is created where the numeric indicates the years of sample data to return.
lonlat
Boolean indicating whether to create lon and lat dimensions
lonsize
Integer size of longitude dimension
latsize
Integer size of latitude dimension
Z
logical. Create Z dimension?
Zsize
integer. Size of Z dimension
time
logical. Create time dimension?
monthly
logical. Monthly (if not, annual) data?
randomize
logical. Random sample data?
irregular
logical. Irregular lon/lat grid?
verbose
logical. Print info as we go?
loadAs
a string identifying possible structures for values. Currently: 'data.frame' and 'array' the only valid options.

Value

A cmip5data object, which is a list with the following fields:

Examples

Run this code
cmip5data(1970)  # produces monthly sample data for year 1970
cmip5data(1970:2014)
cmip5data(1970:2014, monthly=FALSE)  # annual data
cmip5data(1970:2014, randomize=TRUE) # randomized data
cmip5data(1970:2014, Z=TRUE)  # four-dimensional data
cmip5data(0, time=FALSE)  # sample 'fx' data, two-dimensional
cmip5data(list())  # makes this (here empty) list class into 'cmip5data'

Run the code above in your browser using DataLab