calc_d3_method: Calculate Day-3 Method

Description Usage Arguments Value Details Examples

View source: R/RcppExports.R

Description

Takes a numeric vector of daily snow changes, as well as a logical vector of possible indices to include in the Day-3 method, and returns the vector of the Day-3 method.

Usage

1
calc_d3_method(d3_cands, dx)

Arguments

d3_cands

A logical vector of indices associated with dx. d3_cands(i) is TRUE if and only if dx(i) and dx(i + 2) are positive.

dx

A numeric vector of daily snow changes.

Value

A numeric vector of the Day-3 method. See details.

Details

An observation of the Day-3 method consists of the sum of three consecutive elements of dx, the first and last of which must be positive, and the sum of the three observations must be positive. The d3_cands logical vector is TRUE when the first and third observations are positive. At the indices where d3_cands is TRUE, this function sums the dx(i), dx(i + 1), and dx(i + 2). If that sum is positive, it is added as a value of the Day-3 method. The function would then falsify d3_cands(i + 1) and d3_cands(i + 2) as an index of dx can be used in a sum only once.

Examples

1
2
3
4
dx <- c(1, -3, 3, 1, 2, 3, 1, -7, 2, -1, -2, 3)
d3_cands <- c(TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE,
 FALSE)
rdailychange:::calc_d3_method(d3_cands, dx)

Kinekenneth48/rdailychange documentation built on Dec. 18, 2021, 3:34 a.m.