githubEdit

Query Structure

Overview

A forecast query to the data endpoint is a JSON object that specifies:

  1. What data you want (models, variables)

  2. Where you want it (geographic filter)

  3. When you want it (temporal filter)

  4. How to process it (aggregation, grouping, weighting)

  5. How to return it (format, ordering, pagination)

Basic Query Structure

{
  "models": ["ept2"],
  "geo": { ... },
  "init_time": "latest",
  "variables": [ ... ],
  "prediction_timedelta": { ... },
  ...
}

Required Parameters

Every query must include these three parameters:

models (required)

List of forecast model identifiers to query.

Type: array of strings Minimum length: 1

Multiple models:

You can find an overview of the available models here.

circle-info

Use GET /v1/forecast/meta to fetch available models and supported variables programmatically


geo (required)

Geographic filter specifying where to query data.

Type: object Structure:

See Geographic Filtering section below for details.


init_time (required)

Forecast initialization time(s).

Type: string | array | object

Options:

  1. Latest forecast:

  2. Specific datetime (ISO 8601 format):

  3. List of datetimes:

  4. Time range:


Geographic Filtering

The geo parameter supports five types of geographic queries.

1. Point Query

Query at specific coordinate(s).

Coordinates: [latitude, longitude]

Single point:

Multiple points:

Interpolation methods:

  • "nearest" (default): Returns value from nearest grid point

  • "bilinear": Interpolates between 4 surrounding grid points


2. Bounding Box

Query a rectangular region.

Format: [[lat_min, lon_min], [lat_max, lon_max]]

This queries all grid points within the rectangle from (45°N, 5°E) to (50°N, 15°E).

circle-exclamation

3. Polygon

Query data within a custom polygon area.

Format: Array of [latitude, longitude] coordinates defining the polygon boundary.

Requirements:

  • Minimum 4 points (3 unique vertices + closing point)

  • Polygon should follow counter-clockwise ordering

circle-exclamation

4. Market Zone

Query data for predefined energy market zones.

Format: String or array of market zone codes

Multiple market zones:

circle-exclamation

5. Country

Query data for entire countries.

Format: ISO country codes

Multiple countries:

circle-exclamation

Temporal Filtering

Control which forecast times to retrieve using temporal filters.

Forecast Time Concepts

  • init_time (required): When the forecast was generated

  • prediction_timedelta: How far ahead from init_time (lead time)

  • time: Absolute forecast valid time (init_time + prediction_timedelta)

prediction_timedelta (optional)

Forecast lead time from initialization.

Units: Controlled by timedelta_unit parameter (default: "h" for hours)

circle-info

The timedelta_unit also affects the unit in which prediction_timedelta is returned

Single value:

List of values:

Range:

If omitted: Returns all available lead times for the specified init_time(s).

circle-exclamation

time (optional)

Filter by absolute forecast valid time.

Single datetime:

List of datetimes:

Time range:

circle-info

time and prediction_timedelta are complementary ways to filter temporal data. You can use either or both.

You can use time with multiple init_time to compare how the forecast for a given point in time has changed.


timedelta_unit (optional)

Units for prediction_timedelta and latest_min_prediction_timedelta.

Type: string Default: "h" (hours)

Supported values:

  • "m", "minute", "minutes" - Minutes

  • "h", "hour", "hours" - Hours

  • "d", "day", "days" - Days

Example:


latest_min_prediction_timedelta (optional)

When using init_time: "latest", only include forecasts with at least this much lead time available.

Example:

This is useful when you need a minimum forecast horizon regardless of when the forecast was generated.


Variable Selection

variables (optional)

Weather variables to retrieve.

Type: array of strings Default: All variables available for the selected models

Common variables:

  • air_temperature_at_height_level_2m - Temperature at 2m (Kelvin)

  • wind_speed_at_height_level_10m - Wind speed at 10m (m/s)

  • wind_speed_at_height_level_100m - Wind speed at 100m (m/s)

  • relative_humidity_at_height_level_2m - Relative humidity (%)

  • precipitation_amount_sum_1h - 1-hour accumulated precipitation (mm)

  • surface_downwelling_shortwave_flux_sum_1h - Solar radiation (W/m²)

  • air_pressure_at_mean_sea_level - Sea level pressure (Pa)

  • And many more...

circle-info

You can always query /v1/forecasts/meta to check the available variables per model.

If omitted: Returns all variables common to the selected models.

circle-exclamation

Aggregation and Grouping

Aggregate data across space and/or time using group_by and aggregation.

Concept

  • group_by: Dimensions to preserve in the result

  • aggregation: How to aggregate values within each group

group_by (optional)

Dimensions to group by.

Type: array of strings

