Learn R Programming

futureheatwaves (version 1.0.3)

createEnsembleWriter: Ensemble writer factory function

Description

This function creates a closure that writes a single heat wave list to a comma-separated file in the directory specified by the user in the out argument of gen_hw_set.

Usage

createEnsembleWriter(modelName, global, custom)

Arguments

modelName
Character string of climate model name (e.g., "bcc1"). This name is generated from the subdirectory name for the climate model within dataFolder.
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

A closure that inputs hwFrame, a combined heat wave dataframe with all heat wave information for all cities for the ensemble and writes out a heat wave dataframe to the output directory specified by the out argument in gen_hw_set.

Details

The closure created by this function closes over an incrementer variable for ensembles that advances each time the closure is called.