Skip to main content

SPEI

PyPI PyPi Supported Python Versions Code Size PyPi Downloads License

JOSS DOI

Tests Coverage Formatter and Linter: ruff Typed: mypy Typed: ty

SPEI is a simple Python package to calculate drought indices for hydrological time series. This package uses popular Python packages such as Pandas and Scipy to make it easy and versatile for the user to calculate the drought indices. Pandas Series are great for dealing with time series; providing interpolation, rolling average, and other manipulation options. SciPy enables us to use all different kinds of distributions to fit the data. Different popular drought indices are supported such as the SPI (Standardized Precipitation Index), SPEI (Standardized Precipitation Evaporation Index), and SGI (Standardized Groundwater Index).

If you use this software for either the visualization and/or analysis, please cite this package via our article in the Journal of Open Source Software:

Vonk, M. A. (2025). SPEI: A Python package for calculating and visualizing drought indices. Journal of Open Source Software, 10(111), 8454. doi.org/10.21105/joss.08454.

Or cite a specific version in the Zenodo archive:

Vonk, M. A. (XXXX). SPEI: A simple Python package to calculate and visualize drought indices (vX.X.X). Zenodo. doi.org/10.5281/zenodo.10816740.

Available Drought Indices

Drought Index Abbreviation Literature
Standardized Precipitation Index SPI 1
Standardized Precipitation Evaporation Index* SPEI 2
Standardized Groundwater Index SGI 3,4
Standardized Streamflow Index SSFI 5,6
Standardized Soil Moisture Index SSMI 7

The package is not limited to only these five drought indices. If any of the distributions in the Scipy library is valid on the observed hydrological series, the drought index can be calculated.

*For the calculation of potential evaporation, take a look at pyet. This is another great package that also uses pandas Series to calculate different kinds of potential evaporation time series.

Installation

To get the latest stable version install using:

pip install spei

To get the development version download or clone the GitHub repository to your local device. Install using:

pip install -e <download_directory>

Literature

This list of scientific literature is helpful as a reference to understand the context and application of drought indices.

  1. Lloyd-Hughes, B. and M.A. Saunders (2002) - A Drought Climatology for Europe. DOI: 10.1002/joc.846
  2. Vicente-Serrano, S.M., S. Beguería and J.I. López-Moreno (2010) - A Multi-scalar drought index sensitive to global warming: The Standardized Precipitation Evapotranspiration Index. DOI: 10.1175/2009JCLI2909.1
  3. Bloomfield, J.P. and B.P. Marchant (2013) - Analysis of groundwater drought building on the standardised precipitation index approach. DOI: 10.5194/hess-17-4769-2013
  4. Babre, A., A. Kalvāns, Z. Avotniece, I. Retiķe, J. Bikše, K.P.M. Jemeljanova, A. Zelenkevičs and A. Dēliņa (2022) - The use of predefined drought indices for the assessment of groundwater drought episodes in the Baltic States over the period 1989–2018. DOI: 10.1016/j.ejrh.2022.101049
  5. Vicente-Serrano, S. M., J. I. López-Moreno, S. Beguería, J. Lorenzo-Lacruz, C. Azorin-Molina, and E. Morán-Tejeda (2012). Accurate Computation of a Streamflow Drought Index. Journal of Hydrologic Engineering. American Society of Civil Engineers. DOI: 10.1061/(asce)he.1943-5584.0000433
  6. Tijdeman, E., K. Stahl and L.M. Tallaksen (2020) - Drought characteristics derived based on the Standardized Streamflow Index: A large sample comparison for parametric and nonparametric methods. DOI: 10.1029/2019WR026315
  7. Carrão. H., Russo, S., Sepulcre-Canto, G., Barbosa, P.: An empirical standardized soil moisture index for agricultural drought assessment from remotely sensed data. DOI: 10.1016/j.jag.2015.06.011s

Publications

These are scientific publications that use and cite this Python package:

Adla, S., Šaponjić, A., Tyagi, A., Nagi, A., Pastore, P., & Pande, S. (2024). Steering agricultural interventions towards sustained irrigation adoption by farmers: socio-psychological analysis of irrigation practices in Maharashtra, India. Hydrological Sciences Journal, 69(12), 1586–1603. https://doi.org/10.1080/02626667.2024.2376709

van Mourik, J., Ruijsch, D., van der Wiel, K., Hazeleger, W., & Wanders, N. (2025). Regional drivers and characteristics of multi-year droughts. Weather and Climate Extremes, 48, 100748. https://doi.org/10.1016/j.wace.2025.100748

Segura-Barrero, R., Lauvaux, T., Lian, J., Ciais, P., Badia, A., Ventura, S., Bazzi, H., Abbessi, E., Fu, Z., Xiao, J., Li, X., & Villalba, G. (2025). Heat and Drought Events Alter Biogenic Capacity to Balance CO2 Budget in South-Western Europe. Global biogeochemical cycles, 39(1), e2024GB008163. https://doi.org/10.1029/2024GB008163

Panigrahi, S., Vidyarthi, V.K. (2025). Assessing the Suitability of SPI and SPEI in Steppe Hot and Arid Climatic Zones in India. In: Sefelnasr, A., Sherif, M., Singh, V.P. (eds) Water Resources Management and Sustainability. Water Science and Technology Library, vol 114. Springer, Cham. https://doi.org/10.1007/978-3-031-80520-2_12

Ashcroft L, Ritman M, Bridgman H, Thornton K, Di Gravio G, Oates W, Belfield R, Belfield E. (2025). A climatology of meteorological droughts in New England, Australia, 1880–2022. Journal of Southern Hemisphere Earth Systems Science 75, ES25013. https://doi.org/10.1071/ES25013