Supported dimensions:

  • "model" - Model identifier

  • "init_time" - Forecast initialization time

  • "time" - Forecast valid time

  • "prediction_timedelta" - Lead time

  • "latitude" - Latitude coordinate

  • "longitude" - Longitude coordinate

  • "point" - Equivalent to settings both latitude and longitude . Useful for ensemble models where you are interested in statistics per location (e.g. min, max, std)

  • "market_zone" - Market zone (when using geo type market_zone)

  • "country_key" - Country (when using geo type country_key)

Time transformations:

  • "time__to_start_of(hour)" or "hourly" - Grouped by start of hour

  • "time__to_start_of(day)" or "daily" - Grouped by start of day

  • "time__to_start_of(week)" or "weekly" - Grouped by start of week

  • "time__to_start_of(month)" or "monthly" - Grouped by start of month

  • "time__to_start_of(year)" or "yearly" - Grouped by start of year

  • Same transformations available for init_time

circle-info

You can use time transformations to get for example the daily min & max temperature for a given location. Make sure to set time_zone to get the data group by the start-of-day in the region you are interested in.

Example - Average over all grid points for each valid time:

Example - Daily min & max:

circle-info

Aggregation is required when using group_by. Per default avg is used.


aggregation (optional)

Aggregation functions to apply when grouping.

Type: array of objects or strings

Supported functions:

  • "avg" - Average

  • "std" - Standard deviation

  • "min" - Minimum

  • "max" - Maximum

  • "sum" - Sum

  • "count" - Count

  • "median" - Median

  • "quantile" - Quantile (requires parameter)

Simple aggregation (all variables):

Multiple aggregations:

Variable-specific aggregation:

Parameterized aggregation (quantile):

Short syntax for parameterized aggregation:

circle-exclamation

Common Aggregation Patterns

1. Spatial average at each timestep:

2. Daily maximum over a region:

3. Statistics at a specific location (for ensemble models, e.g. ept2_e):


Weighting

Apply weighted aggregation based on capacity or population distribution.

weighting (optional)

Type: object

Structure:

Weighting types:

  1. wind_capacity - Weight by installed wind power capacity

  2. solar_capacity - Weight by installed solar power capacity

  3. population - Weight by population density

Example - Wind capacity-weighted average:

This computes the wind speed weighted by where wind turbines are located, giving more weight to regions with higher wind capacity and less weight to regions without production capacity.

circle-exclamation

Output Control

Control how results are formatted and returned.

include_time (optional)

Include the forecast valid time column in results.

Type: boolean Default: false

Result with include_time: true:

circle-info

Automatically set to true if time is in group_by or order_by.


time_zone (optional)

IANA time zone for time formatting.

Type: string Default: "UTC"

Common time zones:

  • "UTC" (default)

  • "Europe/Berlin"

  • "America/New_York"

  • "America/Los_Angeles"

  • "Asia/Tokyo"

All time in responses are formatted in the specified time zone.

circle-exclamation

order_by (optional)

Sort results by specific dimensions.

Type: array of strings

Sortable dimensions:

  • "model"

  • "init_time"

  • "time"

  • "prediction_timedelta"

  • "latitude"

  • "longitude"

  • Any variable name (e.g., "air_temperature_at_height_level_2m")

Constraints:

  • When using group_by, order_by dimensions must be in the group_by list

  • Required when using pagination


pagination (optional)

Limit the number of results returned.

Type: object

Structure:

Example - Get first 1000 rows:

Example - Get next 1000 rows:

circle-exclamation

Best Practices

Performance

  1. Use Arrow format for large queries: Set ?format=arrow in the URL for queries returning >10k rows

  2. Enable streaming for very large queries: Add &stream=true with Arrow format for >100k rows

  3. Limit prediction_timedelta range: Request only the lead times you need

  4. Split historical data into multiple requests: Fetch data in chunks

Cost Optimization

  1. Estimate costs first: Use POST /v1/forecast/cost before running expensive queries

  2. Set request_credit_limit: Prevents accidentally expensive queries (default: 50 credits)

  3. Aggregate when possible: Grouped queries accessing many points cost less per point

  4. Select specific variables: Don't request all variables if you only need a few

Query Construction

  1. Use group_by for spatial aggregates: When querying regions, group by time dimensions

  2. Include time in results: Set include_time: true for easier result interpretation

  3. Specify time zones: Use time_zone to get times in your local timezone

  4. Order results: Use order_by for predictable result ordering

  5. Test with small queries first: Start with short time ranges, then expand


Validation and Errors

The API validates all query parameters and returns helpful error messages.

Common validation errors:

  • Invalid model: Model not available or not in your subscription

  • Variable not supported: Variable not available for selected model(s)

  • Invalid geo filter: Geographic coordinates out of range

  • Missing required parameter: Required field not provided

  • Insufficient credits: Not enough credits for the query

  • Response too large: Query returns too many rows


Next Steps

Last updated