Learn R Programming

RCMIP5 (version 1.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, verbose = FALSE)

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?
verbose
logical. Print info as we go?

Value

  • A cmip5data object, which is a list with the following fields:
  • filesArray of strings containg the file(s) included in this dataset
  • variableString containg the variable name described by this dataset
  • modelString containing the model name of this dataset
  • experimentString containing the experiment name of this dataset
  • ensemblesArray of strings containg the ensemble(s) included in this dataset
  • domainString containing the domain name of this dataset
  • valMultidimensional array [x, y, z, t] holding the data
  • valUnitString containing the value units
  • lonNumeric vector containing longitude values; may be NULL
  • latNumeric vector containing latitude values; may be NULL
  • ZNumeric vector Z values; may be NULL
  • timeNumeric vector containing time values; may be NULL
  • dimNamesArray of strings containing the original (netcdf) dimension names
  • calendarStrString defining the calendar type; may be NULL
  • debugList with additional data (subject to change)
  • provenanceData frame with the object's provenance. See addProvenance
  • numPerYearNumeric vector; only present after makeAnnualStat
  • numYearsNumeric vector; only present after makeMonthlyStat
  • numCellsNumeric vector; only present after makeGlobalStat
  • filteredLogical; only present after filterDimensions

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