Patidar, R., S. M. Pingale, D. Khare, and S. Choudhary (2025). Assessing Spatio-Temporal Meteorological Drought Dynamics Across Indian Agro-Climatic Zones: A Long-Term Perspective. International Journal of Climatology 45, no. 16: e70146. https://doi.org/10.1002/joc.70146

Butterfield, B. A., Furtado, J. C., Salazar, M. L., & Kuster, E. L. (2025). Assessing climate change and whiplash events in national parks. National Weather Center Research Experiences for Undergraduates Program.

Knoll, S., Duthweiler, S., Rötzer, T., Pauleit, S., & Helmreich, B. (2025). Recycled demolition waste in engineered substrate promotes long-term urban tree growth and ecosystem services in a temperate city. Sustainable Cities and Society, 131, Article 106670. https://doi.org/10.1016/j.scs.2025.106670

Compaoré, C., Somda, W., Kébré, M. B. and Koalaga, Z. (2025). Spatial Analysis of Historical and Near-Future Droughts using the SPI and SPEI Indices in the Competence Area of the Nakanbé Water Agency in Burkina Faso (1981–2050). IEEE Multi-conference on Natural and Engineering Sciences for Sahel's Sustainable Development (MNE3SD), Bobo-Dioulasso, Burkina Faso, pp. 1-10, https://doi.org/10.1109/MNE3SD67637.2025.11323240

Saponaro, V., Dalmonech, D., Vangi, E., Puchi, P. F., Rezaie, N., D’Andrea, E., Tomelleri, E., & Collalti, A. (2026). Climate change, more than management, drives short- and long-term changes in iWUE in a sub-Alpine beech forest. Journal of Forestry Research, 37(1), 16. https://doi.org/10.1007/s11676-025-01942-8

Worden, S., Fu, R., Bloom, A. A., Bauters, M., Verbeeck, H., Fatoyinbo, T., Hubau, W., Koutika, L.-S., Kengdo, S. K., Maes, S. L., Medjibe, V., Russo, N. J., Saatchi, S., Sagang, L. B., Smith, T. B., Sonwa, D. J., Boeckx, P., & Ordway, E. M. (2026). Congo Basin carbon cycle responses to global change. Global Change Biology, 32(1), Article e70688. https://doi.org/10.1111/gcb.70688

Bjerre, E., Jessen, S., Schneider, R., Villholth, K. G., Dippenaar, M. A., Enemark, T., Meyer, R., Hallowes, J., Sonnenborg, T. O., Kanyerere, T., & Jensen, K. H. (2026). Groundwater responses to decadal rainfall variability in semi-arid South Africa. Journal of Hydrology, 669(Part A), Article 135022. https://doi.org/10.1016/j.jhydrol.2026.135022

Lekarkar, K., Rakovec, O., Kumar, R., Dondeyne, S., and van Griensven, A. (2026). Soil moisture droughts in Belgium during 2011–2020 were the worst in five decades, Hydrology and Earth System Sciences, 30(9), 2817-2835. https://doi.org/10.5194/10.5194/hess-30-2817-2026

Nagamoto, E., Ombadi, M., Ciulla, F., Willard, J.D., Carroll, R. W. H. and Varadharajan, C. (2026). Widespread drought-driven declines in streamflows and water quality in the Upper Colorado River Basin during 1998-2022. Commun Earth Environ 7, 734 (2026). https://doi.org/10.1038/s43247-026-03890-5

Jakubczyk, T. and Leśny, J. (2026). A Framework for Evaluating Meteorological Drought Indices as Indicators of Low Flows: A Case Study of the Biała Lądecka River Catchment Area. Water 2026, 18(16), 2047. https://doi.org/10.3390/w18162047

Fuentes, I., Osorio, V., Jordan, C. and Vervoort, R. W. (2026). Drought propagation and recovery dynamics across hydroclimatic pathways: Predictors and timescale dependence in Chile. Journal of Hydrology: Regional Studies 67, 103797. https://doi.org/10.1016/j.ejrh.2026.103797

Andrade, F. M., Molowny-Horas, R. and Fernández-Martínez, M. (2026). Silent Alarms? Unveiling Destabilization Risk in Terrestrial Ecosystem Carbon Fluxes. Global Change Biology 32, no. 10: e71100. https://doi.org/10.1111/gcb.71100.

Metadata

Release files for spei 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spei 0.8.3
File Size Uploaded Provenance Actions
spei-0.8.3.tar.gz 46.3 kB Without provenance Details for spei-0.8.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spei 0.8.3
File Interpreter ABI Platform Actions
spei-0.8.3-py3-none-any.whl Python 3 none any Details for spei-0.8.3-py3-none-any.whl

Total release size: 84.2 kB

Release files / spei-0.8.3.tar.gz

Download URL spei-0.8.3.tar.gz
Size 46.3 kB
Tags Source
SHA-256 checksum
How to use checksums
502214088d77e2fcbae515747bff411577b843b2a8ed4fb82e9bef3e30ecc82f
BLAKE2b-256 checksum
How to use checksums
c595f753996d35e6865c54a639cd79a5fb667accd23e3813318ce987015f4cfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Release files / spei-0.8.3-py3-none-any.whl

Download URL spei-0.8.3-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
774347a9b7af82f0355b954c7cd31455eb21ea717f9a7afeb7b3a5aee25b7f17
BLAKE2b-256 checksum
How to use checksums
26eeb287e93736fde28bcfd6fd0ed2919029b73d40415eaeb0da7154379a3141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.1

Security for spei 0.8.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page