# Climate Data from DWD

[Deutscher Wetterdienst (DWD)](https://www.dwd.de) is Germany's national meteorological service and one of the
richest open sources of weather and climate data. Meteostat integrates several DWD feeds. By default, Meteostat
combines data from all its [providers](/python/providers). This recipe shows how to request data from a specific
DWD feed instead, for example when you need a parameter that only one feed has, or want to know exactly where your
data comes from.

**You'll learn how to:**

- choose the right DWD feed for a task
- find stations that a feed covers
- fetch hourly, daily and monthly data from a single provider

## Which DWD feed? {#providers}

| Provider                  | Granularity       | Coverage                | Station identifier | Best for                                                      |
| ------------------------- | ----------------- | ----------------------- | ------------------ | ------------------------------------------------------------- |
| `ms.Provider.DWD_HOURLY`  | Hourly            | Most German stations    | `national`         | Hourly observations in Germany                                |
| `ms.Provider.DWD_POI`     | Hourly            | Selected European stations | `wmo`           | More parameters: cloud cover, snow depth, gusts, visibility   |
| `ms.Provider.DWD_MOSMIX`  | Hourly (forecast) | Thousands of stations worldwide | `mosmix`   | Forecasts                                                     |
| `ms.Provider.DWD_DAILY`   | Daily             | Most German stations    | `national`         | Daily climate summaries                                       |
| `ms.Provider.DWD_MONTHLY` | Monthly           | Most German stations    | `national`         | Long-term climatology in Germany                              |
| `ms.Provider.CLIMAT`      | Monthly           | Stations worldwide      | `wmo`              | Monthly data outside Germany, incl. monthly extremes and pressure |

The [Data Providers](/providers) page lists every provider Meteostat supports.

:::tip[Be explicit]
When you target a specific feed, always pass both `providers` and `parameters`. You only download what you need, and
the origin of every value is obvious.
:::

## Setup {#installation}

```bash
pip install meteostat
```

`DWD_MOSMIX` additionally needs `lxml` to parse DWD's XML files (`pip install lxml`).

## Find a station {#finding-stations}

A feed can only return data for stations that have the identifier it uses (see the table above). The
[station database](/data/weather-stations#database) is queryable with SQL, so this lists all German stations with a
`national` ID, i.e. the stations covered by `DWD_HOURLY`, `DWD_DAILY` and `DWD_MONTHLY`:

```python
import meteostat as ms

stations = ms.stations.query("""
    SELECT s.id, n.name, i.value AS national_id, s.latitude, s.longitude
    FROM stations s
    JOIN names n ON s.id = n.station AND n.language = 'en'
    JOIN identifiers i ON s.id = i.station AND i.key = 'national'
    WHERE s.country = 'DE';
""", index_col="id")

print(stations)
```

The examples below use **Frankfurt Airport** (`10637`), which has one of the longest continuous DWD records in
Germany. You always pass the Meteostat ID; Meteostat maps it to the identifier each feed needs.

## Hourly observations {#hourly}

`DWD_HOURLY` provides synoptic observations recorded every hour. Temperature and relative humidity for 2024:

```python
from datetime import datetime
import meteostat as ms

start = datetime(2024, 1, 1)
end = datetime(2024, 12, 31, 23, 59)

ts = ms.hourly(
    '10637',
    start,
    end,
    providers=[ms.Provider.DWD_HOURLY],
    parameters=[ms.Parameter.TEMP, ms.Parameter.RHUM],
)
df = ts.fetch()

print(df.head())
```

```text
                     temp  rhum
time
2024-01-01 00:00:00   4.8  92.0
2024-01-01 01:00:00   4.5  93.0
2024-01-01 02:00:00   4.2  94.0
2024-01-01 03:00:00   4.0  95.0
2024-01-01 04:00:00   3.8  95.0
```

### More parameters with the POI feed {#poi}

`DWD_POI` is a richer hourly feed. It adds cloud cover, snow depth, wind gusts and visibility:

```python
ts = ms.hourly(
    '10637',
    start,
    end,
    providers=[ms.Provider.DWD_POI],
    parameters=[
        ms.Parameter.TEMP,
        ms.Parameter.PRCP,
        ms.Parameter.CLDC,
        ms.Parameter.SNWD,
    ],
)
df = ts.fetch()
```

## Daily summaries {#daily}

`DWD_DAILY` provides daily climate summaries: minimum and maximum temperature, precipitation, sunshine duration and
more. Five years of data, summarized:

```python
from datetime import date
import meteostat as ms

start = date(2020, 1, 1)
end = date(2024, 12, 31)

ts = ms.daily(
    '10637',
    start,
    end,
    providers=[ms.Provider.DWD_DAILY],
    parameters=[
        ms.Parameter.TMIN,
        ms.Parameter.TMAX,
        ms.Parameter.PRCP,
        ms.Parameter.TSUN,
    ],
)
df = ts.fetch()

print(df.describe())
```

## Monthly records {#monthly}

`DWD_MONTHLY` provides monthly values aggregated by DWD itself. It's the right choice for long climatological
analyses where daily resolution isn't needed. 75 years of monthly temperature and precipitation:

```python
from datetime import date
import meteostat as ms

start = date(1950, 1, 1)
end = date(2024, 12, 31)

ts = ms.monthly(
    '10637',
    start,
    end,
    providers=[ms.Provider.DWD_MONTHLY],
    parameters=[ms.Parameter.TEMP, ms.Parameter.PRCP],
)
df = ts.fetch()

print(df.tail(12))
```

### Worldwide monthly data with CLIMAT {#climat}

`CLIMAT` is an international format for exchanging monthly climate data, to which DWD contributes. It covers
stations worldwide and includes parameters `DWD_MONTHLY` doesn't have, such as the absolute monthly extremes
(`txmn`, `txmx`) and mean sea-level pressure:

```python
from datetime import date
import meteostat as ms

start = date(1990, 1, 1)
end = date(2024, 12, 31)

ts = ms.monthly(
    '10637',
    start,
    end,
    providers=[ms.Provider.CLIMAT],
    parameters=[ms.Parameter.TEMP, ms.Parameter.TMIN, ms.Parameter.TMAX],
)
df = ts.fetch()
```

## Next steps {#next-steps}

- [Data Providers](/python/providers): how providers work in Meteostat Python
- [Meteorological Parameters](/parameters): every parameter, its unit and the granularities it's available in
- [Merging Time Series](/python/timeseries#merging): combine requests, e.g. several periods, into one time series
