Learn R Programming

futureheatwaves (version 1.0.3)

IDHeatwavesCPPwrapper: Identify heat waves in a time series

Description

This function identifies heat waves in a time series of temperature data using a heat wave definition that a heat wave must be a certain number of days with temperatures equal to or above some threshold temperature. This function uses a compiled C++ function for part of the process, making it faster than the R analogue, IDHeatwavesR, although the two functions give identical results.

Usage

IDHeatwavesCPPwrapper(datafr, threshold, numDays)

Arguments

datafr
A dataframe with daily temperature projections in the the city being processed. This dataframe must have two columns: (1) the first column must have the date of each observation, with class "Date" and; (2) the second column must have temperatures in degrees Fahrenheit. In the normal running of this package, this dataframe will be generated by the closure created by createCityProcessor.
threshold
Numeric string with threshold temperature used in the heat wave definition, in degrees Fahrenheit.
numDays
Integer greater than 0 giving the number of days to use in the extreme event definition (e.g., numDays = 2 would define a heat wave as two or more days above the threshold temperature).

Value

Returns the dataframe entered as datafr, but with new columns providing heat wave identifiers. The returned dataframe will have new columns for whether a day was part of a heat wave (hw, 0 / 1), and, if it was part of a heat wave, the number of the heat wave (hw.number).

Details

This function is the default function used to identify heat waves in gen_hw_set.

Examples

Run this code
data(datafr)
hw_ids <- IDHeatwavesCPPwrapper(threshold = 80, datafr = datafr,
                                numDays = 3)

Run the code above in your browser using DataLab