aridityIndexThornthwaite: aridityIndexThornthwaite

View source: R/aridityIndexThornthwaite.R

aridityIndexThornthwaiteR Documentation

aridityIndexThornthwaite

Description

Generates thornthwaite aridity index raster.

Usage

aridityIndexThornthwaite(precipStack, PETstack, precipScale = 1)

Arguments

precipStack

SpatRaster of monthly precipitation.

PETstack

SpatRaster 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.

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

Value

RasterLayer, unitless

Author(s)

Pascal Title

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


# Find example rasters
rasterFiles <- list.files(system.file('extdata', package='envirem'), full.names=TRUE)
env <- rast(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 SpatRasters
meantemp <- env[[meantemp]]
solar <- env[[solar]]
maxtemp <- env[[maxtemp]]
mintemp <- env[[mintemp]]
tempRange <- abs(maxtemp - mintemp)

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

precip <- grep('prec', names(env), value=TRUE)
precip <- 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)



envirem documentation built on Aug. 26, 2023, 1:07 a.m.