flexmeasures.data.queries.analytics

Functions

flexmeasures.data.queries.analytics.get_power_data(resource: str | Resource, show_consumption_as_positive: bool, showing_individual_traces_for: str, metrics: dict, query_window: Tuple[datetime, datetime], resolution: str, forecast_horizon: timedelta) Tuple[DataFrame, DataFrame, DataFrame, dict]

Get power data and metrics.

Return power observations, power forecasts and power schedules (each might be an empty DataFrame) and a dict with the following metrics: - expected value - mean absolute error - mean absolute percentage error - weighted absolute percentage error

Todo: Power schedules ignore horizon.

flexmeasures.data.queries.analytics.get_prices_data(metrics: dict, market_sensor: Sensor, query_window: Tuple[datetime, datetime], resolution: str, forecast_horizon: timedelta) Tuple[DataFrame, DataFrame, dict]

Get price data and metrics.

Return price observations, price forecasts (either might be an empty DataFrame) and a dict with the following metrics: - expected value - mean absolute error - mean absolute percentage error - weighted absolute percentage error

flexmeasures.data.queries.analytics.get_revenues_costs_data(power_data: DataFrame, prices_data: DataFrame, power_forecast_data: DataFrame, prices_forecast_data: DataFrame, metrics: Dict[str, float], unit_factor: float, resolution: str, showing_individual_traces: bool) Tuple[DataFrame, DataFrame, dict]

Compute revenues/costs data. These data are purely derivative from power and prices. For forecasts we use the WAPE metrics. Then we calculate metrics on this construct. The unit factor is used when multiplying quantities and prices, e.g. when multiplying quantities in kWh with prices in EUR/MWh, use a unit factor of 0.001.

Return revenue/cost observations, revenue/cost forecasts (either might be an empty DataFrame) and a dict with the following metrics: - expected value - mean absolute error - mean absolute percentage error - weighted absolute percentage error

flexmeasures.data.queries.analytics.get_weather_data(assets: List[Asset], metrics: dict, sensor_type: WeatherSensorType, query_window: Tuple[datetime, datetime], resolution: str, forecast_horizon: timedelta) Tuple[DataFrame, DataFrame, str, Sensor, dict]

Get most recent weather data and forecast weather data for the requested forecast horizon.

Return weather observations, weather forecasts (either might be an empty DataFrame), the name of the sensor type, the weather sensor and a dict with the following metrics: - expected value - mean absolute error - mean absolute percentage error - weighted absolute percentage error