This R package computes water balance variables based on monthly temperature and precipitation. The five computed variables include total precipitation (PPT), potential evapotranspiration (PET), actual evapotranspiration (AET), climatic water deficit (CWD), and recharge and runoff (RAR).
The methods are based on those laid out by Hargreaves and Samani (1985), Shuttleworth (1993), and Wang et al. (2012).
You can install the package from GitHub like so:
devtools::install_github("matthewkling/hydro")
The main function, water_balance
, uses 48 monthly climate variables (precipitation and min, mean, and max temperature, x 12 months) and latitude to derive the five integrated hydologic variables mentioned above. Annual summaries are returned by default, but monthly values can be requested if desired.
The package also includes a function hydro
that operates on a raster stack of the input variables, returning a stack of the hydrological variables described above. Here's an example:
library(hydro)
library(raster)
library(tidyverse)
# download monthly wordlclim data
monthly <- c("prec", "tmean", "tmax", "tmin") %>%
map(function(x) getData("worldclim", var = x, res = 10)) %>%
stack() %>%
crop(extent(-125, -70, 20, 60))
# generate annual water balance variables
wb <- hydro(monthly, temp_scalar = 0.1, already_latlong = TRUE, annual = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.