Regional Queries
Regional queries without aggregation can end-up consuming a lot of credits. The request_credit_limit was increased for all of the example queries.
Use with care!
Countries & Market Zones
Country
query = {
"models": ["ept2"],
"geo": {
"type": "country_key",
"value": "CH", # Switzerland
},
"variables": ["air_temperature_at_height_level_2m"],
"init_time": "latest",
"prediction_timedelta": [0, 24, 48], # 0, 1 day, 2 days
"order_by": [
"model",
"init_time",
"prediction_timedelta",
"latitude",
"longitude",
],
}
# 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']}")
# Query parameters for arrow format and credit limit
params = {"format": "arrow", "request_credit_limit": 100}
response = requests.post(url, headers=headers, json=query, params=params)
response.raise_for_status()
# Read arrow format response
arrow_buffer = pa.py_buffer(response.content)
with pa_ipc.open_stream(arrow_buffer) as reader:
table = reader.read_all()
df = table.to_pandas()
print(f"✅ Retrieved {len(df)} rows for Switzerland")
print(df.head())Estimated cost: 77.2200 credits
Rows to return: 2106
Rows to access: 2106
✅ Retrieved 2106 rows for Switzerland
model init_time ... longitude air_temperature_at_height_level_2m
0 ept2 2025-10-23 06:00:00 ... 8.916667 284.200012
1 ept2 2025-10-23 06:00:00 ... 7.083333 273.100006
2 ept2 2025-10-23 06:00:00 ... 7.166667 273.300018
3 ept2 2025-10-23 06:00:00 ... 7.250000 273.100006
4 ept2 2025-10-23 06:00:00 ... 8.916667 283.899994
[5 rows x 6 columns]Market Zone
query = {
"models": ["ept2"],
"geo": {
"type": "market_zone",
"value": ["GB-NIR"], # Ireland and Northern Ireland
},
"variables": ["wind_speed_at_height_level_100m"],
"init_time": "latest",
"prediction_timedelta": [0, 24], # 0 and 1 day ahead
"order_by": [
"model",
"init_time",
"prediction_timedelta",
"latitude",
"longitude",
],
}
# 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']}")
# Query parameters for arrow format and credit limit
params = {"format": "arrow", "request_credit_limit": 100}
response = requests.post(url, headers=headers, json=query, params=params)
response.raise_for_status()
# Read arrow format response
arrow_buffer = pa.py_buffer(response.content)
with pa_ipc.open_stream(arrow_buffer) as reader:
table = reader.read_all()
df = table.to_pandas()
print(f"✅ Retrieved {len(df)} rows for Ireland and Northern Ireland")
print(df.head())
return dfEstimated cost: 34.6060 credits
Rows to return: 572
Rows to access: 572
✅ Retrieved 572 rows for Ireland and Northern Ireland
model init_time ... longitude wind_speed_at_height_level_100m
0 ept2 2025-10-23 06:00:00 ... -6.666667 10.300000
1 ept2 2025-10-23 06:00:00 ... -6.583333 10.200000
2 ept2 2025-10-23 06:00:00 ... -6.500000 9.900001
3 ept2 2025-10-23 06:00:00 ... -6.416667 9.900001
4 ept2 2025-10-23 06:00:00 ... -6.166667 9.900001
[5 rows x 6 columns]Bounding Boxes
query = {
"models": ["ept2"],
"geo": {
"type": "bounding_box",
"value": [
[
[45.8, 5.9], # [lat_min, lon_min] - Southwest corner
[47.8, 10.5], # [lat_max, lon_max] - Northeast corner
]
], # Switzerland region
},
"variables": ["air_temperature_at_height_level_2m"],
"init_time": "latest",
"prediction_timedelta": [0], # IC only
"order_by": [
"model",
"init_time",
"prediction_timedelta",
"latitude",
"longitude",
],
}
# 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']}")
# Query parameters for arrow format and credit limit
params = {"format": "arrow", "request_credit_limit": 150}
response = requests.post(url, headers=headers, json=query, params=params)
response.raise_for_status()
# Read arrow format response
arrow_buffer = pa.py_buffer(response.content)
with pa_ipc.open_stream(arrow_buffer) as reader:
table = reader.read_all()
df = table.to_pandas()
print(f"✅ Retrieved {len(df)} rows for bounding box")
print(df.head())
return dfEstimated cost: 147.8400 credits
Rows to return: 1344
Rows to access: 1344
✅ Retrieved 1344 rows for bounding box
model init_time ... longitude air_temperature_at_height_level_2m
0 ept2 2025-10-23 06:00:00 ... 5.916667 287.000000
1 ept2 2025-10-23 06:00:00 ... 6.000000 286.700012
2 ept2 2025-10-23 06:00:00 ... 6.083333 286.200012
3 ept2 2025-10-23 06:00:00 ... 6.166667 285.399994
4 ept2 2025-10-23 06:00:00 ... 6.250000 284.200012
[5 rows x 6 columns]Polygons
query = {
"models": ["ept2"],
"geo": {
"type": "polygon",
"value": [
[
[47.3, 8.0], # Southwest corner
[47.6, 8.0], # Northwest corner
[47.6, 8.8], # Northeast corner
[47.3, 8.8], # Southeast corner
[47.3, 8.0], # Close the polygon (same as first point)
]
], # Polygon around Zurich region
},
"variables": [
"air_temperature_at_height_level_2m",
],
"init_time": "latest",
"prediction_timedelta": [0], # IC only
"order_by": [
"model",
"init_time",
"prediction_timedelta",
"latitude",
"longitude",
],
}
# 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']}")
# Query parameters for arrow format and credit limit
params = {"format": "arrow", "request_credit_limit": 100}
response = requests.post(url, headers=headers, json=query, params=params)
response.raise_for_status()
# Read arrow format response
arrow_buffer = pa.py_buffer(response.content)
with pa_ipc.open_stream(arrow_buffer) as reader:
table = reader.read_all()
df = table.to_pandas()
print(f"✅ Retrieved {len(df)} rows for polygon")
print(df.head())
return dfEstimated cost: 4.4000 credits
Rows to return: 40
Rows to access: 40
✅ Retrieved 40 rows for polygon
model init_time ... longitude air_temperature_at_height_level_2m
0 ept2 2025-10-23 06:00:00 ... 8.000000 285.100006
1 ept2 2025-10-23 06:00:00 ... 8.083333 284.600006
2 ept2 2025-10-23 06:00:00 ... 8.166667 284.200012
3 ept2 2025-10-23 06:00:00 ... 8.250000 283.899994
4 ept2 2025-10-23 06:00:00 ... 8.333333 283.800018
[5 rows x 6 columns]Last updated