SPI & SPEI: Drought Indices Explained with Calculations

Dive into SPI and SPEI drought indices to understand their calculations, differences, and real-world applications.

SPI and SPEI Drought Monitoring Illustration

Understanding SPI and SPEI

The Standardized Precipitation Index (SPI), developed by McKee et al. (1993), measures precipitation anomalies over various time scales (e.g., 1, 3, 6, or 12 months), making it a versatile tool for drought assessment. The Standardized Precipitation Evapotranspiration Index (SPEI), introduced by Vicente-Serrano et al. (2010), builds on SPI by factoring in potential evapotranspiration (PET), which accounts for temperature-driven water loss alongside precipitation deficits.

Both indices are standardized to express drought or wet conditions as deviations from the long-term mean, enabling comparisons across different climates. This guide explores their calculations, differences, applications, and provides practical examples in Python, R, and Excel, along with an interactive calculator.

Differences and Similarities Between SPI and SPEI

While SPI and SPEI share a standardized approach, they differ in their inputs and applications. Here’s a detailed comparison:

Aspect SPI SPEI
Input Data Precipitation only Precipitation and PET
Calculation Basis Precipitation anomalies Water balance (P - PET)
Complexity Simpler, single input More complex, dual inputs
Applications Meteorological drought Meteorological and agricultural drought
Temperature Sensitivity Not sensitive Highly sensitive via PET
Data Requirements Precipitation (monthly/daily) Precipitation and temperature/PET

Similarities:

  • Standardized to a normal distribution for comparability.
  • Support multiple time scales (1, 3, 6, 12 months).
  • Used for drought and wet period assessment.
  • Implemented in Python, R, MATLAB, or Excel.
  • Applied in climate research and water management.

How to Calculate SPI and SPEI

Both indices involve fitting data to a statistical distribution and standardizing to a normal distribution. Below are the steps and formulas.

Standardized Precipitation Index (SPI) Calculation

SPI quantifies precipitation anomalies using a gamma distribution for precipitation data over a chosen time scale.

  • Collect monthly precipitation data (≥30 years).
  • Calculate the mean precipitation for the time scale.
  • Aggregate for the desired time scale (e.g., 3 months).
  • Fit data to a gamma distribution.
  • Compute the cumulative distribution function (CDF).
  • Transform CDF to standard normal distribution.

The SPI formula is:

\[ SPI = \Phi^{-1}(F(x)) \]

Where \( F(x) \) is the CDF of the gamma distribution, and \( \Phi^{-1} \) is the inverse standard normal CDF.

Standardized Precipitation Evapotranspiration Index (SPEI) Calculation

SPEI uses water balance (precipitation minus PET), fitted to a log-logistic distribution.

  • Collect monthly precipitation and temperature data.
  • Calculate mean precipitation for context.
  • Calculate PET (e.g., Thornthwaite method).
  • Compute water balance: \( D = P - PET \).
  • Fit water balance to a log-logistic distribution.
  • Standardize to obtain SPEI values.

The SPEI formula is:

\[ SPEI = \Phi^{-1}(F(D)) \]

Where \( F(D) \) is the CDF of the log-logistic distribution for water balance \( D \).

Example Calculations for SPI and SPEI

Below are simplified examples for a 3-month time scale using hypothetical data. Full calculations require extensive historical data and statistical software.

Python Example (SPI and SPEI)

# Simplified SPI/SPEI calculation using SciPy
import numpy as np
from scipy.stats import gamma, norm, genlogistic
import pandas as pd

# Sample data: 3-month precipitation (mm) and temperature (°C)
data = pd.DataFrame({
    'precip': [50, 70, 30, 90, 20],  # Example precipitation
    'temp': [20, 22, 18, 25, 19]     # Example temperature
})
mean_precip = data['precip'].mean()  # Historical mean

# SPI Calculation
def calculate_spi(precip, mean_precip, timescale=3):
    precip_sum = precip.rolling(timescale).sum().dropna()
    shape, loc, scale = gamma.fit(precip_sum, floc=0)
    cdf = gamma.cdf(precip_sum - mean_precip, shape, loc, scale)
    spi = norm.ppf(cdf)
    return spi

# Simplified Thornthwaite PET (mm/month)
def calculate_pet(temp):
    return 16 * (10 * temp / 25)**1.5  # Approximation

# SPEI Calculation
def calculate_spei(precip, temp, mean_precip, timescale=3):
    pet = calculate_pet(temp)
    water_balance = precip - pet
    wb_sum = water_balance.rolling(timescale).sum().dropna()
    params = genlogistic.fit(wb_sum - mean_precip)
    cdf = genlogistic.cdf(wb_sum, *params)
    spei = norm.ppf(cdf)
    return spei

spi_values = calculate_spi(data['precip'], mean_precip)
spei_values = calculate_spei(data['precip'], data['temp'], mean_precip)
print("SPI:", spi_values)
print("SPEI:", spei_values)
                

R Example (SPI and SPEI)

# Using SPEI package in R
library(SPEI)

# Sample data
precip <- c(50, 70, 30, 90, 20)
temp <- c(20, 22, 18, 25, 19)
mean_precip <- mean(precip)

# SPI calculation
spi_3 <- spi(precip - mean_precip, scale=3)

