R/RcppExports.R

Defines functions rle_inverse rle_true rle_subset rle_std clim_calc_cpp HW_episodes HW_episode rollmean2 HW_2con

Documented in HW_2con HW_episode rle_inverse rle_std rle_subset rle_true

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' HW_2con
#'
#' @description This function is for the implement of HW_3con.
#' - At least k consecutive days > THR
#' - Average > THR
#'
#' @param data numeric vector
#' @param TRS numeric threshold
#'
#' @export
HW_2con <- function(data, THR, k) {
    .Call(`_heatwave_HW_2con`, data, THR, k)
}

#' @export
rollmean2 <- function(y) {
    .Call(`_heatwave_rollmean2`, y)
}

#' The begining and ending position of `HW con3` episode
#' @return `i_end`, the ending index of `rollmean(y) >= TRS_low`
#'
#' - if not statisfied 0 will be returned
#' - if statisfied, i_end will be returned
#' @examples
#' y = c(20, 24, 25, 27, 20, 19, 16, 15)
#' HW_episode(y, seq_along(y), 24, 20)
#' @export
HW_episode <- function(y, ibegin, iend, TRS_high, mink = 3L) {
    .Call(`_heatwave_HW_episode`, y, ibegin, iend, TRS_high, mink)
}

HW_episodes <- function(y, TRS_high, TRS_low, mink = 3L) {
    .Call(`_heatwave_HW_episodes`, y, TRS_high, TRS_low, mink)
}

clim_calc_cpp <- function(x, windowHalfWidth = 7L, pctile = 0.9) {
    .Call(`_heatwave_clim_calc_cpp`, x, windowHalfWidth, pctile)
}

#' @export
#' @rdname rle
rle_std <- function(x) {
    .Call(`_heatwave_rle_std`, x)
}

#' @export
#' @rdname rle
rle_subset <- function(rle, val, minL = 1L) {
    .Call(`_heatwave_rle_subset`, rle, val, minL)
}

#' @rdname rle
#' @export
rle_true <- function(x, minL = 1L) {
    .Call(`_heatwave_rle_true`, x, minL)
}

#' @export
#' @rdname rle
rle_inverse <- function(info, n = -1L) {
    .Call(`_heatwave_rle_inverse`, info, n)
}
CUG-hydro/heatwave documentation built on Dec. 17, 2021, 1:53 p.m.