Aggregated Queries
Daily Min & Max for a location
query = {
"models": ["ept2"],
"geo": {
"type": "point",
"value": [47.3784, 8.5387], # [longitude, latitude] - Zurich
"method": "nearest",
},
"variables": [
"air_temperature_at_height_level_2m",
"wind_speed_at_height_level_100m",
],
"init_time": "latest",
"prediction_timedelta": {"start": 0, "end": 72}, # 0-72 hours ahead
}
# Estimate cost before executing
cost_response = requests.post(cost_url, headers=headers, json=query)
cost_response.raise_for_status()
cost_info = cost_response.json()
print(f"Estimated cost: {cost_info['total_credits_needed']:.4f} credits")
print(f"Rows to return: {cost_info['total_rows_returned']}")
print(f"Rows to access: {cost_info['total_rows_accessed']}")
response = requests.post(url, headers=headers, json=query)
response.raise_for_status()
data = response.json()
df = pd.DataFrame(data)
print(f"✅ Retrieved {len(df)} rows")
print(df.head())Estimated cost: 0.1320 credits
Rows to return: 73
Rows to access: 73
✅ Retrieved 73 rows
model init_time ... air_temperature_at_height_level_2m wind_speed_at_height_level_100m
0 ept2 2025-10-23T06:00:00Z ... 284.600006 4.7
1 ept2 2025-10-23T06:00:00Z ... 285.399994 5.0
2 ept2 2025-10-23T06:00:00Z ... 286.399994 4.8
3 ept2 2025-10-23T06:00:00Z ... 286.500000 9.3
4 ept2 2025-10-23T06:00:00Z ... 284.800018 10.8
[5 rows x 7 columns]Hourly Wind Statistics in Germany
query = {
"models": ["ept2"],
"geo": {
"type": "market_zone",
"value": "DE", # Germany
},
"variables": ["wind_speed_at_height_level_100m"],
"init_time": "latest",
"prediction_timedelta": {"start": 0, "end": 72}, # 3 days
"group_by": [
{
# Explicit use of the "to_start_of" transformation
"field": "time",
"transformation": "to_start_of",
"parameters_list": ["hour"],
}
],
"aggregation": [
{"aggregation": "max"},
"min",
"avg",
"std",
"quantile_(0.05)",
"quantile_(0.95)",
],
"include_time": True,
"order_by": ["time"],
}
# Estimate cost before executing
cost_response = requests.post(cost_url, headers=headers, json=query)
cost_response.raise_for_status()
cost_info = cost_response.json()
print(f"Estimated cost: {cost_info['total_credits_needed']:.4f} credits")
print(f"Rows to return: {cost_info['total_rows_returned']}")
print(f"Rows to access: {cost_info['total_rows_accessed']}")
response = requests.post(url, headers=headers, json=query)
response.raise_for_status()
data = response.json()
df = pd.DataFrame(data)
print(f"Retrieved {len(df)} rows")
print(df.head(20))
return dfEstimated cost: 3.8475 credits
Rows to return: 73
Rows to access: 480121
Retrieved 73 rows
time max__wind_speed_at_height_level_100m min__wind_speed_at_height_level_100m ... std__wind_speed_at_height_level_100m quantile_(0.05)__wind_speed_at_height_level_100m quantile_(0.95)__wind_speed_at_height_level_100m
0 2025-10-23T06:00:00Z 16.500000 2.2 ... 1.972303 6.400000 13.000000
1 2025-10-23T07:00:00Z 14.400001 4.3 ... 1.616050 6.800000 12.300000
2 2025-10-23T08:00:00Z 14.200000 4.4 ... 1.601147 6.600000 12.100000
3 2025-10-23T09:00:00Z 14.300000 3.5 ... 1.763546 5.900000 12.100000
4 2025-10-23T10:00:00Z 14.800000 2.5 ... 1.986278 4.800000 12.100000
5 2025-10-23T11:00:00Z 16.900000 0.8 ... 2.325559 4.300000 13.200000
6 2025-10-23T12:00:00Z 18.500000 0.3 ... 2.384850 7.200000 14.200000
7 2025-10-23T13:00:00Z 18.400000 3.0 ... 2.306951 7.400000 15.000000
8 2025-10-23T14:00:00Z 18.700001 2.8 ... 2.426426 7.300000 15.200000
9 2025-10-23T15:00:00Z 18.700001 2.0 ... 2.556340 7.100000 15.200000
10 2025-10-23T16:00:00Z 18.900000 2.0 ... 2.614214 7.100000 15.300000
11 2025-10-23T17:00:00Z 18.200001 2.1 ... 2.600091 7.500000 15.400001
12 2025-10-23T18:00:00Z 17.100000 2.4 ... 2.495059 7.600000 15.500000
13 2025-10-23T19:00:00Z 16.600000 3.0 ... 2.329726 7.900000 15.500000
14 2025-10-23T20:00:00Z 16.500000 3.0 ... 2.047417 8.500000 15.000000
15 2025-10-23T21:00:00Z 15.800000 3.4 ... 1.769095 8.700000 14.700000
16 2025-10-23T22:00:00Z 15.900001 3.8 ... 1.552549 8.800000 14.100000
17 2025-10-23T23:00:00Z 17.100000 4.1 ... 1.521312 8.900001 13.900001
18 2025-10-24T00:00:00Z 17.900000 4.1 ... 1.475617 9.000000 13.600000
19 2025-10-24T01:00:00Z 18.200001 4.4 ... 1.409908 9.200000 13.500000
[20 rows x 7 columns]Capacity Weighted Average Wind Speed in Germany
query = {
"models": ["ept2"],
"geo": {
"type": "market_zone",
"value": "DE", # Germany
},
"variables": ["wind_speed_at_height_level_100m"],
"init_time": "latest",
"prediction_timedelta": {"start": 0, "end": 72}, # 3 days
"weighting": {"type": "wind_capacity"},
"group_by": [
{
"field": "time",
"transformation": "to_start_of",
"parameters_list": ["hour"],
}
],
"aggregation": [{"aggregation": "avg"}],
"include_time": True,
"order_by": ["time"],
}
# Estimate cost before executing
cost_response = requests.post(cost_url, headers=headers, json=query)
cost_response.raise_for_status()
cost_info = cost_response.json()
print(f"Estimated cost: {cost_info['total_credits_needed']:.4f} credits")
print(f"Rows to return: {cost_info['total_rows_returned']}")
print(f"Rows to access: {cost_info['total_rows_accessed']}")
response = requests.post(url, headers=headers, json=query)
response.raise_for_status()
data = response.json()
df = pd.DataFrame(data)
print(f"Retrieved {len(df)} rows")
print(df.head(20))Estimated cost: 4.4246 credits
Rows to return: 73
Rows to access: 480121
Retrieved 73 rows
time avg__wind_speed_at_height_level_100m
0 2025-10-23T06:00:00Z 10.473292
1 2025-10-23T07:00:00Z 10.559825
2 2025-10-23T08:00:00Z 10.471903
3 2025-10-23T09:00:00Z 10.234161
4 2025-10-23T10:00:00Z 9.740825
5 2025-10-23T11:00:00Z 9.817058
6 2025-10-23T12:00:00Z 9.906179
7 2025-10-23T13:00:00Z 10.051497
8 2025-10-23T14:00:00Z 10.096489
9 2025-10-23T15:00:00Z 10.191436
10 2025-10-23T16:00:00Z 10.326234
11 2025-10-23T17:00:00Z 10.489385
12 2025-10-23T18:00:00Z 10.661165
13 2025-10-23T19:00:00Z 10.938301
14 2025-10-23T20:00:00Z 11.160419
15 2025-10-23T21:00:00Z 11.237437
16 2025-10-23T22:00:00Z 11.150809
17 2025-10-23T23:00:00Z 11.313920
18 2025-10-24T00:00:00Z 11.484743
19 2025-10-24T01:00:00Z 11.695437Capacity Weighted Average in a Polygon
query = {
"models": ["ept2"],
"geo": {
"type": "polygon",
"value": [
[
[53.0, 8.0],
[53.0, 12.0],
[55.0, 12.0],
[55.0, 8.0],
[53.0, 8.0],
]
],
},
"variables": ["wind_speed_at_height_level_100m"],
"init_time": "latest",
"prediction_timedelta": {"start": 0, "end": 48}, # 2 days
"weighting": {"type": "wind_capacity"},
"group_by": [
{
"field": "time",
"transformation": "to_start_of",
"parameters_list": ["hour"],
}
],
"aggregation": [{"aggregation": "avg"}],
"include_time": True,
"order_by": ["time"],
}
# Estimate cost before executing
cost_response = requests.post(cost_url, headers=headers, json=query)
cost_response.raise_for_status()
cost_info = cost_response.json()
print(f"Estimated cost: {cost_info['total_credits_needed']:.4f} credits")
print(f"Rows to return: {cost_info['total_rows_returned']}")
print(f"Rows to access: {cost_info['total_rows_accessed']}")
response = requests.post(url, headers=headers, json=query)
response.raise_for_status()
data = response.json()
df = pd.DataFrame(data)
print(f"Retrieved {len(df)} rows")
print(df.head(20))Estimated cost: 1.6384 credits
Rows to return: 49
Rows to access: 60025
Retrieved 49 rows
time avg__wind_speed_at_height_level_100m
0 2025-10-23T06:00:00Z 11.385012
1 2025-10-23T07:00:00Z 11.701327
2 2025-10-23T08:00:00Z 11.644365
3 2025-10-23T09:00:00Z 11.242075
4 2025-10-23T10:00:00Z 10.356984
5 2025-10-23T11:00:00Z 9.627563
6 2025-10-23T12:00:00Z 8.863163
7 2025-10-23T13:00:00Z 8.323935
8 2025-10-23T14:00:00Z 7.914524
9 2025-10-23T15:00:00Z 7.662574
10 2025-10-23T16:00:00Z 7.734694
11 2025-10-23T17:00:00Z 8.140329
12 2025-10-23T18:00:00Z 8.584207
13 2025-10-23T19:00:00Z 8.879365
14 2025-10-23T20:00:00Z 9.181939
15 2025-10-23T21:00:00Z 9.383254
16 2025-10-23T22:00:00Z 9.735419
17 2025-10-23T23:00:00Z 10.298345
18 2025-10-24T00:00:00Z 10.977109
19 2025-10-24T01:00:00Z 11.730488Last updated