Solar production and power consumption forecasting package.
Project description
☀️ KPower Forecast 📈
Production-grade solar production and power consumption forecasting.
Built with Facebook Prophet and powered by Open-Meteo. KPower Forecast provides a high-level API for training and predicting energy metrics with physics-informed corrections.
✨ Key Features
- 🔋 Dual Mode: Specialized logic for both Solar Production and Energy Consumption.
- 🌓 Night Masking: Physics-informed clamping using solar elevation to eliminate "ghost production" at night.
- 🌡️ Weather Integration: Automatic fetching and resampling of temperature, cloud cover, and radiation.
- 🤖 Prophet Optimized: Pre-configured regressors for maximum accuracy.
- 💾 Smart Persistence: Automatic serialization of models to skip retraining when possible.
- ❄️ Heat Pump Mode: Optional temperature correlation for energy consumption models.
🚀 Quick Start
Installation
pip install kpower-forecast
☀️ Solar Production Forecast
from kpower_forecast import KPowerForecast
import pandas as pd
# 1. Initialize for your location
kp = KPowerForecast(
model_id="rooftop_solar",
latitude=46.0569,
longitude=14.5058,
forecast_type="solar"
)
# 2. Train with your history
# history_df = pd.DataFrame({'ds': [...], 'y': [...]})
# kp.train(history_df)
# 3. Predict the next 7 days
forecast = kp.predict(days=7)
print(forecast[['ds', 'yhat']].head())
🏠 Energy Consumption Forecast
kp_cons = KPowerForecast(
model_id="house_meter",
latitude=46.0569,
longitude=14.5058,
forecast_type="consumption",
heat_pump_mode=True # Accounts for heating/cooling loads
)
🛠️ Advanced Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
model_id |
str |
required | Unique ID for model persistence |
latitude |
float |
required | Location Latitude |
longitude |
float |
required | Location Longitude |
interval_minutes |
`int" | 15 |
Data resolution (15 or 60) |
storage_path |
str |
"./data" |
Directory for saved models |
heat_pump_mode |
bool |
False |
Enable temperature regressor for consumption |
🔢 Versioning
This project follows a custom Date-Based Versioning scheme:
YYYY.MM.Patch (e.g., 2026.2.1)
- YYYY: Year of release.
- MM: Month of release (no leading zero, 1-12).
- Patch: Incremental counter for releases within the same month.
Enforcement
- CI Validation: Every Pull Request is checked against
scripts/validate_version.pyto ensure adherence. - Consistency: Both
pyproject.tomlandsrc/kpower_forecast/__init__.pymust match exactly.
🧪 Development & Testing
We use uv for lightning-fast dependency management.
# Clone and setup
git clone https://github.com/akorenc/kpower-forecast
cd kpower-forecast
uv sync --all-extras
# Run tests
uv run pytest
# Linting
uv run ruff check .
📄 License
Distributed under the GNU Affero General Public License v3.0. See LICENSE for more information.
Made with ❤️ for a greener future.
Project details
Release history Release notifications | RSS feed
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 kpower_forecast-2026.2.1.tar.gz.
File metadata
- Download URL: kpower_forecast-2026.2.1.tar.gz
- Upload date:
- Size: 85.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6e2fff3f701c2bc3caed2e1012d0e76375d4b7f0a49e9f3bc66d769a4b1defb
|
|
| MD5 |
2676382fa295500e76b857c0414d1e2c
|
|
| BLAKE2b-256 |
a4f3b8372fb9e47e5c4bb6ef967ca7b1e3bc7b67c835da038f748b4662ee4438
|
File details
Details for the file kpower_forecast-2026.2.1-py3-none-any.whl.
File metadata
- Download URL: kpower_forecast-2026.2.1-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5625b4c3d6ae6ca6e5650e945ba83ee89a203dc116a7ddc13018516d5a0a5b3a
|
|
| MD5 |
9446d555155e26cf06ab51b7e024160a
|
|
| BLAKE2b-256 |
b814c3c5b3dbe4dbfb85a9dfad40b41fb05fe8b409fe8657eabb0760f6f11208
|