Description Usage Arguments Details Value Examples
Produces sums of values that exceed (or are below) the specified threshold.
1 | number.days.op.threshold(temp, date.factor, threshold, op = "<")
|
temp |
Sequence temperature values. |
date.factor |
Factor to aggregate by. |
threshold |
Threshold to use. |
op |
Operator to use for comparison. |
This function takes a data series, a threshold, an operator, and a factor to aggregate by. It uses the operator to compare the threshold to the data series, creating a series of booleans, then sums the booleans according to the factor.
A vector consisting of the number of values that meet the criteria
in the given time period (as specified by date.factor
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(PCICt)
## Parse the dates into PCICt.
tmax.dates <- as.PCICt(do.call(paste, ec.1018935.tmax[,c("year",
"jday")]), format="%Y %j", cal="gregorian")
tmin.dates <- as.PCICt(do.call(paste, ec.1018935.tmin[,c("year",
"jday")]), format="%Y %j", cal="gregorian")
prec.dates <- as.PCICt(do.call(paste, ec.1018935.prec[,c("year",
"jday")]), format="%Y %j", cal="gregorian")
## Load the data in.
ci <- climdexInput.raw(ec.1018935.tmax$MAX_TEMP,
ec.1018935.tmin$MIN_TEMP, ec.1018935.prec$ONE_DAY_PRECIPITATION,
tmax.dates, tmin.dates, prec.dates, base.range=c(1971, 2000))
## Calculate frost days.
fd <- number.days.op.threshold(ci@data$tmin,
ci@date.factors$annual, 0, "<")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.