Skip to main content

drought_indices_python

Python 3.7+ License: MIT PyPI - Version

A Python library for computing and analyzing various drought indices, designed for researchers and practitioners in climate and hydrology. This package aims to provide robust and scientifically verifiable implementations of key drought indicators.

Currently under active development.

About the Author

Kumar Puran Tripathy (PhD Student, Texas A&M University) Email: tripathypuranbdk@gmail.com

Functions

The drought_indices_python package offers a growing suite of essential drought indices:

  • Potential Evapotranspiration (PET):
    • calculate_pet_thornthwaite: Estimates PET using the widely recognized Thornthwaite (1948) method, based on temperature and daylight hours.
  • Standardized Precipitation Index (SPI):
    • calculate_spi: Quantifies precipitation deficit or surplus over various timescales, utilizing a calibration period for robust statistical fitting.
  • Standardized Precipitation Evapotranspiration Index (SPEI):
    • calculate_spei: A powerful drought indicator based on the difference between precipitation and potential evapotranspiration, aggregated and transformed to a standard normal variate using a defined calibration period.
  • Data Utilities:
    • Functions for loading, preprocessing, and saving meteorological and hydrological data.

Installation

You can install drought_indices_python directly from PyPI using pip:

pip install drought_indices_python

For development purposes, or to work with the latest unreleased features, you can install it locally in editable mode:

cd /path/to/your/DROUGHT_INDICES_PYTHON/project # Navigate to the outer DROUGHT_INDICES_PYTHON folder
pip install -e .

Usage

Once installed, you can easily import and utilize the functions within your Python scripts:

import numpy as np
from drought_indices_python import calculate_pet_thornthwaite, calculate_spi, calculate_spei, load_data

# Example: Calculate PET (assuming you have annual_heat_index_I)
# annual_I = 50.0 # This would come from your long-term temperature data
# pet_value = calculate_pet_thornthwaite(monthly_temperature=18.5, latitude=40.0, month=7, annual_heat_index_I=annual_I)
# print(f"Calculated PET: {pet_value:.2f} mm")

# Example: Calculate SPI (using dummy data for illustration)
# precip_data_example = np.random.rand(360) * 150 # 30 years of monthly data
# spi_values = calculate_spi(
#     precipitation_data=precip_data_example,
#     scale_months=6,
#     data_start_year=1990,
#     calibration_start_year=1990,
#     calibration_end_year=2019
# )
# print(f"First 5 SPI values (6-month): {spi_values[:5]}")

# Example: Calculate SPEI (using dummy data for illustration)
# pet_data_example = np.random.rand(360) * 80 # 30 years of monthly PET
# spei_values = calculate_spei(
#     precipitation_data=precip_data_example,
#     pet_data=pet_data_example,
#     scale_months=12,
#     data_start_year=1990,
#     calibration_start_year=1990,
#     calibration_end_year=2019
# )
# print(f"First 5 SPEI values (12-month): {spei_values[:5]}")

# Data Loading (placeholder for your implementation)
# data = load_data('path/to/your/climate_data.csv')

Contributing

We welcome contributions to drought_indices_python! Whether you're fixing bugs, adding new features, or improving documentation, your help is greatly appreciated. Please feel free to fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details. """

Metadata

Release files for drought-indices-python 0.1.4

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

Source distribution (sdist)

Source distribution for drought-indices-python 0.1.4
File Size Uploaded
drought_indices_python-0.1.4.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drought-indices-python 0.1.4
File Interpreter ABI Platform
drought_indices_python-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / drought_indices_python-0.1.4.tar.gz

Download URL drought_indices_python-0.1.4.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a2b5acff67000b0a6d4140888b631a2675d5dc22ba01ac58656cebd617a76811
BLAKE2b-256 checksum
How to use checksums
ce57579308853d6358550956bba9fc53739b928add5b31686a0cdd582dc22e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / drought_indices_python-0.1.4-py3-none-any.whl

Download URL drought_indices_python-0.1.4-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1022339c6c4b74b3a31c60fa8457a3ea2b79a9cd2008c0257d6c746b3680d01
BLAKE2b-256 checksum
How to use checksums
fc896b543fcdcaf2af6eab1c8f55aebe29199d8b08d714dcd4dcac015628f424
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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