Temporal disaggregation of daily precipitation into hourly using Q-CODA.
Project description
pyqcoda
pyqcoda is a Python library for temporal disaggregation of daily precipitation into hourly time series using a combination of comonotonicity transformation and an iterative adjusted k-nearest neighbors (KNN) algorithm. It is tailored for hydrological and climate data processing tasks where hourly data is required but only daily observations are available.
🌧️ Overview
-
Input:
train_data.csv: Hourly precipitation data with columnsdatetime(hourly resolution) andprecipitation(mm).test_data.csv: Daily precipitation data with the same column names but daily resolution (datetimeat 00:00:00 for each day).
-
Output:
- A pandas DataFrame (or CSV) with hourly precipitation disaggregated from the daily values in
test_data, using statistical patterns learned fromtrain_data.
- A pandas DataFrame (or CSV) with hourly precipitation disaggregated from the daily values in
✨ Features
- Disaggregates daily totals into 24-hour precipitation series.
- Preserves sub-daily maxima in reconstructed data.
- Season-aware (DJF, MAM, JJA, SON) to capture seasonal variability.
- Combines comonotonicity with KNN-based iterative adjustments.
- Suitable for hydrological modeling and climate studies.
📦 Installation
From PyPI (recommended)
pip install pyqcoda
From Github
git clone https://github.com/carloscorreag/pyqcoda.git
cd pyqcoda
pip install .
🚀 Usage example
import pandas as pd
from pyqcoda import pyqcoda
# 1. Load your training (hourly) and testing (daily) datasets
df_train = pd.read_csv("train_data.csv", index_col=0, parse_dates=True)
df_test = pd.read_csv("test_data.csv", index_col=0, parse_dates=True)
# 2. Instantiate pyqcoda and disaggregate
qc = pyqcoda()
simulated_series = qc.disaggregate(df_train, df_test)
# 3. Convert results to hourly DataFrame
df_hourly = qc.get_hourly_dataframe(simulated_series)
# 4. Save output
df_hourly.to_csv("disaggregated_output.csv")
print("Hourly disaggregated precipitation saved to disaggregated_output.csv")
🔧 Requirements
- Python 3.7+
- pandas ≥ 1.2.4
- numpy ≥ 1.21.6
- scikit-learn ≥ 1.0.2
📄 License
This project is licensed under the MIT License — see the LICENSE file for details.
📖 Citation
Correa Guinea, C. (2025). pyqcoda: Temporal disaggregation of daily precipitation into hourly using Q-CODA. DOI:
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 pyqcoda-1.0.0.tar.gz.
File metadata
- Download URL: pyqcoda-1.0.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88da9f5bfd8dc61c844317d9724f2502a66df03c81f7368136c568337895b028
|
|
| MD5 |
d38aef67659875b20ff4316c520e0a96
|
|
| BLAKE2b-256 |
d6fd1fd7ff6663e0eb91598d68c6620ed71bce5f9dc3bb84c4f3117d5db358ac
|
File details
Details for the file pyqcoda-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pyqcoda-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d7fb13a6817d42db4dbd6b42993293b4401ae2cff6f4a49118559d40015b3e7
|
|
| MD5 |
2a2ada960d914575f1a65aa55e31ef3e
|
|
| BLAKE2b-256 |
a31a842e24e8313f6ad4125c430750419e8cef79950bfb1c7db34f61533dde5c
|