Ensemble writer factory function

Share:

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

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

Details

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

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.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.