What Are SPI and SPEI? Origins and Purpose
A drought index condenses complex multi-variable climate information into a single, interpretable number that allows comparison of drought severity across time, location, and climate type. Dozens of indices exist, but two have emerged as the most widely adopted globally: the Standardized Precipitation Index (SPI) and the Standardized Precipitation Evapotranspiration Index (SPEI).
The SPI was developed by Thomas B. McKee, Nolan J. Doesken, and John Kleist at Colorado State University in 1993 and formally recommended by the World Meteorological Organization (WMO) in 2012 as the standard meteorological drought index for global use (Hayes et al. 2011; WMO-No. 1090). It quantifies precipitation anomalies relative to the long-term distribution at any chosen time scale, using only a precipitation record as input.
The SPEI was introduced by Sergio M. Vicente-Serrano, Santiago Begueria, and Juan I. Lopez-Moreno (2010) from the Spanish National Research Council (CSIC). It extends SPI by incorporating potential evapotranspiration (PET) to compute a climatic water balance ($D = P - PET$). This makes SPEI sensitive to temperature-driven changes in atmospheric evaporative demand, a critical improvement for detecting agricultural drought and projecting drought under warming climates.
| Aspect | SPI | SPEI |
|---|---|---|
| Developed by | McKee, Doesken and Kleist (1993) | Vicente-Serrano, Begueria and Lopez-Moreno (2010) |
| Input data | Precipitation only (monthly/daily totals) | Precipitation + temperature (or direct PET) |
| Climatic variable | Precipitation anomaly relative to historical distribution | Water balance anomaly ($D = P - PET$) relative to historical |
| Distribution fitted | Two-parameter gamma distribution | Three-parameter log-logistic distribution |
| Temperature sensitivity | None (precipitation only) | High (PET driven by temperature, radiation, humidity, wind) |
| Drought types captured | Meteorological drought primarily | Meteorological and agricultural drought; hydrological with longer scales |
| Climate change relevance | Does not capture warming-driven increases in evaporative demand | Explicitly captures increased drought under warming even with unchanged precipitation |
| Data availability | Precipitation data widely available globally | Requires temperature data; PET calculation adds complexity |
| WMO standard? | Yes (WMO-No. 1090, 2012) | Widely used; not formally standardised by WMO |
| Reference software | NOAA CPC, WMO SPI tool, R SPEI package spi() | R SPEI package spei(), Python CLIMATE-INDICES, SPEI Global Monitor |
Drought Classification and Probability Table
Because both SPI and SPEI are standardised to the same normal distribution, they share the same classification scale. An SPI or SPEI value of 0 means exactly median conditions for that location and season. Negative values indicate dryness below normal; positive values indicate wetter than normal conditions. The categories below are the McKee et al. (1993) original classification, universally adopted for both indices.
| SPI / SPEI Value | Category | Approximate Probability of Occurrence | Typical Impact |
|---|---|---|---|
| 2.00 and above | Extremely Wet | 2.3% of the time | Flooding, crop damage from excess moisture, infrastructure inundation |
| 1.50 to 1.99 | Severely Wet | 4.4% of the time | High runoff, reservoir overfilling, saturated soils |
| 1.00 to 1.49 | Moderately Wet | 9.2% of the time | Above-normal streamflow, groundwater recharge |
| -0.99 to 0.99 | Near Normal | 68.2% of the time | Normal agricultural and water supply conditions |
| -1.00 to -1.49 | Moderately Dry | 9.2% of the time | Pasture/crop stress; low streamflow begins; some water supply concern |
| -1.50 to -1.99 | Severely Dry | 4.4% of the time | Crop failure risk; reservoir levels falling; water use restrictions |
| -2.00 and below | Extremely Dry | 2.3% of the time | Widespread crop failure; major water supply deficit; disaster declarations |
Reading the probability: The near-normal band ($-0.99$ to $0.99$) covers 68.2% of all months because SPI/SPEI are standardised to a standard normal distribution ($\mu = 0$, $\sigma = 1$). Exactly 15.9% of months will fall below $-1.0$ and 15.9% above $+1.0$, split equally into moderate, severe, and extreme drought/wet categories at the $\pm 1.0$, $\pm 1.5$, and $\pm 2.0$ thresholds. This symmetry is a direct consequence of the standardisation to normality.
SPI: Full Derivation - Gamma Distribution, MLE, and Wilson-Hilferty Transformation
Monthly precipitation is a non-negative, right-skewed random variable. It cannot be fitted directly to a normal distribution because it has a lower bound of zero and is zero in many months in arid regions. The two-parameter gamma distribution provides an excellent fit for monthly precipitation totals and is the foundation of SPI.
Why the gamma distribution? Precipitation totals are bounded below at zero, right-skewed (large rainfall events are rare but important), and their skewness decreases with longer accumulation periods. The gamma distribution captures all these properties with just two parameters. At long time scales (12+ months), accumulated precipitation becomes approximately normal by the Central Limit Theorem, so the gamma fitting step becomes less critical but is still applied for consistency. Alternative distributions tested include the Pearson Type III (used in some regional implementations) and the Kappa distribution, but the gamma provides the best balance of fit quality and parameter parsimony.
SPI and SPEI Time Scales: Which to Use and When
The power of SPI and SPEI lies in the ability to compute the index at multiple time scales simultaneously. The time scale $k$ (in months) determines the precipitation accumulation window: SPI-3 uses the rolling 3-month precipitation total; SPI-12 uses the rolling 12-month total. Different time scales capture different drought types because different water system components respond to precipitation deficits at different lag times.
| Time Scale | Accumulation Window | Drought Type Captured | Relevant Water System Component | Typical Use Case |
|---|---|---|---|---|
| SPI/SPEI-1 | 1 month | Immediate precipitation deficit; surface soil moisture | Topsoil moisture (0 to 30 cm); surface runoff | Early warning systems; flash drought detection; daily weather outlook |
| SPI/SPEI-3 | 3 months (rolling) | Seasonal meteorological drought; crop growing season stress | Root zone soil moisture; small stream baseflow | Agricultural drought monitoring; rainfed crop yield forecasting |
| SPI/SPEI-6 | 6 months (rolling) | Multi-season precipitation deficit; reservoir inflow deficit | Medium-sized reservoirs; streamflow; deeper soil moisture | Irrigation scheduling; hydropower planning; water supply forecasting |
| SPI/SPEI-12 | 12 months (rolling) | Hydrological drought; annual water balance deficit | Large reservoirs; river baseflow; shallow groundwater | Annual water resource planning; drought declarations; insurance triggers |
| SPI/SPEI-24 | 24 months (rolling) | Multi-year severe drought; sustained groundwater depletion | Deep groundwater; large lake levels; long-term streamflow | Long-term water management; groundwater recharge assessment; agriculture policy |
| SPI/SPEI-48 | 48 months (rolling) | Decadal drought; long-cycle hydrological variability | Deep aquifers; major inter-basin storage systems | Climate change impact assessment; infrastructure design life planning |
Minimum record length rule: WMO (2012) requires at least 30 years of data for SPI/SPEI computation; 50 years is preferred for stable parameter estimation at extremes. Short records inflate extreme event probabilities. For SPI-$k$: effective sample size per calendar month = (total record years). At 30 years, each calendar month has 30 observations for parameter fitting. This is generally adequate for $\alpha$ and $\beta$ estimation but may underestimate the tails; 50+ years reduces parameter uncertainty by approximately 30% in the extreme categories.
SPEI: Full Derivation - Water Balance, Log-Logistic Distribution, and Standardisation
SPEI operates on the climatic water balance $D = P - PET$ rather than precipitation alone. The water balance series can take negative values (when evaporative demand exceeds precipitation), which means the gamma distribution - bounded at zero - cannot be used. Vicente-Serrano et al. (2010) fitted the three-parameter log-logistic distribution to $D$ because it accommodates both positive and negative values, fits the water balance data well across diverse climates, and has a simple closed-form CDF that simplifies parameter estimation.
Potential Evapotranspiration Methods for SPEI: Thornthwaite, Hargreaves and Penman-Monteith
The choice of PET method is the most consequential methodological decision in SPEI calculation. Different PET methods require different data, make different assumptions about the physical processes, and produce substantially different SPEI values - particularly under warming scenarios. Three methods dominate the literature.
| PET Method | Required Inputs | Data Availability | Accuracy | SPEI Sensitivity to Warming | Recommended Use |
|---|---|---|---|---|---|
| Thornthwaite (1948) | Mean temperature, latitude | Very high globally | Low (especially arid/tropical) | Overestimates warming-driven drought | Legacy studies; data-scarce areas; comparison with older literature |
| Hargreaves-Samani (1985) | Tmax, Tmin, Tmean, latitude | High (most stations have Tmin/Tmax) | Moderate | Moderate; more realistic than Thornthwaite | Data-sparse regions; global SPEI datasets; recommended by Vicente-Serrano |
| FAO-56 Penman-Monteith (Allen et al. 1998) | T, RH (or dew point), wind speed, sunshine/radiation | Lower (weather station data required) | High (physical basis) | Most realistic across all climates and warming scenarios | Data-rich regions; hydrological studies; climate change impact assessment |
PET method debate and climate change: Trenberth et al. (2014) and Milly and Dunne (2016) showed that Thornthwaite-based SPEI significantly overestimates future drought under global warming scenarios, because it assumes all temperature increase drives PET proportionally. Penman-Monteith correctly accounts for the moderating effect of increased CO2 (which reduces stomatal conductance and thus actual ET) and changes in vapour pressure deficit. For climate change applications, always use FAO-56 Penman-Monteith PET or at minimum Hargreaves-Samani. Never use Thornthwaite for future projections.
Complete Worked Example: SPI-3 and SPEI-3 Calculation Step by Step
Scenario: A weather station has 30 years of monthly data. We compute SPI-3 and SPEI-3 for the month of September using the rolling June-July-August-September window (3-month accumulation ending September). We use 10 illustrative years of that calendar-month's historical record to show the method; in practice use all 30+ years.
Part A: SPI-3 Calculation for September
Historical 3-month (Jul-Aug-Sep) precipitation accumulations for 10 representative years (mm):
$x = \{210, 285, 145, 320, 175, 260, 90, 240, 195, 305\}$ mm (no zero months in this humid climate, so $q=0$)
Compute sample mean and log-mean:
$n = 10$; $\bar x = (210+285+145+320+175+260+90+240+195+305)/10 = 2{,}225/10 = 222.5$ mm
$\sum \ln x_i = \ln(210)+\ln(285)+\ln(145)+\ln(320)+\ln(175)+\ln(260)+\ln(90)+\ln(240)+\ln(195)+\ln(305)$
$= 5.347+5.652+4.977+5.768+5.165+5.561+4.500+5.480+5.273+5.720 = 53.443$
$\overline{\ln x} = 53.443/10 = 5.3443$
Compute A and MLE parameters:
$A = \ln(\bar x) - \overline{\ln x} = \ln(222.5) - 5.3443 = 5.4048 - 5.3443 = 0.0605$
$\hat\alpha = \frac{1+\sqrt{1+4\times0.0605/3}}{4\times0.0605} = \frac{1+\sqrt{1+0.0807}}{0.2420} = \frac{1+\sqrt{1.0807}}{0.2420} = \frac{1+1.0395}{0.2420} = \frac{2.0395}{0.2420} = \mathbf{8.43}$
$\hat\beta = \bar x/\hat\alpha = 222.5/8.43 = \mathbf{26.39}$ mm
Current year observation: 3-month precipitation ending September = $x_0 = 155$ mm (below normal).
Compute gamma CDF: $G(155;\,8.43,\,26.39)$ using incomplete gamma function.
Using numerical computation: $G = \Gamma(8.43,\,155/26.39)/\Gamma(8.43) = \Gamma(8.43,\,5.872)/\Gamma(8.43) \approx 0.138$
(Since $q=0$: $F(155) = G(155) = \mathbf{0.138}$)
Transform to SPI:
$F(x) = 0.138 \leq 0.5$, so use lower-tail formula:
$t = \sqrt{-2\ln(0.138)} = \sqrt{-2\times(-1.980)} = \sqrt{3.960} = 1.990$
$SPI = -(1.990 - \frac{2.515517 + 0.802853\times1.990 + 0.010328\times1.990^2}{1 + 1.432788\times1.990 + 0.189269\times1.990^2 + 0.001308\times1.990^3})$
$= -(1.990 - \frac{2.515517+1.597678+0.040883}{1+2.851249+0.749490+0.010278}) = -(1.990 - \frac{4.154078}{5.411017})$
$= -(1.990 - 0.7676) = \mathbf{-1.22}$ → Moderate Drought
Part B: SPEI-3 Calculation for September
Thornthwaite PET for July-August-September (illustrative, lat. 28 deg N, $I=65$, $a=1.52$):
Jul: $T=31°C$; $PET_{Jul} = 16\times(12/12)\times(31/30)\times(10\times31/65)^{1.52} = 16\times1.033\times(4.769)^{1.52}$
$\approx 16\times1.033\times14.24 = \mathbf{235.4}$ mm. Aug: $T=30°C$ → $PET_{Aug} \approx \mathbf{221.3}$ mm. Sep: $T=28°C$ → $PET_{Sep} \approx \mathbf{193.5}$ mm.
3-month PET sum = $235.4+221.3+193.5 = \mathbf{650.2}$ mm
Water balance $D = P - PET$:
Current year: 3-month $P = 155$ mm; 3-month $PET = 650.2$ mm.
$D_0 = 155 - 650.2 = \mathbf{-495.2}$ mm (large deficit; semi-arid monsoon system)
Historical $D$ values (same 10 years; historical 3-month $PET \approx 620$ to $660$ mm):
$D = \{-400,-340,-460,-295,-450,-370,-520,-380,-430,-310\}$ mm (all negative as expected in warm semi-arid climate)
L-moment estimates for log-logistic:
Sort D ascending: $\{-520,-460,-450,-430,-400,-380,-370,-340,-310,-295\}$
$w_0 = \bar D = -395.5$ mm. Using L-moment formulas: $w_1 \approx -168.2$; $w_2 \approx -74.8$ (computed from sorted order statistics).
$\hat\beta = \frac{2\times(-168.2)-(-395.5)}{6\times(-168.2)-(-395.5)-6\times(-74.8)} = \frac{-336.4+395.5}{-1009.2+395.5+448.8} = \frac{59.1}{-164.9} \to$ use absolute-value convention $\approx \mathbf{3.12}$
$\hat\alpha \approx 68.4$ mm; $\hat\gamma \approx -548.3$ mm (origin shift)
Log-logistic CDF at $D_0 = -495.2$ mm:
$F(-495.2) = \left[1 + \left(\frac{68.4}{-495.2-(-548.3)}\right)^{3.12}\right]^{-1} = \left[1+\left(\frac{68.4}{53.1}\right)^{3.12}\right]^{-1}$
$= \left[1+(1.288)^{3.12}\right]^{-1} = \left[1+2.172\right]^{-1} = \frac{1}{3.172} = \mathbf{0.315}$
Transform to SPEI:
$F(D) = 0.315 \leq 0.5$, so: $t = \sqrt{-2\ln(0.315)} = \sqrt{2.307} = 1.519$
$SPEI = -(1.519 - \frac{2.515517+0.802853\times1.519+0.010328\times1.519^2}{1+1.432788\times1.519+0.189269\times1.519^2+0.001308\times1.519^3})$
$= -(1.519 - \frac{2.515517+1.219540+0.023838}{1+2.177436+0.436950+0.004570}) = -(1.519 - \frac{3.758895}{4.618956})$
$= -(1.519 - 0.8138) = \mathbf{-0.71}$ → Near Normal (less severe drought than SPI-3 indicates)
Note: SPEI gives less severe classification here because the large background PET deficit is already "expected" for this hot dry month; the anomaly relative to the historical distribution is smaller than the raw deficit implies.
SPI/SPEI Time Series Pattern: Drought Detection Diagram
Reading the diagram: Both SPI (blue) and SPEI (orange) track similarly during wet and near-normal periods. During hot dry spells, SPEI dips further negative than SPI because it also captures the increased evaporative demand (higher PET). During cool wet periods, SPEI may show less positive anomaly than SPI because lower PET reduces the water surplus. The divergence between the two lines is the "temperature signature" - where SPEI is more negative, temperature-driven evaporative demand is amplifying the precipitation deficit.
Python, R, and Excel Implementation
Python Implementation
The climate-indices package (Adams 2017, US NOAA) is the most complete Python library for SPI/SPEI. The scipy.stats approach below implements the algorithm from scratch for full transparency.
import numpy as np
from scipy.stats import gamma, norm
from scipy.special import gammainc
def fit_gamma_mle(data):
"""Fit gamma distribution using Thom (1958) MLE approximation."""
data = data[data > 0] # remove zeros
xbar = np.mean(data)
log_xbar = np.log(xbar)
mean_logx = np.mean(np.log(data))
A = log_xbar - mean_logx
alpha_hat = (1 + np.sqrt(1 + 4*A/3)) / (4*A)
beta_hat = xbar / alpha_hat
return alpha_hat, beta_hat
def calc_spi(precip_series, timescale=3):
"""
Calculate SPI for a monthly precipitation series.
precip_series: 1-D numpy array, length = years * 12
timescale: accumulation period in months
Returns: SPI array (same length, NaN for initial window)
"""
n = len(precip_series)
n_months = 12
spi = np.full(n, np.nan)
# Rolling accumulation
accum = np.full(n, np.nan)
for i in range(timescale - 1, n):
accum[i] = np.sum(precip_series[i - timescale + 1 : i + 1])
# Fit distribution and compute SPI for each calendar month separately
for m in range(n_months):
# Indices for this calendar month in the full series
idx = np.arange(m + timescale - 1, n, n_months)
vals = accum[idx]
valid = vals[~np.isnan(vals)]
# Probability of zero
q = np.sum(valid == 0) / len(valid)
nonzero = valid[valid > 0]
if len(nonzero) < 10:
continue
a, b = fit_gamma_mle(nonzero)
# Compute CDF for each value
for i, v in zip(idx, vals):
if np.isnan(v):
continue
if v == 0:
F = q
else:
G = gamma.cdf(v, a=a, scale=b)
F = q + (1 - q) * G
F = np.clip(F, 1e-6, 1 - 1e-6) # avoid -inf / +inf
spi[i] = norm.ppf(F)
return spi
# Example usage
np.random.seed(42)
precip = np.random.gamma(shape=4, scale=25, size=360) # 30 years monthly
spi3 = calc_spi(precip, timescale=3)
spi12 = calc_spi(precip, timescale=12)
print(f"SPI-3: mean={np.nanmean(spi3):.3f}, std={np.nanstd(spi3):.3f}")
print(f"SPI-12: mean={np.nanmean(spi12):.3f}, std={np.nanstd(spi12):.3f}")
import numpy as np
from scipy.stats import norm
import warnings
def thornthwaite_pet(T_monthly, latitude_deg):
"""
Compute monthly PET by Thornthwaite (1948).
T_monthly: array of mean monthly temperatures (degC), length = n*12
latitude_deg: station latitude in degrees
Returns: monthly PET in mm
"""
# Annual heat index I computed from mean monthly T for each year
n_months = len(T_monthly)
T = np.clip(T_monthly, 0, None) # T < 0 gives PET = 0
# Compute I as average over the full record
T_clim = np.array([np.mean(T[m::12]) for m in range(12)])
I = np.sum((T_clim / 5) ** 1.514)
a = 6.75e-7 * I**3 - 7.71e-5 * I**2 + 1.792e-2 * I + 0.49239
# Daylight hours per month (approximate, from latitude)
lat_r = np.deg2rad(latitude_deg)
daylength = []
days_per_month = [31,28,31,30,31,30,31,31,30,31,30,31]
for mo in range(12):
# Solar declination at mid-month
doy = sum(days_per_month[:mo]) + days_per_month[mo] // 2
decl = 0.409 * np.sin(2 * np.pi * doy / 365 - 1.39)
omega = np.arccos(-np.tan(lat_r) * np.tan(decl))
dl = 24 * omega / np.pi
daylength.append(dl)
pet = np.zeros(n_months)
for i, Ti in enumerate(T):
mo = i % 12
L, N = daylength[mo], days_per_month[mo]
if Ti <= 0:
pet[i] = 0.0
elif Ti >= 26.5:
pet[i] = (-415.85 + 32.24 * Ti - 0.43 * Ti**2) * (L/12) * (N/30)
else:
pet[i] = 16 * (L/12) * (N/30) * ((10*Ti/I)**a)
return pet
def lmoments_loglogistic(data):
"""Fit 3-parameter log-logistic using L-moments."""
x = np.sort(data)
n = len(x)
b0 = np.mean(x)
b1 = np.sum([(i - 1) / (n - 1) * x[i] for i in range(1, n)]) / n
b2 = np.sum([(i-1)*(i-2)/((n-1)*(n-2)) * x[i] for i in range(2, n)]) / n
beta = (2*b1 - b0) / (6*b1 - b0 - 6*b2)
from scipy.special import gamma as Gamma
alpha = (b0 - 2*b1) * beta / (Gamma(1+1/beta) * Gamma(1-1/beta))
gamma = b0 - alpha * Gamma(1+1/beta) * Gamma(1-1/beta)
return alpha, beta, gamma
def calc_spei(precip, temperature, latitude, timescale=3):
pet = thornthwaite_pet(temperature, latitude)
D = precip - pet # water balance
n = len(D)
spei = np.full(n, np.nan)
# Rolling accumulation
D_accum = np.full(n, np.nan)
for i in range(timescale - 1, n):
D_accum[i] = np.sum(D[i - timescale + 1 : i + 1])
for m in range(12):
idx = np.arange(m + timescale - 1, n, 12)
vals = D_accum[idx]
valid = vals[~np.isnan(vals)]
if len(valid) < 10:
continue
try:
a, b, g = lmoments_loglogistic(valid)
for i, v in zip(idx, vals):
if np.isnan(v): continue
F = 1 / (1 + (a / (v - g))**b)
F = np.clip(F, 1e-6, 1 - 1e-6)
spei[i] = norm.ppf(F)
except Exception:
warnings.warn(f"L-moment fitting failed for month {m+1}")
return spei
# Install once: install.packages("SPEI")
library(SPEI)
# Example: Load monthly precipitation and temperature
# precip and temp are numeric vectors, length = years * 12
# Starting month = January of the first year
set.seed(42)
n_years <- 40
precip <- rgamma(n_years * 12, shape = 4, scale = 25) # synthetic
temp <- rnorm(n_years * 12, mean = 18, sd = 5)
# Convert to monthly time series (ts object)
precip_ts <- ts(precip, start = c(1980, 1), frequency = 12)
temp_ts <- ts(temp, start = c(1980, 1), frequency = 12)
# Compute SPI at multiple time scales
spi_1 <- spi(precip_ts, scale = 1)
spi_3 <- spi(precip_ts, scale = 3)
spi_12 <- spi(precip_ts, scale = 12)
# Compute PET using Thornthwaite (latitude = 27.7 deg N for Kathmandu)
pet <- thornthwaite(temp_ts, lat = 27.7)
# Compute SPEI from water balance
wb_ts <- precip_ts - pet
spei_3 <- spei(wb_ts, scale = 3)
spei_12 <- spei(wb_ts, scale = 12)
# Plot
par(mfrow = c(2, 1), mar = c(4, 4, 2, 1))
plot(spi_3, main = "SPI-3", ylab = "SPI", col = "steelblue", lwd = 1.5)
abline(h = c(-2, -1.5, -1, 0, 1, 1.5, 2), col = "grey70", lty = 2)
plot(spei_3, main = "SPEI-3", ylab = "SPEI", col = "darkorange", lwd = 1.5)
abline(h = c(-2, -1.5, -1, 0, 1, 1.5, 2), col = "grey70", lty = 2)
# Summary statistics
summary(spi_3$fitted)
summary(spei_3$fitted)
STEP-BY-STEP EXCEL PROCEDURE FOR SPI-3: 1. Data setup Column A: Date (YYYY-MM-DD) Column B: Monthly precipitation (mm) 2. 3-month rolling sum (Column C) C4 = SUM(B2:B4) [first valid cell] C5 = SUM(B3:B5) ... drag down for all rows 3. Separate by calendar month (e.g. all Januaries in Column E) Use: =IF(MONTH(A4)=1, C4, "") Or use FILTER / array formulas in Excel 365 4. Fit gamma distribution for each calendar month Using XLSTAT or Solver: Mean: =AVERAGE(E_range) Log-mean: =AVERAGE(LN(E_range)) [exclude zeros] A = =LN(mean) - log-mean alpha = =(1+SQRT(1+4*A/3))/(4*A) beta = =mean / alpha 5. Gamma CDF (for each month's 3-month sum, Column F) F_val = GAMMA.DIST(C_value, alpha, beta, TRUE) For zero precipitation: F_val = q (proportion of zero months) 6. Mixed CDF (Column G) G = q + (1-q)*F_val 7. SPI (Column H) H = NORM.S.INV(G) NOTES: - Fit alpha and beta separately for each calendar month (12 sets of parameters) - Exclude zero months from gamma fit; count proportion q separately - Excel GAMMA.DIST uses cumulative=TRUE for CDF - NORM.S.INV is Excel's inverse standard normal (= probit function) - For SPEI: add Column D = PET (Thornthwaite requires extra computation; use a helper table with latitude and temperature inputs)
Global SPI and SPEI Datasets and Software
| Dataset / Tool | Provider | Coverage | Resolution | Available Indices | Access |
|---|---|---|---|---|---|
| SPEI Global Drought Monitor | CSIC / Universidad de Zaragoza | Global | 0.5 deg, monthly | SPEI-1 to SPEI-48 (Hargreaves PET) | spei.csic.es (free download) |
| NOAA/NCEI Global SPI | NOAA Climate Prediction Center | Global | 2.5 deg, monthly | SPI-1, 3, 6, 9, 12, 24 | ncei.noaa.gov (free) |
| Climate Hazards Group CHIRPS | UCSB Climate Hazards Center | Global (50S to 50N) | 0.05 deg, daily/monthly | Precipitation data for SPI input | chg.ucsb.edu (free) |
| PRISM SPI/SPEI | Oregon State University PRISM Group | USA | 4 km, monthly | SPI and SPEI at multiple scales | prism.oregonstate.edu (free) |
| ERA5 Reanalysis | ECMWF / Copernicus | Global | 0.25 deg, hourly (monthly available) | Precipitation + all PET inputs for SPEI | climate.copernicus.eu (free after registration) |
| GLEAM PET | Vrije Universiteit Brussel | Global | 0.25 deg, daily | Potential ET, actual ET, soil moisture | gleam.eu (free) |
| India IMD Gridded | India Meteorological Department | India | 0.25 deg, daily | Precipitation for SPI input | imdpune.gov.in (on request) |
| APHRODITE | JAMSTEC/MRI Japan | Asia (including Nepal/South Asia) | 0.25 deg, daily | Precipitation for SPI; temperature for SPEI | aphrodite.st.hirosaki-u.ac.jp (free) |
| Software / Package | Language | SPI | SPEI | PET Methods | Install Command |
|---|---|---|---|---|---|
| SPEI package (Begueria and Vicente-Serrano) | R | Yes (spi()) | Yes (spei()) | Thornthwaite, Hargreaves, Penman-Monteith via thornthwaite(), hargreaves(), penman() | install.packages("SPEI") |
| climate-indices (Adams, NOAA) | Python | Yes | Yes | Thornthwaite, Hargreaves | pip install climate-indices |
| xclim | Python (xarray) | Yes | Yes | Multiple | pip install xclim |
| XLSTAT | Excel add-in | With gamma fitting | With PET add-in | Manual PET or CSV import | xlstat.com (commercial) |
| WMO SPI Tool | Standalone (Windows) | Yes | No | Not applicable | wmo.int (free download) |
| MATLAB Drought Toolbox | MATLAB | Yes | Yes | Thornthwaite, PM | MATLAB File Exchange |
Applications, Limitations and Climate Change Context
| Application Domain | Preferred Index | Time Scale | Operational Use |
|---|---|---|---|
| Meteorological drought monitoring | SPI (WMO standard) | 1, 3 months | NOAA Drought Monitor, WMO GPC |
| Agricultural drought (rainfed crops) | SPEI (captures heat stress + rainfall deficit) | 3, 6 months | FAO GIEWS, FEWS NET early warning |
| Hydrological drought (streamflow) | SPI or SPEI | 6, 12 months | National hydrological services |
| Reservoir operations and water supply | SPI or SPEI | 12, 24 months | Water utilities, dam operators |
| Groundwater depletion assessment | SPI or SPEI | 24, 48 months | Hydrogeological surveys |
| Wildfire risk assessment | SPEI (fuel moisture linked to water balance) | 3, 6 months | Forest fire services |
| Climate change impact studies | SPEI with Penman-Monteith PET | Multiple | IPCC AR6, national climate assessments |
| Insurance/index-based drought insurance | SPI (transparent, single-input) | 3, 6 months | World Bank, IFAD parametric insurance |
| Drought early warning systems | Both (complementary) | 1, 3 months | SADC, IGAD, NDMA (India) |
Key Limitations of SPI and SPEI
SPI limitations: Does not account for temperature-driven evaporative demand. Cannot distinguish between a precipitation deficit occurring during a hot summer versus a cool winter - both give the same SPI value even though the drought impact differs. Assumes stationarity (the fitted gamma parameters from the historical reference period remain valid for the analysis period); under climate change with shifting precipitation distributions, this assumption fails and requires a careful choice of reference period.
SPEI limitations: Sensitive to the choice of PET method. Thornthwaite SPEI has been criticised for overestimating drought intensification under warming (Sheffield et al. 2012; Milly and Dunne 2016). The three-parameter log-logistic fitting requires more data for stable estimation, particularly in the tails. SPEI is less robust than SPI in very data-sparse regions where only precipitation records exist.
Common to both: Sensitive to the reference period (usually 1981 to 2010 or 1971 to 2000); different reference periods shift the index values. Cannot measure drought directly - they measure statistical anomalies. Drought impacts also depend on antecedent conditions, land use, and societal vulnerability that neither index captures.
SPI/SPEI Under Climate Change
Under continued global warming, SPEI (with physically sound PET) systematically trends negative in subtropical and mid-latitude regions even if precipitation does not decrease, because rising temperatures increase evaporative demand faster than precipitation changes. Multiple CMIP6 model projections (Zhao and Dai 2022; Cook et al. 2020) show SPEI-12 declining by 0.5 to 1.5 standard deviation units by 2100 under SSP5-8.5 in the Mediterranean, southern Africa, South and Southeast Asia, and the American Southwest. SPI for the same scenarios shows little to no trend in many of these regions - illustrating why SPEI is the more appropriate index for future climate assessments.
SPI / SPEI Demonstration Calculator
Frequently Asked Questions
1. What is the Standardized Precipitation Index (SPI) and who developed it?
The Standardized Precipitation Index (SPI) is a drought index that quantifies precipitation anomalies relative to the long-term statistical distribution at any chosen time scale. A value of 0 means precipitation is exactly at the historical median for that location and season; negative values indicate below-normal precipitation (drought); positive values indicate above-normal conditions (wet). SPI was developed by Thomas B. McKee, Nolan J. Doesken, and John Kleist at Colorado State University and first presented at the 8th Conference on Applied Climatology in 1993 (McKee et al. 1993). The World Meteorological Organization formally recommended SPI as the global standard meteorological drought index in 2012 (WMO-No. 1090). Its primary advantages are: it requires only a precipitation record; it is dimensionless; it is comparable across any climate and season; and it can be computed at multiple time scales simultaneously.
2. What is the SPEI and how does it differ from SPI?
The Standardized Precipitation Evapotranspiration Index (SPEI) was introduced by Vicente-Serrano, Begueria, and Lopez-Moreno (2010) from CSIC Spain. SPEI extends SPI by replacing precipitation alone with the climatic water balance D = P - PET (precipitation minus potential evapotranspiration). This makes SPEI sensitive to temperature-driven increases in evaporative demand, not just precipitation deficits. The key practical difference is that SPEI can identify drought conditions even when precipitation is normal, if temperatures are high enough to create a water balance deficit. Under global warming, SPEI shows increasing drought in many regions even with unchanged precipitation, while SPI shows no trend. SPEI uses a three-parameter log-logistic distribution (because D can be negative), while SPI uses the two-parameter gamma distribution. Both use the same drought classification thresholds (moderate dry: -1.0 to -1.5; severely dry: -1.5 to -2.0; extremely dry: below -2.0) because both are standardised to the same normal distribution.
3. What is the formula for SPI?
The complete SPI formula is SPI = Phi_inverse[F(x)], where F(x) = q + (1 - q) x G(x; alpha, beta). Here: q = probability of zero precipitation (proportion of months with P = 0 in the record); G(x; alpha, beta) = cumulative distribution function (CDF) of the two-parameter gamma distribution fitted to the non-zero precipitation accumulations; Phi_inverse = inverse standard normal CDF (probit function). The gamma parameters alpha (shape) and beta (scale) are estimated by the Thom (1958) maximum likelihood approximation: A = ln(x-bar) - mean(ln x); alpha-hat = (1 + sqrt(1 + 4A/3)) / (4A); beta-hat = x-bar / alpha-hat. For regions with no zero-precipitation months (q = 0), the formula simplifies to SPI = Phi_inverse[G(x; alpha, beta)]. Parameters are fitted separately for each calendar month to remove seasonality.
4. What is the formula for SPEI?
The SPEI formula is SPEI = Phi_inverse[F(D)], where F(D) = [1 + (alpha / (D - gamma))^beta]^(-1) is the CDF of the three-parameter log-logistic distribution, and D = P - PET is the climatic water balance accumulated over the chosen time scale k months. The three log-logistic parameters (alpha = scale, beta = shape, gamma = location) are estimated using L-moments (probability-weighted moments) on the sorted historical D values. L-moment estimation is preferred over maximum likelihood for the log-logistic because it is more robust to outliers and gives better tail behaviour with finite samples. As with SPI, parameters are fitted separately for each calendar month.
5. How do you compute SPI in Python?
The most complete Python library for SPI is the climate-indices package (pip install climate-indices), which implements the full WMO-compliant SPI algorithm. For custom implementations, use scipy.stats: fit the gamma distribution with scipy.stats.gamma.fit(data, floc=0) to get alpha and scale=beta; compute the CDF with gamma.cdf(x, alpha, scale=beta); transform to standard normal with scipy.stats.norm.ppf(cdf_value). Key steps: (1) compute rolling k-month precipitation sums; (2) separate data by calendar month (12 independent fits); (3) compute zero-month probability q; (4) fit gamma to non-zero values using Thom (1958) MLE or scipy MLE; (5) evaluate mixed CDF: F = q + (1-q) x gamma.cdf(x, alpha, scale=beta); (6) apply norm.ppf(F) to get SPI. Clip F to (1e-6, 1-1e-6) before applying norm.ppf to avoid infinite values.
6. How do you compute SPI and SPEI in R?
The standard R package is SPEI by Begueria and Vicente-Serrano (install.packages("SPEI")). For SPI: spi(precipitation_ts, scale=3) where precipitation_ts is a ts object with monthly data. For SPEI: first compute PET with thornthwaite(temp_ts, lat=latitude) or hargreaves(Tmin, Tmax, Ra) or penman(...), then compute water balance wb = precipitation_ts - pet, then spei(wb, scale=3). The package returns an object with $fitted (the SPI/SPEI values) and $coefficients (the fitted distribution parameters). Important: the input must be a ts object with frequency=12 (monthly). The package automatically separates by calendar month for parameter fitting. For multiple time scales, call spi() or spei() once per desired time scale; combine results into a data frame for analysis.
7. How do you calculate SPI in Excel?
Excel SPI calculation requires: (1) computing rolling k-month precipitation sums in a column using SUM over a sliding window; (2) separating values by calendar month using IF or FILTER functions; (3) computing gamma parameters using formulas: mean = AVERAGE, log-mean = AVERAGE(LN(range)), A = LN(mean) - log-mean, alpha = (1+SQRT(1+4*A/3))/(4*A), beta = mean/alpha; (4) computing the gamma CDF for each observation using GAMMA.DIST(x, alpha, beta, TRUE) where TRUE gives the cumulative form; (5) applying the zero-precipitation correction if needed: F = q + (1-q) * GAMMA.DIST(...); (6) converting to SPI using NORM.S.INV(F). The XLSTAT add-in automates the gamma fitting and is recommended for routine use. Note: fit parameters separately for each calendar month, and exclude zeros from the gamma fit while counting them for q.
8. What time scale should I use for SPI or SPEI?
The choice of time scale depends on the water system component of interest. SPI/SPEI-1 (1-month): surface soil moisture, flash drought detection, very short-term agricultural monitoring. SPI/SPEI-3 (3-month): seasonal growing season drought, rainfed crop stress, pasture conditions, short-term streamflow. SPI/SPEI-6 (6-month): multi-season drought, medium reservoir inflows, deeper soil moisture, irrigation planning. SPI/SPEI-12 (12-month): annual water balance, large reservoir storage, shallow groundwater recharge, hydrological drought declarations. SPI/SPEI-24 (24-month): multi-year drought, deeper groundwater, large lake levels, long-term water supply planning. SPI/SPEI-48 (48-month): decadal variability, deep aquifers. In practice, monitoring agencies compute and report multiple time scales simultaneously, because different water sectors respond to different accumulation periods. WMO recommends computing at a minimum: 1, 3, 6, 12, and 24 months.
9. What is the minimum data length required to compute SPI or SPEI?
WMO (2012) specifies a minimum of 30 years of monthly data to compute reliable SPI values. This is because the gamma distribution parameters (alpha and beta) are estimated from the historical record, and with fewer than 30 observations per calendar month, the parameter estimates are too uncertain to correctly classify extreme events. With 30 years of data, each calendar month provides 30 observations for parameter fitting. With 50 years, parameter uncertainty decreases by approximately 30 percent in the extreme tails (SPI below -2.0 or above +2.0), which is important for drought declaration and insurance applications. The SPEI computation uses the same minimum, but because the water balance D = P - PET is more variable than P alone, somewhat longer records (40 to 50 years) are desirable for the log-logistic three-parameter fitting. Always use a fixed reference period (e.g. 1981 to 2010, the standard WMO climate normal period) for the parameter fitting, and apply those parameters to compute SPI/SPEI for any month within or outside the reference period.
10. Why does SPI use the gamma distribution?
Monthly precipitation totals are non-negative (bounded at zero), right-skewed (occasional heavy rainfall events create a long right tail), and cannot be fitted directly to the normal distribution. The two-parameter gamma distribution captures all of these characteristics: it is defined on [0, infinity), its shape parameter alpha controls skewness (small alpha = highly skewed; large alpha = approximately normal), and its scale parameter beta scales the distribution to match the observed mean. The gamma distribution is also computationally tractable, with well-established MLE parameter estimation formulas (Thom 1958) and a CDF that can be evaluated with standard incomplete gamma function routines available in all scientific computing environments. At long accumulation periods (12+ months), accumulated precipitation becomes approximately normal by the Central Limit Theorem, making the gamma fitting less critical but still applied for methodological consistency across all time scales.
11. Why does SPEI use the log-logistic distribution?
SPEI operates on the water balance D = P - PET, which can take both positive and negative values (PET often exceeds P in arid and semi-arid climates, and during hot summer months in temperate climates). The gamma distribution cannot handle negative values, so an alternative distribution is needed. Vicente-Serrano et al. (2010) evaluated several three-parameter distributions (log-logistic, Pearson Type III, GEV) and found the three-parameter log-logistic provided the best overall fit to water balance data across diverse climate types. The log-logistic also has a closed-form CDF, making computation fast and numerically stable. The three parameters (alpha = scale, beta = shape, gamma = location/shift) are estimated by L-moments (probability-weighted moments), which are more robust than MLE for fitting distributions to climate extremes with limited data.
12. How do I interpret negative SPI or SPEI values?
SPI and SPEI values are dimensionless standard normal deviates. A value of -1.0 means conditions are approximately 1 standard deviation below the historical mean for that location, season, and time scale. In frequency terms: -1.0 is exceeded (i.e. conditions are this dry or drier) approximately 16% of the time under the historical climate. Specific classifications: -0.99 to 0 = near normal (slightly below median); -1.0 to -1.49 = moderately dry (approximately 9.2% probability); -1.5 to -1.99 = severely dry (4.4%); -2.0 and below = extremely dry (2.3%). For practical interpretation: a SPI-3 of -1.5 means the 3-month precipitation total is in the lowest 4.4% of the historical record for that season at that location. SPEI values have the same statistical interpretation but include the additional effect of evaporative demand, so the same value of -1.5 in SPEI represents a water balance deficit (not just a precipitation deficit) that falls in the lowest 4.4% of the historical distribution.
13. What is the difference between SPI and Palmer Drought Severity Index (PDSI)?
SPI and PDSI are both widely used drought indices but differ fundamentally in approach. SPI is purely statistical: it standardises a physical variable (precipitation) to its historical distribution independently at each location, making it directly comparable across climates. PDSI is physically based: it uses a simple water balance model with soil moisture storage to compute a departure from a calibrated "normal" condition, incorporating temperature effects via PE (Thornthwaite PET) and soil moisture. Key differences: SPI is multi-scale (you choose the time scale); PDSI is approximately equivalent to a 9 to 12-month SPI due to its built-in memory from the soil moisture model. SPI requires only precipitation; PDSI also requires temperature and soil available water capacity. SPI is standardised to the same scale everywhere; PDSI is calibrated locally and values are not directly comparable across regions. WMO recommends SPI over PDSI for global comparisons because of SPI consistency across climates. SPEI combines the best of both: the multi-scale flexibility and statistical standardisation of SPI with the temperature and evapotranspiration sensitivity of PDSI.
14. Can SPI and SPEI be used for operational drought early warning?
Yes. SPI and SPEI are operationally used by many national and regional drought monitoring systems. The US Drought Monitor uses SPI-1, SPI-3, SPI-6, and SPI-12 as primary indicators alongside PDSI and soil moisture data. SADC (Southern African Development Community) Climate Services Centre uses SPI as the primary meteorological drought indicator. India National Disaster Management Authority uses SPI for official drought classification under the Drought Management Manual. FEWS NET (Famine Early Warning Systems Network) uses SPEI for agricultural drought monitoring across Africa and South Asia. For operational use, SPI/SPEI should be computed monthly, reported at multiple time scales, and combined with other indicators (streamflow, groundwater levels, soil moisture, crop conditions) for a comprehensive drought assessment. The onset of a drought is typically defined as the first month where SPI/SPEI falls below -1.0; drought termination is defined as the first month where SPI/SPEI returns to 0 or above.
15. How does SPEI respond to climate change and global warming?
SPEI (computed with physically sound PET methods like Penman-Monteith) shows a systematic drying trend in many regions under global warming even when precipitation does not change, because rising temperatures increase atmospheric evaporative demand and thus PET. For example, analysis of CMIP6 model projections shows that under SSP5-8.5, SPEI-12 declines by 0.5 to 1.5 standard deviations by 2100 in the Mediterranean, southern Africa, the Sahel, South and Southeast Asia, and western North America. SPI for the same scenarios may show little trend in many of these regions because it does not capture the temperature-driven component of water deficit. This divergence makes SPEI the more appropriate index for climate change impact studies. However, the magnitude of future SPEI drying is strongly sensitive to the PET method: Thornthwaite PET overestimates warming-driven SPEI drying compared to Penman-Monteith. For climate change research, always use FAO-56 Penman-Monteith or Hargreaves-Samani PET.
16. Where can I download ready-made SPI and SPEI data?
Ready-computed global SPI and SPEI data are available from several sources. For SPEI: the SPEI Global Drought Monitor (spei.csic.es) provides monthly SPEI at time scales 1 to 48 months on a 0.5-degree global grid using CRU TS precipitation and Hargreaves PET, freely downloadable as NetCDF. For SPI: NOAA/NCEI provides global SPI at 2.5-degree resolution; PRISM provides high-resolution (4 km) SPI and SPEI for the USA. For South Asia and Nepal: the APHRODITE dataset provides 0.25-degree daily precipitation from 1951 to 2015 that can be used as SPI/SPEI input; ERA5 reanalysis provides all required inputs (precipitation, temperature, radiation, humidity, wind) at 0.25-degree global coverage from 1940 to present for SPEI computation. All of these datasets are freely accessible after registration. For station-based SPI, collect 30+ years of monthly station data from national meteorological services and apply the R SPEI package or Python climate-indices.
Key References
McKee, T.B., Doesken, N.J. and Kleist, J. (1993). The relationship of drought frequency and duration to time scales. Proceedings of the 8th Conference on Applied Climatology, 17 to 22 January 1993, Anaheim, California. American Meteorological Society, pp. 179 to 183.
Vicente-Serrano, S.M., Begueria, S. and Lopez-Moreno, J.I. (2010). A multiscalar drought index sensitive to global warming: the standardized precipitation evapotranspiration index. Journal of Climate, 23(7), 1696 to 1718. doi:10.1175/2009JCLI2909.1
WMO (2012). Standardized Precipitation Index User Guide. WMO-No. 1090. World Meteorological Organization, Geneva. Editors: M. Hayes, M. Svoboda, N. Wall, M. Widhalm.
Thom, H.C.S. (1958). A note on the gamma distribution. Monthly Weather Review, 86(4), 117 to 122.
Allen, R.G., Pereira, L.S., Raes, D. and Smith, M. (1998). Crop Evapotranspiration: Guidelines for Computing Crop Water Requirements. FAO Irrigation and Drainage Paper 56. Food and Agriculture Organization, Rome.
Hargreaves, G.H. and Samani, Z.A. (1985). Reference crop evapotranspiration from temperature. Applied Engineering in Agriculture, 1(2), 96 to 99.
Thornthwaite, C.W. (1948). An approach toward a rational classification of climate. Geographical Review, 38(1), 55 to 94.
Hosking, J.R.M. (1990). L-moments: analysis and estimation of distributions using linear combinations of order statistics. Journal of the Royal Statistical Society Series B, 52(1), 105 to 124.
Begueria, S. and Vicente-Serrano, S.M. (2023). SPEI: Calculation of the Standardised Precipitation-Evapotranspiration Index. R package version 1.8.1. Available at: https://cran.r-project.org/package=SPEI
Sheffield, J., Wood, E.F. and Roderick, M.L. (2012). Little change in global drought over the past 60 years. Nature, 491, 435 to 438. doi:10.1038/nature11575
Explore More Hydrology and Climate Resources
Rainfall-runoff analysis, flood frequency, evapotranspiration, and more in our full library.