# Point Queries

### Single Point & Init Time

Check the weather for Zurich.

{% tabs %}
{% tab title="Example (Python)" %}

```python
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
}

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

{% endtab %}

{% tab title="Output" %}

```
✅ 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]
```

{% endtab %}
{% endtabs %}

### Multiple Points, Single Init Time

Get the latest forecast for three points of interest.

{% tabs %}
{% tab title="Python (Example)" %}

```python
points = [
    [47.3784, 8.5387],  # Zurich
    [46.2044, 6.1432],  # Geneva
    [45.4642, 9.1900],  # Milan
]

query = {
    "models": ["ept2"],
    "geo": {
        "type": "point",
        "value": points,
        "method": "bilinear",  # Use bilinear interpolation
    },
    "variables": [
        "air_temperature_at_height_level_2m",
        "air_pressure_at_mean_sea_level",
    ],
    "init_time": "latest",
    "prediction_timedelta": [
        0,
        1,
        2,
        3,
        24,
        48,
        72,
    ],  # Specific timesteps: 0, 1h, 2h, 3h
}

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

{% endtab %}

{% tab title="Output" %}

```
✅ Retrieved 21 rows
   model             init_time  ...  air_temperature_at_height_level_2m  air_pressure_at_mean_sea_level
0   ept2  2025-10-23T06:00:00Z  ...                          285.353058                    99202.460938
1   ept2  2025-10-23T06:00:00Z  ...                          286.886932                   100174.296875
2   ept2  2025-10-23T06:00:00Z  ...                          278.207947                   101294.437500
3   ept2  2025-10-23T06:00:00Z  ...                          286.374359                    99177.875000
4   ept2  2025-10-23T06:00:00Z  ...                          286.428955                    99310.710938
5   ept2  2025-10-23T06:00:00Z  ...                          285.010590                    99835.976562
6   ept2  2025-10-23T06:00:00Z  ...                          285.821747                    99690.070312
7   ept2  2025-10-23T06:00:00Z  ...                          279.756836                   100894.539062
8   ept2  2025-10-23T06:00:00Z  ...                          280.985046                   100497.390625
9   ept2  2025-10-23T06:00:00Z  ...                          280.339874                   100916.289062
10  ept2  2025-10-23T06:00:00Z  ...                          287.028015                   100000.000000
11  ept2  2025-10-23T06:00:00Z  ...                          286.628876                   100383.093750

[12 rows x 7 columns]
```

{% endtab %}
{% endtabs %}

### Multiple Models & Points

Request data for mulitple models and locations to compare them.

{% tabs %}
{% tab title="Python (Example)" %}

```python
 query = {
    "models": ["ept2", "aifs"],  # Multiple models
    "geo": {
        "type": "point",
        "value": [
            [47.3784, 8.5387],  # Zurich
            [46.9479, 7.4474],  # Bern
        ],
        "method": "nearest",
    },
    "variables": [
        "air_temperature_at_height_level_2m",
        "wind_speed_at_height_level_10m",
    ],
    "init_time": "latest",
    "prediction_timedelta": {"start": 0, "end": 4},  # 0-4 hours
    "order_by": ["model", "latitude", "longitude", "prediction_timedelta"],
}

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

# Show comparison between models
if len(df) > 0:
    print("\nModel comparison at first timestep:")
    print(
        df[df["prediction_timedelta"] == df["prediction_timedelta"].min()][
            ["model", "latitude", "longitude", "air_temperature_at_height_level_2m"]
        ]
    )
```

{% endtab %}

{% tab title="Output" %}

```
✅ Retrieved 12 rows
  model             init_time  ...  air_temperature_at_height_level_2m  wind_speed_at_height_level_10m
0  aifs  2025-10-23T06:00:00Z  ...                          286.800018                              0.0
1  aifs  2025-10-23T06:00:00Z  ...                          286.000000                              0.0
2  ept2  2025-10-23T06:00:00Z  ...                          284.600006                              5.1
3  ept2  2025-10-23T06:00:00Z  ...                          285.399994                              5.9
4  ept2  2025-10-23T06:00:00Z  ...                          285.700012                              6.8
5  ept2  2025-10-23T06:00:00Z  ...                          284.500000                             10.1
6  ept2  2025-10-23T06:00:00Z  ...                          283.100006                             10.0
7  ept2  2025-10-23T06:00:00Z  ...                          284.600006                              4.7
8  ept2  2025-10-23T06:00:00Z  ...                          285.399994                              5.0
9  ept2  2025-10-23T06:00:00Z  ...                          286.399994                              4.8

[10 rows x 7 columns]

Model comparison at first timestep:
  model   latitude  longitude  air_temperature_at_height_level_2m
0  aifs  47.000000   7.500000                          286.800018
1  aifs  47.500000   8.500000                          286.000000
2  ept2  46.916668   7.416667                          284.600006
7  ept2  47.416668   8.500000                          284.600006
```

{% endtab %}
{% endtabs %}

### Historical Data for Single Point

Query two months of 3-day forecasts for Zurich

{% tabs %}
{% tab title="Python (Example)" %}

```python
# Query forecasts from March to April 2025
start_time = datetime(2025, 3, 1, 0, 0, 0)
end_time = datetime(2025, 4, 30, 23, 59, 59)

query = {
    "models": ["ept2"],
    "geo": {
        "type": "point",
        "value": [47.3784, 8.5387],  # Zurich
        "method": "nearest",
    },
    "variables": [
        "air_temperature_at_height_level_2m",
        "precipitation_amount_sum_1h",
    ],
    "init_time": {
        "start": start_time.strftime("%Y-%m-%dT%H:%M:%S"),
        "end": end_time.strftime("%Y-%m-%dT%H:%M:%S"),
    },
    "prediction_timedelta": {"start": 0, "end": 72},
    "order_by": ["init_time", "prediction_timedelta"],
}

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

if len(df) > 0:
    print(f"\nInit times range: {df['init_time'].min()} to {df['init_time'].max()}")
```

{% endtab %}

{% tab title="Output" %}

```
✅ Retrieved 17812 rows
  model             init_time  prediction_timedelta   latitude  longitude  air_temperature_at_height_level_2m  precipitation_amount_sum_1h
0  ept2  2025-03-01T00:00:00Z                     0  47.416668        8.5                          273.700012                          NaN
1  ept2  2025-03-01T00:00:00Z                     1  47.416668        8.5                          273.600006                         0.00
2  ept2  2025-03-01T00:00:00Z                     2  47.416668        8.5                          273.700012                         0.00
3  ept2  2025-03-01T00:00:00Z                     3  47.416668        8.5                          273.800018                         0.00
4  ept2  2025-03-01T00:00:00Z                     4  47.416668        8.5                          273.899994                         0.00
5  ept2  2025-03-01T00:00:00Z                     5  47.416668        8.5                          273.899994                         0.00
6  ept2  2025-03-01T00:00:00Z                     6  47.416668        8.5                          273.899994                         0.00
7  ept2  2025-03-01T00:00:00Z                     7  47.416668        8.5                          274.200012                         0.00
8  ept2  2025-03-01T00:00:00Z                     8  47.416668        8.5                          274.899994                         0.01
9  ept2  2025-03-01T00:00:00Z                     9  47.416668        8.5                          275.700012                         0.01

Init times range: 2025-03-01T00:00:00Z to 2025-04-30T18:00:00Z
```

{% endtab %}
{% endtabs %}
