Skip to main content

A simple Python package to calculate drought indices for time series such as the SPI, SPEI and SGI.

Project description

SPEI

PyPI PyPi Supported Python Versions Code Size PyPi Downloads License DOI

Tests CodacyCoverage CodacyGrade Typed: MyPy Formatter and Linter: ruff

SPEI is a simple Python package to calculate drought indices for time series such as the SPI (Standardized Precipitation Index), SPEI (Standardized Precipitation Evaporation Index), and SGI (Standardized Groundwater Index). 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.

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

Please feel free to contribute or ask questions!

If you happen to use this package, please cite: Vonk, M. A. (2024). SPEI: A simple Python package to calculate and visualize drought indices (vX.X.X). Zenodo. https://doi.org/10.5281/zenodo.10816741.

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
Standardized Soil Moisture Index SSMI 6

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.

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

  1. B. Lloyd-Hughes and M.A. Saunders (2002) - A Drought Climatology for Europe. DOI: 10.1002/joc.846
  2. S.M. Vicente-Serrano, 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. J.P. Bloomfield and B.P. Marchant, B. P. (2013) - Analysis of groundwater drought building on the standardised precipitation index approach. DOI: 10.5194/hess-17-4769-2013
  4. A. Babre, 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. E. Tijdeman, 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
  6. 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

Note that the method for calculating the drought indices does not come from these articles and SciPy is used for deriving the distribution. However the literature is helpful as a reference to understand the context and application of drought indices.

Alternatives

There are other great packages available to calculate these indices. However, they are either written in R such as SPEI or don't have the Standardized Groundwater Index such as climate_indices. Additionaly, these packages provide ways to analyse spatial data and calculate potential evaporation. This makes these packages complex, because it is easier to only deal with time series. However, support for spatial data is something on the to-do list so help is appreciated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spei-0.6.0.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

spei-0.6.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file spei-0.6.0.tar.gz.

File metadata

  • Download URL: spei-0.6.0.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for spei-0.6.0.tar.gz
Algorithm Hash digest
SHA256 a21933a65c6d7639881671a82b9eb79ee34cd5b52ca7b2a73a55d3988aa93f5c
MD5 affcc2796f0d95c6af2bcc57c5bbd5ea
BLAKE2b-256 833a26a53a9ee095710220e53edf9b1fa2e6f06235555ab873c24ecdb362647c

See more details on using hashes here.

File details

Details for the file spei-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: spei-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for spei-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67d03d8da98c034ce260f9f3b1e359a80be78cbcc3fca5ef636947848c7f7627
MD5 4d2c2c1719c1d3a09119d6c6a503e4a6
BLAKE2b-256 456edb5c6384f9d6110fefd1558fb55cb006ff3c6c0856e0462c371e2f5bb6b1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page