A Python package for calculating and analyzing drought indices.
Project description
drought_indices_python
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. """
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drought_indices_python-0.1.4.tar.gz.
File metadata
- Download URL: drought_indices_python-0.1.4.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2b5acff67000b0a6d4140888b631a2675d5dc22ba01ac58656cebd617a76811
|
|
| MD5 |
1aa77f3f67cbe10b7b2f4a8b25481f7b
|
|
| BLAKE2b-256 |
ce57579308853d6358550956bba9fc53739b928add5b31686a0cdd582dc22e68
|
File details
Details for the file drought_indices_python-0.1.4-py3-none-any.whl.
File metadata
- Download URL: drought_indices_python-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1022339c6c4b74b3a31c60fa8457a3ea2b79a9cd2008c0257d6c746b3680d01
|
|
| MD5 |
783d7fcee2b5a956b6fafc4dfc962841
|
|
| BLAKE2b-256 |
fc896b543fcdcaf2af6eab1c8f55aebe29199d8b08d714dcd4dcac015628f424
|