climdexInput.csv: Method for creating climdexInput object from CSV files

Description Usage Arguments Details Value Note References See Also Examples

View source: R/climdex.r

Description

This function creates a climdexInput object from data in CSV files.

Usage

1
2
3
4
5
6
7
climdexInput.csv(tmax.file = NULL, tmin.file = NULL, prec.file = NULL,
  data.columns = list(tmin = "tmin", tmax = "tmax", prec = "prec"),
  base.range = c(1961, 1990), na.strings = NULL, cal = "gregorian",
  date.types = NULL, n = 5, northern.hemisphere = TRUE,
  tavg.file = NULL, quantiles = NULL, temp.qtiles = c(0.1, 0.9),
  prec.qtiles = c(0.95, 0.99), max.missing.days = c(annual = 15, monthly =
  3), min.base.data.fraction.present = 0.1)

Arguments

tmax.file

Name of file containing daily maximum temperature data.

tmin.file

Name of file containing daily minimum temperature data.

prec.file

Name of file containing daily total precipitation data.

data.columns

Column names for tmin, tmax, and prec data.

base.range

Years to use for the baseline.

na.strings

Strings used for NA values; passed to read.csv.

cal

The calendar type used in the input files.

date.types

Column names for tmin, tmax, and prec data (see notes).

n

Number of days to use as window for daily quantiles.

northern.hemisphere

Whether this point is in the northern hemisphere.

tavg.file

Name of file containing daily mean temperature data.

quantiles

Threshold quantiles for supplied variables.

temp.qtiles

Quantiles to calculate for temperature variables

prec.qtiles

Quantiles to calculate for precipitation

max.missing.days

Vector containing thresholds for number of days allowed missing per year (annual) and per month (monthly).

min.base.data.fraction.present

Minimum fraction of base data that must be present for quantile to be calculated for a particular day

Details

This function takes input climate data in CSV files at daily resolution, and produces as output a ClimdexInput data structure. This data structure can then be passed to any of the routines used to compute the Climdex indices. The indices themselves are specified on the webpage cited in the references section.

Any of tmin.file (daily minimum temperature), tmax.file (daily maximum temperature), tavg.file (daily mean temperature), and prec.file (daily precipitation) can be passed in. tavg will be derived from the mean of tmax and tmin if it is not supplied. If any of tmin.file, tmax.file, and prec.file are not supplied, the set of indices which can be calculated will be limited to indices which do not involve the missing variables.

The tmax.file, tmin.file, and prec.file arguments should be names of CSV files containing dates and the data on which the indices are to be computed. The units are assumed to be degrees C for temperature, and mm/day for precipitation.

The data.columns argument is a vector consisting of named items tmax, tmin, and prec. These named items are used as the column names in their respective files when loading in CSV.

The cal argument is a textual description of the calendar type, as described in the documentation for as.PCICt.

The date.types argument is a list of lists containing two named items: fields, and format. The fields item is a vector of names consisting of the columns to be concatenated together with spaces. The format item is a date format as taken by strptime.

For more details on arguments, see climdexInput.raw.

Value

An object of class climdexInput-class for use with other climdex methods.

Note

Units are assumed to be mm/day for precipitation and degrees Celsius for temperature. No units conversion is performed internally.

References

http://etccdi.pacificclimate.org/list_27_indices.shtml

See Also

climdex.pcic-package, climdexInput.raw.

Examples

1
2
3
4
5
## This would create a climdexInput object from a set of filenames (already
## stored as variables), with a different date format.
## Not run: ci.csv <- climdexInput.csv(tmax.filename, tmin.filename,
prec.filename, date.types=list(list(fields=c("date"), format="%Y-%m-%d")))
## End(Not run)

climdex.pcic documentation built on March 26, 2020, 7:17 p.m.