climdexInput.raw: Method for creating climdexInput object from vectors of data

View source: R/climdex.r

climdexInput.rawR Documentation

Method for creating climdexInput object from vectors of data

Description

This function creates a climdexInput object from data already ingested into R.

For all data supplied, the associated dates must also be supplied.

Usage

climdexInput.raw(tmax = NULL, tmax.dates = NULL, tmin = NULL,
  tmin.dates = NULL, tavg = NULL, tavg.dates = NULL, prec = NULL,
  prec.dates = NULL, snow = NULL, snow.dates = NULL, snow_new = NULL,
  snow_new.dates = NULL, wind = NULL, wind.dates = NULL,
  wind_gust = NULL, wind_gust.dates = NULL, wind_dir = NULL,
  wind_dir.dates = NULL, cloud = NULL, cloud.dates = NULL, sun = NULL,
  sun.dates = NULL, sun_rel = NULL, sun_rel.dates = NULL,
  quantiles = NULL, temp.qtiles = c(0.1, 0.25, 0.75, 0.9),
  prec.qtiles = c(0.25, 0.75, 0.95, 0.99), base.range = c(1961, 1990),
  n = 5, northern.hemisphere = TRUE, max.missing.days = c(annual = 15,
  halfyear = 10, seasonal = 8, monthly = 3),
  min.base.data.fraction.present = 0.1)

Arguments

tmax

Daily maximum temperature data.

tmax.dates

Dates for the daily maximum temperature data.

tmin

Daily minimum temperature data.

tmin.dates

Dates for the daily minimum temperature data.

tavg

Daily mean temperature data.

tavg.dates

Dates for the daily mean temperature data.

prec

Daily total precipitation data.

prec.dates

Dates for the daily total precipitation data.

quantiles

Threshold quantiles for supplied variables.

temp.qtiles

Quantiles to calculate for temperature variables

prec.qtiles

Quantiles to calculate for precipitation

base.range

Years to use for the baseline.

n

Number of days to use as window for daily quantiles.

northern.hemisphere

Whether this point is in the northern hemisphere.

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 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. The base.range argument is a pair of 4 digit years which bound the data on which the base percentiles are calculated.

The tmax, tmin, and prec arguments are numeric vectors containing 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 tmax.dates, tmin.dates, and prec.dates arguments are vectors of type PCICt.

The n argument specifies the size of the window used when computing the percentiles used in climdex.tx10p, climdex.tn10p, climdex.tx90p, and climdex.tn90p.

The northern.hemisphere argument specifies whether the data came from the northern hemisphere. If FALSE, data is assumed to have come from the southern hemisphere. This is used when computing growing season length; if the data is from the southern hemisphere, growing season length is the growing season starting in the beginning of July of the year indicated, running to the end of June of the following year.

The quantiles argument allows the user to supply pre-computed quantiles. This is a list consisting of quantiles for each variable.

For each temperature variable, there are separate lists of quantiles for inbase and outbase, with these names. In both cases, quantiles within these lists are named q10 for the 10th percentile and q90 for the 90th percentile. Other percentiles would be named qnn for the nnth percentile. For the outbase quantiles, each element in the list is a vector of length 365 (or 360 in the case of 360-day calendars), corresponding to one value for each day of the year. For the inbase quantiles, each element in the list is an array of dimensions [365 or 360, nyr, nyr - 1], where nyr is the number of years in the base period. Each value corresponds to a quantile for each day, for each year, with a particular year replaced.

For precipitation variables, there is a named vector of quantiles, consisting of at least q95 and q99.

The temp.qtiles and prec.qtiles arguments allow the user to modify the quantiles calculated. For example, specifying temp.qtiles=c(0.10, 0.50, 0.90) would calculate the 10th, 50th, and 90th percentiles for temperature.

The min.base.fraction.present argument specifies the minimum fraction of data which must be present for a quantile to be calculated for a particular day. If the fraction of data present is less than this threshold, the quantile for that day will be set to NA.

The max.missing.days argument is a vector consisting of 'annual' (the number of days that can be missing in a year) and 'monthly' (the number of days that can be missing in a month. If one month in a year fails the test, the corresponding year will be omitted.

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, strptime.


ECA-D/climind documentation built on Nov. 26, 2022, 10:20 a.m.