nday.consec.prec.max: Number of days (less than, greater than, etc) a threshold

Description Usage Arguments Details Value Examples

View source: R/climdex.r

Description

Produces sums of values that exceed (or are below) the specified threshold.

Usage

1
2
nday.consec.prec.max(daily.prec, date.factor, ndays,
  center.mean.on.last.day = FALSE)

Arguments

daily.prec

Daily timeseries of precipitation.

date.factor

Factor to aggregate by.

ndays

Number of days in the running window.

center.mean.on.last.day

Whether to center the n-day running mean on the last day of the series, instead of the middle day.

Details

This function takes a data series, the number of days in the running window, a date factor to aggregate by, and an optional modifier parameter (center.mean.on.last.day). It computes the n-day running sum of precipitation and returns the maximum n-day total precipitation per unit time, as defined by date.factor.

Value

A vector consisting of the maximum n-day sum of precipitation per time interval.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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))

## Compute rx5day on a monthly basis.
rx5day <- nday.consec.prec.max(ci@data$prec, ci@date.factors$monthly, 5)

Example output

Loading required package: PCICt

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