Skip to main content
U.S. flag

An official website of the United States government

Site Section
Data & Maps

Source Code: Climate and Drought Indices in Python (SPI, SPEI, PET)

Associated Agencies

National Oceanic and Atmospheric Administration's National Centers for Environmental Information (NCEI), National Integrated Drought Information System (NIDIS)

This is a developmental/forked version of code that was originally developed by the National Integrated Drought Information System and NOAA's National Centers for Environmental Information. The most updated version is currently being maintained and developed by independent scientific programmer James Adams on his Github account, which includes feedback and contributions from active users worldwide. The software can be downloaded or cloned from the following Github project. To get started, follow the accompanying documentation.

Climate Indices Project

Documentation to Get Started

License

Disclaimer

*Please note that this software was written for python 3.7. When following the documentation page to create a virtual environment with Anaconda be sure to specify python 3.7 (I.e.,  $ conda create -n indices_env python==3.7 ).

Also, some users have had to install an updated version of pip ($ conda install pip ) before installing the climate-indices software specific python package. 

Documentation

This project contains Python implementations of various climate index algorithms which provide a geographical and temporal picture of the severity of precipitation and temperature anomalies useful for climate monitoring and research. This code is currently considered ‘Beta’ as James Adams, the original software developer, and NIDIS perform additional testing and verification. If you are currently running another implementation of the algorithms, how do these Python indices compare?  Please help us by reporting feedback to drought.portal@noaa.gov.

The following indices are provided:

  • SPI, Standardized Precipitation Index, utilizing both gamma and Pearson Type III distributions
  • SPEI, Standardized Precipitation Evapotranspiration Index, utilizing both gamma and Pearson Type III distributions
  • PET, Potential Evapotranspiration, utilizing either Thornthwaite or Hargreaves equations
  • PDSI, Palmer Drought Severity Index
  • scPDSI, Self-calibrated Palmer Drought Severity Index
  • PHDI, Palmer Hydrological Drought Index
  • Z-Index, Palmer moisture anomaly index (Z-index)
  • PMDI, Palmer Modified Drought Index
  • PNP, Percentage of Normal Precipitation

This Python implementation of the above climate index algorithms is being developed with the following goals in mind:

  • to provide an open source software package to compute a suite of climate indices commonly used for climate monitoring, with well documented code that is faithful to the relevant literature and which produces scientifically verifiable results
  • to provide a central, open location for participation and collaboration for researchers, developers, and users of climate indices
  • to facilitate standardization and consensus on best-of-breed climate index algorithms and corresponding compliant implementations in Python
  • to provide transparency into the operational code used for climate monitoring activities at NCEI/NOAA, and consequent reproducibility of published datasets computed from this package
  • to incorporate modern software engineering principles and programming best practices

Previous Software Version

The previous original version developed at NIDIS/NOAA's National Centers for Environmental Information is available upon request from drought.portal@noaa.gov.