speiGrid | R Documentation |
Returns SPI/SPEI grid using precipitation (and PET for SPEI) input grids
speiGrid(
pr.grid,
et0.grid = NULL,
scale = 3,
params = NULL,
return.coefficients = FALSE,
...
)
pr.grid |
Precipitation grid (monthly accumulated values, in mm) |
et0.grid |
Potential evapotranspiration grid (same units as |
scale |
Integer. Time scale at which the SPEI/SPI are computed. Default to 3 (months) |
params |
A multi-member grid with the distribution parameter coefficients for computing the spei.
Each member corresponds to a parameter. The time dimension length must be 12 (months of the year).
This grid is generated when the argument |
return.coefficients |
Logical (Default to FALSE). If TRUE, the function returns the parameter coefficients of the distribution that can be further used for computing the index, thus avoiding parameter fitting in subsequent applications of the function (See examples). |
... |
Further arguments passed to |
The function is a wrapper of function spei
from package SPEI adapted
to climate4R input grids
A climate4R grid with SPEI/SPI data
petGrid
, for PET calculation
# By default, et0.grid is null, and SPI is computed from precipitation:
data("pr.cru.iberia")
spi3 <- speiGrid(pr.grid = pr.cru.iberia, scale = 3, na.rm = TRUE)
## If PET is used, then SPEI is calculated
data("tas.cru.iberia")
et0.grid <- petGrid(tas = tas.cru.iberia, method = "thornthwaite")
spei3 <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3, na.rm = TRUE)
## Extract the parameter coefficients of the distribution fist and compute the index afterwards:
spei3.params <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3, return.coefficients = TRUE, na.rm = TRUE)
spei3 <- speiGrid(pr.cru.iberia, et0.grid = et0.grid, scale = 3, params = spei3.params, na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.