Skip to main content

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 Q-CODA (Quasi-Comonotonicity-based Disaggregation Algorithm), 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 columns datetime (hourly resolution) and precipitation (mm).
    • test_data.csv: Daily precipitation data with the same column names but daily resolution (datetime at 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 from train_data.

✨ 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, 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

pyqcoda-1.0.3.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqcoda-1.0.3-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file pyqcoda-1.0.3.tar.gz.

File metadata

  • Download URL: pyqcoda-1.0.3.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.4

File hashes

Hashes for pyqcoda-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f29a40280c91c46f386320f44e34122fac295bb426a6b628f2c064b4378f59e5
MD5 7be42c6dd2b08c357db34ed8afd0f226
BLAKE2b-256 dab63e8bf3a6b3a5d4739fa17d226f2b04299e728234839bf15c638cd5a61bc3

See more details on using hashes here.

File details

Details for the file pyqcoda-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: pyqcoda-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.4

File hashes

Hashes for pyqcoda-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1edf012736e5156c98adb3ebd415264443a051fc57c94229456ecd037ccc6296
MD5 3b37912b44c86750f1101858e1077cbd
BLAKE2b-256 dfd93be8546fdd5892bfbf79f9360e5648ea5dfc1a6ddafcd0513a3989b5b494

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page