Learn R Programming

futureheatwaves (version 1.0.0)

check_params: Check for input parameter errors

Description

This function goes through all parameter inputs for gen_hw_set and makes sure all parameter entries are in the appropriate format. If any parameters are in an incorrect format, the function stops and returns an error describing the problem.

Usage

check_params(out, dataFolder, dataDirectories, citycsv, coordinateFilenames,
  tasFilenames, timeFilenames, IDheatwavesFunction, thresholdBoundaries,
  projectionBoundaries, referenceBoundaries, input_metric, numDays)

Arguments

out
Character string with pathway to directory to which heat wave files will be written. This should be a pathname to a directory on the user's local computer. If the directory already exists, it will be overwritten by this function, so the user should either
dataFolder
Character string with pathway to a directory with climate projection data. This directory must have a specific structure-- see the futureheatwaves vignette for guidance on setting up this directory.
dataDirectories
A list object, with two elements, one for each of the two subdirectories included in the main directory. Typically, these will be separate directories of historical and projection experiments from climate models. Each element of the list should be named w
citycsv
Character string giving the filepath to a comma-separated (.csv) file with, for each study city, a unique city identifier, latitude, and longitude. These values must be specified with the column names city, lat, and lon
coordinateFilenames
Character string the with filename of each grid point location file. This filename should be identical for all ensemble member subdirectories included in the dataFolder directory. See the package vignette for an example of the required struct
tasFilenames
Character string the with filename of each climate projection file. This filename should be identical for all ensemble member subdirectories included in the dataFolder directory. See the package vignette for an example of the required structu
timeFilenames
Character string the with filename of each projection dates file. This filename should be identical for all ensemble member subdirectories included in the dataFolder directory. See the package vignette for an example of the required structur
IDheatwavesFunction
A character string with the name of the R function to use to identify heat waves. This function may be a user-specified custom function, but it must be loaded into the current R session. The function name must be put in quotation marks. For more guidance
thresholdBoundaries
A numeric vector with the custom time boundaries to be used to determine the threshold temperatures for the heat wave definition. The required format for this vector is c(start year, end year), with the restriction that bounds must be contained within the
projectionBoundaries
A numeric vector with the custom time boundaries for which the user wants to create heat wave projections. The required format for this vector is c(start year, end year), with the restriction that bounds must be contained within the time boundaries of one
referenceBoundaries
A numeric vector with the custom time boundaries to use in calculating relative characteristics for heat waves (i.e., to use when exploring the role of adaptation in projections). For more information on how reference temperatures are used, see the packag
input_metric
A character string indicating the temperature metric of the climate projection data being processed. Choices are "kelvin", "fahrenheit", and "celsius".
numDays
Integer greater than 0 giving the number of days to use in the heat wave definition (e.g., numDays = 2 would define a heat wave as two or more days above the threshold temperature).

Value

  • Only stops and returns an error if any parameters are incorrect.