# SPEI calculation (requires PET)
pet <- thornthwaite(temp, lat=40)  # Example latitude
spei_3 <- spei(precip - pet - mean_precip, scale=3)

print(spi_3)
print(spei_3)
                

Excel Example (SPI)

In Excel, SPI can be approximated:

  1. Enter monthly precipitation in a column (e.g., A1:A360 for 30 years).
  2. Calculate mean precipitation: =AVERAGE(A1:A360).
  3. Calculate 3-month sums: =SUM(A1:A3), drag down.
  4. Fit gamma distribution using add-ins (e.g., XLSTAT).
  5. Use =NORM.S.INV to standardize CDF values.

Note: SPEI in Excel is complex due to PET calculations, requiring add-ins or external tools.

SPI/SPEI Calculator

Estimate SPI or SPEI using simplified statistical methods. Enter precipitation, average precipitation, temperature, and select time scale and index type. Note: This is a demonstration; actual calculations require extensive historical data.

Result: Calculating...

Applications of SPI and SPEI

SPI and SPEI are essential for drought monitoring and water resource management:

  • Meteorological Drought: SPI is used by NOAA for precipitation deficit analysis.
  • Agricultural Drought: SPEI assesses soil moisture impacts, incorporating PET.
  • Water Management: Informs reservoir and irrigation planning.
  • Climate Research: Studies drought trends in regions like the Chesapeake Bay.
  • Disaster Preparedness: Supports early warning systems.

Frequently Asked Questions

1. What is the Standardized Precipitation Index (SPI)?

SPI is a drought index that measures precipitation anomalies over various time scales, standardized to a normal distribution for cross-region comparisons.

2. What is the Standardized Precipitation Evapotranspiration Index (SPEI)?

SPEI is a drought index that uses water balance (precipitation minus PET) to assess drought severity, incorporating temperature effects.

3. What is the formula for SPI?

SPI = \(\Phi^{-1}(F(x))\), where \(F(x)\) is the CDF of precipitation fitted to a gamma distribution, and \(\Phi^{-1}\) is the inverse standard normal CDF.

4. What is the formula for SPEI?

SPEI = \(\Phi^{-1}(F(D))\), where \(F(D)\) is the CDF of water balance (P - PET) fitted to a log-logistic distribution.

5. How is the Standardized Precipitation Index calculated?

SPI is calculated by aggregating precipitation, fitting it to a gamma distribution, computing the CDF, and standardizing to a normal distribution.

6. How is the Standardized Precipitation Evapotranspiration Index calculated?

SPEI is calculated by computing water balance (P - PET), fitting to a log-logistic distribution, and standardizing the CDF.

7. How to calculate SPI in Excel?

Aggregate precipitation data, fit a gamma distribution using add-ins like XLSTAT, and use NORM.S.INV to standardize CDF values.

8. How to calculate SPEI in Excel?

Calculate PET (e.g., Thornthwaite), compute water balance, fit a log-logistic distribution, and standardize using NORM.S.INV.

9. What software is available for SPI calculation?

Python (SciPy), R (SPEI package), MATLAB, and Excel with add-ins like XLSTAT.

10. What software is available for SPEI calculation?

R (SPEI package), Python (SciPy), MATLAB, and Excel with add-ins for PET.

11. How to calculate SPI in Python?

Use SciPy to fit precipitation to a gamma distribution, compute CDF, and standardize using norm.ppf.

12. How to calculate SPEI in Python?

Calculate PET, compute water balance, fit to log-logistic distribution using SciPy, and standardize.

13. How to calculate SPI in R?

Use the SPEI package’s spi() function with precipitation data and time scale.

14. How to calculate SPEI in R?

Use the SPEI package’s spei() function with water balance (P - PET) and time scale.

15. Where can I download SPI data?

SPI data is available from NOAA, PRISM, NCAR, or USGS.

16. Where can I download SPEI data?

SPEI data is available from SPEI Global Drought Monitor, NOAA, or PRISM.

17. What is the 3-month Standardized Precipitation Index?

The 3-month SPI measures precipitation anomalies over 3 months, ideal for short-term drought monitoring.

18. How is SPEI different from SPI?

SPI uses only precipitation, while SPEI includes PET, making it more suitable for agricultural droughts.

19. Can SPI and SPEI be used for seasonality analysis?

Yes, both can analyze seasonal drought patterns using appropriate time scales (e.g., 3 or 6 months).

20. What is the Standardized Precipitation Index user guide?

The SPI user guide from WMO or NOAA details data requirements, calculation steps, and result interpretation.

21. What is the Standardized Precipitation Evapotranspiration Index user guide?

The SPEI user guide from the SPEI website explains data inputs, PET methods, and standardization.

22. How to interpret SPI values?

SPI values: \(\leq -1\) (drought), \(\geq 1\) (wet), \(\approx 0\) (normal).

23. How to interpret SPEI values?

SPEI values are similar to SPI: negative for drought, positive for wet conditions, near zero for normal.

24. What is the PRISM Standardized Precipitation Evapotranspiration Index?

PRISM SPEI provides high-resolution SPEI data for the U.S., including Chesapeake Bay, from PRISM Climate Group.

Explore More Climate Tools

Discover additional resources for environmental and climate analysis.