Metadata-Version: 2.4
Name: drought_indices_python
Version: 0.1.4
Summary: A Python package for calculating and analyzing drought indices.
Home-page: https://github.com/ktripa/drought_indices_python
Author: Kumar Puran Tripathy
Author-email: tripathypuranbdk@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Classifier: Topic :: Scientific/Engineering :: Hydrology
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary


# drought_indices_python

![Python 3.7+](https://img.shields.io/badge/python-3.7%2B-blue.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI - Version](https://img.shields.io/pypi/v/drought_indices_python.svg)](https://pypi.org/project/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:

```bash
pip install drought_indices_python
```

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

```bash
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:

```python
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](LICENSE) file for details.
"""
