githubEdit

Market Aggregates

Market aggregates, especially used with weighting such as capacity weighting, are useful proxies to estimate how differences in forecasts - either between models or between different forecasts of the same model - impact energy production & consumption. For more information about market aggregates, see the Market Aggregates page.

Market aggregates can be queried directly through the Jua Python SDK, using the MarketAggregates class.

Example

As an introduction to market aggregates in the SDK, see this simple example. For more examples, please see our GitHub repositoryarrow-up-right.

from datetime import datetime

import matplotlib.pyplot as plt
from jua import JuaClient
from jua.market_aggregates import AggregateVariables, ModelRuns
from jua.types import MarketZones
from jua.weather import Models

client = JuaClient()

# Create an energy market for specific zones
germany = client.market_aggregates.get_market(market_zone=MarketZones.DE)

# Select two EPT-2 forecasts and two ECMWF IFS forecasts to compare
model_runs = [
    ModelRuns(
        Models.EPT2, 
        [
            datetime(2025, 9, 29, 0),
            datetime(2025, 9, 29, 6),
        ]
    ),
    ModelRuns(
        Models.ECMWF_IFS_SINGLE, 
        [
            datetime(2025, 9, 29, 0),
            datetime(2025, 9, 29, 6),
        ]
    ),
]

# Retrieve the 2-day 10m wind market aggregates for Germany
# An xarray.Dataset is returned, containing the market aggregates
# for each model run
wind_data = germany.compare_runs(
    agg_variable=AggregateVariables.WIND_SPEED_AT_HEIGHT_LEVEL_10M,
    model_runs=model_runs,
    max_lead_time=48,
)

# Plot the 4 market aggregates using matplotlib
fig, ax = plt.subplots(figsize=(15, 5))
wind_data["wind_speed_at_height_level_10m"].plot(ax=ax, x="time", hue="model_run")
ax.set_title("10m Wind Market Aggregates: Germany")
plt.show()

This will plot the following:

Documentation

Aggregate Variables

The AggregateVariables enum provides the following variables:

  • AggregateVariables.WIND_SPEED_AT_HEIGHT_LEVEL_10M

  • AggregateVariables.WIND_SPEED_AT_HEIGHT_LEVEL_100M

  • AggregateVariables.SURFACE_DOWNWELLING_SHORTWAVE_FLUX_SUM_1H

  • AggregateVariables.AIR_TEMPERATURE_AT_HEIGHT_LEVEL_2M

Aggregate variables automatically uses the appropriate weighting from the Weighting enum:

  • Wind variables use Weighting.WIND_CAPACITY

  • Solar variables use Weighting.SOLAR_CAPACITY

  • Temperature uses Weighting.POPULATION

Example:

Energy Market

An EnergyMarket provides access to spatially aggregated forecast data for specific market zones. Data is weighted by the appropriate factor (wind capacity, solar capacity, or population) depending on the variable requested. This is useful for energy market analysis where you need regionally aggregated forecasts.

Examples:

Market Zones

The MarketZones is a simple helper Enum containing the available market zones for market aggregate queries.

Example:

Model Runs

ModelRuns is a simple data container that combines a weather model with one or more initialization times. The initialization times can be specified as datetime objects or as integer indices to select from recent runs. Integers from 0 to 12 can be used to select any of the 12 most recent initialization times:

  • 0: latest run

  • 1: second latest run

  • 2: third latest run, etc.

Example:

Country Aggregates

Some countries are split into different market zones. You can still obtain aggregates for the entire country with the following code.

Last updated