R Code for calculating Vapor Pressure Deficit (kPa) from temperature and relative humidity using equations from Allen et al. (1998)
Vapor Pressure Deficit (VPD) = Saturation Vapor Pressure (ES) – Actual Vapor Pressure (EA). Below is R code for estimating VPD using mean minimum and maximum monthly temperatures and mean monthly relative humidity according to Allen et al. (1998). I have used a VPD index for calculating the Growing Season Index of Jolly et al. (1995) for a variable in ecological niche modeling.
Allen, RG, Pereira, LS, Raes, D, Smith, M (1998) Meteorological data, Chapter 3. In: Crop evapotranspiration - Guidelines for computing crop water requirements. Food and Agricuture Organization (FAO) Irrigation and Drainage Paper 56. United Nations, FAO, Rome, Italy. Available from http://www.fao.org/docrep/x0490e/x0490e00.htm#Contents (Accessed 11 June 2014)
Jolly, WM, Nemani, R, Running, SW (2005) A generalized, bioclimatic index to predict foliar phenology in response to climate. Glob Chang Biol 11:619–632
Calculate Vapor Pressure Deficit (in KPa, Kilopaschals) in R according to equations of Allen et al. (1998) for Example 5 using mean monthly minimum (tmin) and maximum (tmax) temperatures (Celsius) and mean monthly pecent relative humidity (rh, 100 = 100%): [http://www.fao.org/docrep/x0490e/x0490e07.htm#chapter 3 meteorological data]
Declare in R values of three required environmental variables from Example 5 of Allen et al. (1998)
tmin <- 18
tmax <- 25
rh <- 68
Using rh = 68 as mean of 82% and 54% rh in example; so, final vpd value will not exactly match example
Calculate saturation vapor pressure for mean minimum monthly temperature (esmn)
get.esmn <- function(tmin){
esmn <- .6108 * exp((17.27 * tmin) / (tmin + 237.3))
return(esmn)
}
Calculate saturation vapor pressure for mean maximum monthly temperature (esmx)
get.esmx <- function(tmax){
esmx <- .6108 * exp((17.27 * tmax) / (tmax + 237.3))
return(esmx)
}
Calculate mean saturation vapor pressure (esm)
get.esm <- function(tmin, tmax){
esmn <- get.esmn(tmin)
esmx <- get.esmx(tmax)
esm <- (esmn + esmx)/2
return(esm)
}
Calculate actual vapor pressure (ea)
get.ea <- function(rh, tmin, tmax){
esm <- get.esm(tmin, tmax)
ea <- (rh/100) * esm
return(ea)
}
Calculate vapor pressure deficit (vpd = esm - ea; getting esm and ea functions)
get.vpd <- function(rh, tmin, tmax){
esm <- get.esm(tmin, tmax)
ea <- get.ea(rh, tmin, tmax)
vpd <- esm - ea
return(vpd)
}
Check variable values and results
esmn <- get.esmn(tmin)
esmx <- get.esmx(tmax)
esm <- get.esm(tmin, tmax)
ea <- get.ea(rh)
vpd <- get.vpd(rh, tmin, tmax)
Define temp (mean temperature), tmin and tmax for plotting relationship of esm and vpd
get.temp <- function(tmin, tmax){
temp <- (tmin + tmax)/2
return(temp)
}
tmin <- -40:20
tmax <- -20:40
Plot relationship of esm and vpd to mean temperature
plot(get.temp(tmin,tmax), get.esm(tmin, tmax), type = "l", xlab = "Temp (C)", ylab = "esm (black) or vpd (red) (kPa)")
lines(temp, get.vpd(50, tmin, tmax), col = "red")