IDHeatwavesCPPwrapper: Identify heat waves in a time series

Description Usage Arguments Details Value Note Examples

View source: R/IDHeatwaves.R


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.


IDHeatwavesCPPwrapper(datafr, threshold, numDays)



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.


Numeric string with threshold temperature used in the heat wave definition, in degrees Fahrenheit.


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).


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


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).


There are a few cases near the edges of data frames when this function would return that a day was not a heat wave when it was. First, if the first day of the dataset is a heat wave because preceeding days exceeded the threshold, but the second day in the dataframe is not above the threshold, this function would not capture that the first day was a heat wave. A similar caveat applies to the last day in the dataframe. In northern hemisphere studies, this should not be a concern, as it is unlikely that Jan. 1 or Dec. 31 would qualify as a heat wave. However, care should be taken when using this function either with Southern Hemisphere cities or when exploring exposures that, unlike heat waves, may occur very early or late in the calendar year.


hw_ids <- IDHeatwavesCPPwrapper(threshold = 80, datafr = datafr,
                                numDays = 3)

geanders/futureheatwaves documentation built on June 5, 2017, 9:05 a.m.