githubEdit

Regional Queries

circle-exclamation

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())

Market Zone

Bounding Boxes

Polygons

Last updated