Learn R Programming

envirem (version 2.3)

aridityIndexThornthwaite: aridityIndexThornthwaite

Description

Generates thornthwaite aridity index raster.

Usage

aridityIndexThornthwaite(precipStack, PETstack, precipScale = 1)

Value

RasterLayer, unitless

Arguments

precipStack

rasterStack of monthly precipitation.

PETstack

rasterStack of monthly potential evapotranspiration. Layer names are assumed to end in the month number.

precipScale

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

Author

Pascal Title

Details

Thornthwaite aridity index = 100d / n where d = sum of monthly differences between precipitation and PET for months where precip < PET where n = sum of monthly PET for those months

References

Thornthwaite, C.W. (1948). An approach toward a rational classification of climate. Geographical Review, 38, 55-94.

See Also

Requires rasters created with monthlyPET.

Examples

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

# identify the appropriate layers
meantemp <- grep('mean', names(env), value=TRUE)
solar <- grep('solrad', names(env), value=TRUE)
maxtemp <- grep('tmax', names(env), value=TRUE)
mintemp <- grep('tmin', names(env), value=TRUE)

# read them in as rasterStacks
meantemp <- stack(env[[meantemp]])
solar <- stack(env[[solar]])
maxtemp <- stack(env[[maxtemp]])
mintemp <- stack(env[[mintemp]])
tempRange <- abs(maxtemp - mintemp)

# get monthly PET
pet <- monthlyPET(meantemp, solar, tempRange)

precip <- grep('prec', names(env), value=TRUE)
precip <- stack(env[[precip]])

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

aridityIndexThornthwaite(precip, pet)

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

Run the code above in your browser using DataLab