entsoe_cli

entsoe_cli

Unified CLI for the ENTSO-E single-target forecasting pipeline.

Drives the pipeline directly through spotforecast2.multitask.multi.MultiTask with ConfigEntsoe plugged in via the data_loader and forecaster_factory hooks introduced in ADR-001. The data loaders live in spotforecast2_safe.data.entsoe_loader; the LightGBM factory is the stock spotforecast2_safe.multitask.factories.default_lgbm_forecaster_factory. The CLI exposes four subcommands:

Usage::

spotforecast2-entsoe download --api-key <KEY>
spotforecast2-entsoe train lgbm
spotforecast2-entsoe predict lgbm --plot

Environment Variables

ENTSOE_API_KEY: API key for the ENTSO-E Transparency Platform.

Functions

Name Description
entsoe_xgb_factory XGBoost ForecasterRecursive for the ENTSO-E pipeline.
main Entry point for the spotforecast2-entsoe console script.

entsoe_xgb_factory

entsoe_cli.entsoe_xgb_factory(config, *, weight_func=None, target=None)

XGBoost ForecasterRecursive for the ENTSO-E pipeline.

Mirrors spotforecast2_safe.multitask.factories.default_lgbm_forecaster_factory but uses an XGBRegressor estimator. Lives here rather than in the safe package because xgboost is not a safe-package dependency.

Parameters

Name Type Description Default
config ConfigEntsoe Any object exposing random_state, lags_consider, and window_size (typically ConfigEntsoe). required
weight_func Optional[Any] Per-sample weight function from the imputation step. None
target Optional[str] Ignored; accepted for factory-signature compatibility. None

Examples

from spotforecast2_safe.configurator import ConfigEntsoe
from spotforecast2_safe.forecaster.recursive import ForecasterRecursive
from xgboost import XGBRegressor

from spotforecast2.entsoe_cli import entsoe_xgb_factory

config = ConfigEntsoe()
forecaster = entsoe_xgb_factory(config, weight_func=None, target="Actual Load")

print(type(forecaster).__name__)
assert isinstance(forecaster, ForecasterRecursive)
assert isinstance(forecaster.estimator, XGBRegressor)
print("lags:", forecaster.lags)
ForecasterRecursive
lags: [ 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23]

main

entsoe_cli.main()

Entry point for the spotforecast2-entsoe console script.

Parses sys.argv and dispatches to one of four subcommands: download, merge, train, or predict. Calling with no subcommand prints the top-level help and returns.

Examples

import sys

from spotforecast2.entsoe_cli import main

# With no subcommand, main() prints the usage summary and returns
# without error — useful for verifying the CLI is wired correctly.
sys.argv = ["spotforecast2-entsoe"]
main()  # prints usage and returns normally
usage: spotforecast2-entsoe [-h] {download,train,predict,merge} ...

spotforecast2 ENTSO-E pipeline

positional arguments:
  {download,train,predict,merge}
    download            Download raw ENTSO-E data
    train               Train a forecaster
    predict             Predict with a saved forecaster
    merge               Merge raw CSVs into the interim file

options:
  -h, --help            show this help message and exit