climdexInput.csv | R Documentation |
This function creates a climdexInput object from data in CSV files.
climdexInput.csv(tmax.file = NULL, tmin.file = NULL, tavg.file = NULL, prec.file = NULL, snow.file = NULL, snow_new.file = NULL, wind.file = NULL, wind_gust.file = NULL, wind_dir.file = NULL, cloud.file = NULL, sun.file = NULL, sun_rel.file = NULL, data.columns = list(tmin = "tmin", tmax = "tmax", tavg = "tavg", prec = "prec", snow = "snow", snow_new = "snow_new", wind = "wind", wind_gust = "wind_gust", wind_dir = "wind_dir", cloud = "cloud", sun = "sun", sun_rel = "sun_rel"), base.range = c(1961, 1990), na.strings = NULL, cal = "gregorian", date.types = NULL, n = 5, northern.hemisphere = TRUE, quantiles = NULL, temp.qtiles = c(0.1, 0.25, 0.75, 0.9), prec.qtiles = c(0.25, 0.75, 0.95, 0.99), max.missing.days = c(annual = 15, halfyear = 10, seasonal = 8, monthly = 3), min.base.data.fraction.present = 0.1)
tmax.file |
Name of file containing daily maximum temperature data. |
tmin.file |
Name of file containing daily minimum temperature data. |
tavg.file |
Name of file containing daily mean temperature data. |
prec.file |
Name of file containing daily total precipitation data. |
snow.file |
Name of file containing daily mean snow height data. |
snow_new.file |
Name of file containing daily mean new snow height data. |
wind.file |
Name of file containing daily mean wind speed data. |
wind_gust.file |
Name of file containing daily wind gust data. |
wind_dir.file |
Name of file containing daily mean wind direction data. |
cloud.file |
Name of file containing daily mean cloud cover data. |
sun.file |
Name of file containing daily mean sunshine duration data. |
sun_rel.file |
Name of file containing daily mean relative sunshine duration 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.table |
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. |
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 |
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 link{climdexInput.raw}
.
An object of class climdexInput-class
for use with
other climdex methods.
Units are assumed to be mm/day for precipitation and degrees Celsius for temperature. No units conversion is performed internally.
http://etccdi.pacificclimate.org/list_27_indices.shtml
climdex.pcic-package
, climdexInput.raw
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.