View source: R/aridityIndexThornthwaite.R
aridityIndexThornthwaite | R Documentation |
Generates thornthwaite aridity index raster.
aridityIndexThornthwaite(precipStack, PETstack, precipScale = 1)
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. |
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
RasterLayer, unitless
Pascal Title
Thornthwaite, C.W. (1948). An approach toward a rational classification of climate. Geographical Review, 38, 55-94.
Requires rasters created with monthlyPET
.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.