Learn R Programming

envirem (version 2.3)

petExtremes: PET Extremes

Description

Calculates mean PET of the coldest, warmest, wettest and driest quarters.

Usage

petExtremes(PETstack, precipStack, meantempStack)

Value

rasterStack of PETColdestQuarter, PETWarmestQuarter, PETWettestQuarter, PETDriestQuarter in mm / month.

Arguments

PETstack

rasterStack of monthly PET, layer names assumed to end in month numbers

precipStack

rasterStack of monthly precipitation

meantempStack

rasterStack of monthly mean temperature

Author

Pascal Title

Details

Generates mean monthly PET for the warmest, coldest, wettest and driest 3 consecutive months.

References

Metzger, M.J., Bunce, R.G.H., Jongman, R.H.G., Sayre, R., Trabucco, A. & Zomer, R. (2013). A high-resolution bioclimate map of the world: a unifying framework for global biodiversity research and monitoring. Global Ecology and Biogeography, 22, 630-638.

See Also

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)
precip <- grep('prec', 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)
precip <- stack(env[[precip]])

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

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

petExtremes(pet, precip, meantemp)

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

Run the code above in your browser using DataLab