Skip to main content

Solar production and power consumption forecasting package.

Project description

☀️ KPower Forecast 📈

PyPI version Python versions CI License: AGPL-3.0 Code style: black

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

🧪 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kpower_forecast-2026.2.0.tar.gz (77.3 kB view details)

Uploaded Source

Built Distribution

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

kpower_forecast-2026.2.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file kpower_forecast-2026.2.0.tar.gz.

File metadata

  • Download URL: kpower_forecast-2026.2.0.tar.gz
  • Upload date:
  • Size: 77.3 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

Hashes for kpower_forecast-2026.2.0.tar.gz
Algorithm Hash digest
SHA256 2ee1b9ec689c6138ffe324987b21b2b444c9f8d0945806f5d660374f6ff882f8
MD5 1cca1e138d596c448ad83e0e461f2834
BLAKE2b-256 efafd98663abae7384e787364a0ac9df4078cb1ab35b92e530c2013f33b54c79

See more details on using hashes here.

File details

Details for the file kpower_forecast-2026.2.0-py3-none-any.whl.

File metadata

  • Download URL: kpower_forecast-2026.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 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

Hashes for kpower_forecast-2026.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a0f9df7c31907ac7f7e837420f0eaa5f24b13930493574e6b884a24c76d137b
MD5 c965c5b31ebeebffbdccc703af3aa85d
BLAKE2b-256 8be9f1f20fff36a63a5eb4cd55ef2b07a7806025b1e342318370dd59e2df2374

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