R: Sum of precipitation above a threshold

total.precip.op.threshold {climdex.pcic} | R Documentation

## Sum of precipitation above a threshold

### Description

This function returns the sum of values above a threshold for each period (as defined by date.factor).

### Usage

    total.precip.op.threshold(daily.prec, date.factor, threshold, op)

### Arguments

`daily.prec` | Data to compute index on.
`date.factor` | Date factor to split by.
`threshold` | The threshold to compare to.
`op` | The operator to use to compare data to threshold.

### Details

This routine sums up all values which exceed or are below (depending on op) the given threshold.

### Value

A timeseries of sums of numbers above the threshold for each period.

### See Also

`climdex.r99ptot`.

### Examples

    prec.dat <- c(0.1, 3.0, 4.3, 1.9, 1.3, 6.0, 0, 0, 4.0, 1)
    phony.date.factor <- factor(rep(1:2, each=5))

    ## Compute equiv of PRCPTOT
    prec.sum <- total.precip.op.threshold(prec.dat, phony.date.factor, 1, ">=")

[Package climdex.pcic version 1.1-11 Index]