Learn R Programming

envirem (version 2.3)

layerCreation: Creates all layers

Description

Generates all rasterLayers for one particular input dataset. For the distinction between this function and generateRasters, see Details.

Usage

layerCreation(
  masterstack,
  solradstack = NULL,
  var,
  tempScale = 1,
  precipScale = 1
)

Value

rasterStack

Arguments

masterstack

rasterStack containing all monthly precipitation, min temperature, max temperature, and optionally mean temperature rasters.

solradstack

rasterStack of monthly solar radiation, can be NULL if not needed.

var

vector of names of variables to generate, see Details.

tempScale

integer; scaling factor for the temperature data, see envirem for additional details.

precipScale

integer; scaling factor for the precipitation data, see envirem for additional details.

Author

Pascal Title

Details

The function verifyFileStructure should be used to verify that the appropriate rasters are present in masterstack.

This function is called internally by generateRasters.

The function layerCreation will generate envirem rasters from input R objects (rasterStacks) and will return the result as an R object. In contrast, the function generateRasters reads in input rasters from a specified directory, splits input rasters into tiles if necessary, internally calls layerCreation and writes the result to file.

Possible variables to generate include:

annualPET
aridityIndexThornthwaite
climaticMoistureIndex
continentality
embergerQ
growingDegDays0
growingDegDays5
maxTempColdest
minTempWarmest
meanTempColdest
meanTempWarmest
monthCountByTemp10
PETColdestQuarter
PETDriestQuarter
PETseasonality
PETWarmestQuarter
PETWettestQuarter
thermicityIndex

If var = 'all', then all of the variables will be generated.

See Also

This function is called internally by generateRasters.

Examples

Run this code
# \donttest{
# Find example rasters
rasterFiles <- list.files(system.file('extdata', package='envirem'), full.names=TRUE)

# create stack of temperature and precipitation rasters
# and stack of solar radiation rasters
solradFiles <- grep('solrad', rasterFiles, value=TRUE)
worldclim <- stack(setdiff(rasterFiles, solradFiles))
solar <- stack(solradFiles)

# set up naming scheme - only precip is different from default
assignNames(precip = 'prec_##')

# generate all possible envirem variables
layerCreation(worldclim, solar, var='all', tempScale = 10)

# set back to defaults
assignNames(reset = TRUE)
# }

Run the code above in your browser using DataLab