A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

SPEI

Calculate and visualize some popular drought indices such as the SPI, SPEI and SGI.
https://github.com/martinvonk/SPEI

Category: Natural Resources
Sub Category: Water Supply and Quality

Keywords

drought drought-index drought-indices groundwater hydrology python sgi spei spi timeseries

Last synced: about 14 hours ago
JSON representation

Repository metadata

A simple Python package to calculate and visualize some popular drought indices such as the SPI, SPEI and SGI.

README.md

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.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 260
Total Committers: 1
Avg Commits per committer: 260.0
Development Distribution Score (DDS): 0.0

Commits in past year: 69
Committers in past year: 1
Avg Commits per committer in past year: 69.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Martin Vonk v****t@g****m 260

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 14
Total pull requests: 38
Average time to close issues: 8 days
Average time to close pull requests: about 10 hours
Total issue authors: 12
Total pull request authors: 1
Average comments per issue: 1.93
Average comments per pull request: 0.05
Merged pull request: 38
Bot issues: 0
Bot pull requests: 0

Past year issues: 7
Past year pull requests: 7
Past year average time to close issues: 18 days
Past year average time to close pull requests: about 17 hours
Past year issue authors: 6
Past year pull request authors: 1
Past year average comments per issue: 1.43
Past year average comments per pull request: 0.0
Past year merged pull request: 7
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/martinvonk/SPEI

Top Issue Authors

  • martinvonk (3)
  • luizfiscina (1)
  • Appleweier (1)
  • simoonoses1 (1)
  • xiaoqi1010 (1)
  • Mahsabzg (1)
  • shirazi25 (1)
  • agnespeltan (1)
  • juliammassing (1)
  • filipematos95 (1)
  • njdepsky (1)
  • mathilde-ritman (1)

Top Pull Request Authors

  • martinvonk (38)

Top Issue Labels

  • question (4)
  • enhancement (1)
  • code quality (1)
  • bug (1)

Top Pull Request Labels

  • code quality (16)
  • enhancement (13)
  • documentation (11)
  • bug (1)

Package metadata

pypi.org: spei

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

  • Homepage:
  • Documentation: https://spei.readthedocs.io/
  • Licenses: MIT License Copyright (c) 2022 Martin Vonk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.6.1 (published 2 months ago)
  • Last Synced: 2025-04-25T12:00:59.287Z (1 day ago)
  • Versions: 23
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 1,788 Last month
  • Rankings:
    • Dependent packages count: 10.038%
    • Downloads: 12.513%
    • Average: 14.736%
    • Dependent repos count: 21.657%
  • Maintainers (1)

Dependencies

.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
pyproject.toml pypi
  • matplotlib *
  • numpy *
  • pandas *
  • scipy *
.github/workflows/auto-author-assign.yml actions
  • toshimaru/auto-author-assign v1.6.2 composite

Score: 11.896690146099054