Learn R Programming

futureheatwaves (version 1.0.3)

IDheatwaves: Identify all heat waves in a time series

Description

This function takes a dataframe with columns for date and projected temperature and adds columns identifying which days belong to a heat wave and giving separate numbers to identify each discrete heat wave.

Usage

IDheatwaves(threshold, datafr, global, custom)

Arguments

threshold
Numeric string with threshold temperature used in the heat wave definition, in degrees Fahrenheit.
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.
global
An list object created by gen_hw_set that includes user specifications (e.g., the path to the output directory, the path to the input climate projections, the dataframe with city locations).
custom
An list object created by gen_hw_set that includes user specifications (e.g., the name of the R function to use to identify heat waves, alternative upper and lower year boundaries for the data used to determine threshold temperatures for the heat wave definition, alternative upper and lower year boundaries for the projection period of the heat wave datasets being generated).

Value

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