Registry / data / simple-dwd-weatherforecast

simple-dwd-weatherforecast

JSON →
library3.4.7pypypi✓ verified 84d ago

Simple DWD Weatherforecast is a Python library (version 3.4.1) providing a straightforward tool to retrieve weather forecasts from DWD (Deutscher Wetterdienst) OpenData. It allows access to hourly forecast data for the next 10 days, reported weather conditions, weather maps from the DWD GeoServer, and air quality measurements and forecasts. The project is actively maintained with frequent updates.

pip install simple-dwd-weatherforecast
INSTALL
IMPORT
SIG · SIMPLE-DWD-WEATHER
S
simple-dwd-weatherforecast
datapythonv3.4.7
Install
4.8s avg
Import
1159ms
Disk
73MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.4.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.466s · 72.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.8s · import 0.462s · 75MB
73MB installed
● package 73MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dwdforecast
from simple_dwd_weatherforecast import dwdforecast
Main module for weather forecast data.
dwdmap
from simple_dwd_weatherforecast import dwdmap
Module for retrieving DWD weather maps.

This quickstart demonstrates how to initialize the `Weather` object with a station ID and retrieve current and future temperature forecasts. It also shows how to get the raw weather condition code. Station IDs can be found via `get_nearest_station_id` or from DWD's official lists. All datetime objects passed to the library should be in UTC.

from simple_dwd_weatherforecast import dwdforecast from datetime import datetime, timezone # Find nearest Station-ID automatically (uncomment to use) # id = dwdforecast.get_nearest_station_id(50.1109221, 8.6821267) # Or use a known Station-ID, e.g., for BERLIN-SCHOENEFELD station_id = "10385" dwd_weather = dwdforecast.Weather(station_id) time_now = datetime.now(timezone.utc) try: temperature_now = dwd_weather.get_forecast_data(dwdforecast.WeatherDataType.TEMPERATURE_2M, time_now) print(f"Temperature at {station_id} ({time_now.isoformat()} UTC): {temperature_now}°C") # Get a specific forecast for a few hours later future_time = time_now.replace(hour=(time_now.hour + 3) % 24) # Example: 3 hours later on the same day future_temp = dwd_weather.get_forecast_data(dwdforecast.WeatherDataType.TEMPERATURE_2M, future_time) print(f"Temperature at {station_id} ({future_time.isoformat()} UTC): {future_temp}°C") # Get weather condition (requires manual conversion from digit value if not using helper) weather_condition_code = dwd_weather.get_forecast_data(dwdforecast.WeatherDataType.WEATHER_CONDITION, time_now) print(f"Weather condition code: {weather_condition_code}") except Exception as e: print(f"An error occurred: {e}") print("Ensure the station ID is valid and DWD data is available for the requested time.")
Debug
Known issues
gotchaWhen fetching hourly data by setting `force_hourly=True`, the library downloads approximately 37MB of data per call. Additionally, this mode may omit some data elements like `PRECIPITATION_PROBABILITY` and `PRECIPITATION_DURATION`.
fix
Be mindful of network usage and data completeness when using `force_hourly=True`. Consider if these specific elements are critical for your application.
affects: All versions
gotchaDatetime values provided to library methods must always be in UTC. Providing naive datetimes or datetimes in other timezones can lead to incorrect data retrieval or errors.
fix
Always use `datetime.now(timezone.utc)` or ensure any `datetime` objects are explicitly set to UTC before passing them to `simple-dwd-weatherforecast` functions.
affects: All versions
gotchaWeather condition data is returned as a raw digit value provided by DWD. Users are responsible for converting these codes into human-readable conditions, though simplified conversion tables might be available within the library's source code or documentation.
fix
Implement a mapping or use an existing utility (if provided by the library) to convert the numerical weather condition codes into descriptive strings.
affects: All versions
gotchaUnexpected `ModuleNotFoundError` for `stream_unzip` or `stream_inflate`, or build failures related to these packages, have been reported in certain environments (e.g., Home Assistant, specific Python versions, or beta builds). This indicates dependency resolution issues.
fix
Ensure that `stream-unzip` and `stream-inflate` are correctly installed and compatible with your Python version. Sometimes, upgrading `simple-dwd-weatherforecast` to its latest version (which might include updated dependency specifications) or manually installing specific versions of `stream-unzip`/`stream-inflate` can resolve the issue.
affects: All versions, particularly when integrating with Home Assistant or specific Python environments.
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'simple_dwd_weatherforecast'
The `simple-dwd-weatherforecast` library has not been installed or is not accessible in the current Python environment.
fix
Install the library using pip: `pip install simple-dwd-weatherforecast`
TypeError: 'NoneType' object is not subscriptable
This error occurs when `DwdWeatherForecast.get_forecast_data()` returns `None` (e.g., due to an invalid station ID, no data available, or a network issue), and the code subsequently attempts to access `None` as if it were a dictionary or list.
fix
Always check if the result of `get_forecast_data()` is not `None` before attempting to access its contents:
```python
from simple_dwd_weatherforecast import DwdWeatherForecast

dwd_weather = DwdWeatherForecast("10865") # Example station ID
forecast_data = dwd_weather.get_forecast_data()

if forecast_data:
    print(forecast_data.keys())
else:
    print("Failed to retrieve forecast data or no data available.")
```
ValueError: Could not parse station data.
This error indicates that the provided station ID is invalid, or the DWD API could not provide data for that specific station, often due to the station not existing or not reporting the requested type of data.
fix
Verify the station ID is correct and active. Use `DwdWeatherForecast.get_stations()` to find valid station IDs and their available data types:
```python
from simple_dwd_weatherforecast import DwdWeatherForecast

# Find valid stations
stations = DwdWeatherForecast.get_stations()
for station_id, station_info in stations.items():
    if "description" in station_info and "Hamburg-Fuhlsbuettel" in station_info["description"]:
        print(f"Found Hamburg-Fuhlsbuettel: {station_id}")

# Use a verified station ID
dwd_weather = DwdWeatherForecast("10147") # Example of a valid ID
forecast_data = dwd_weather.get_forecast_data()
```
KeyError: 'temperature_air_200'
The requested forecast parameter key (e.g., `'temperature_air_200'`) does not exist in the returned forecast data dictionary for the specified station or has a different name.
fix
Check the available keys using `forecast_data.keys()` or `dwd_weather.get_forecast_keys()` to ensure you are requesting a valid parameter name:
```python
from simple_dwd_weatherforecast import DwdWeatherForecast

dwd_weather = DwdWeatherForecast("10865")
forecast_data = dwd_weather.get_forecast_data()

if forecast_data:
    # Option 1: Check available keys dynamically
    print("Available keys:", forecast_data.keys())
    if 'temperature_air_2m' in forecast_data: # A common valid key
        print(f"2m Air Temperature: {forecast_data['temperature_air_2m']}")
    else:
        print("Specific key not found in data.")

    # Option 2: Get all possible forecast keys for the library
    all_possible_keys = dwd_weather.get_forecast_keys()
    print("All possible forecast keys:", all_possible_keys)
```
Upgrade
Version history
3.4.7latest on PyPI · released Jun 11, 2026
Audit
Dependencies
stream-unziprequiredRequired for internal data processing; reported as a missing module in some environments, particularly older Home Assistant versions.
stream-inflaterequiredRequired for internal data processing; build failures reported in certain environments, especially with newer Python versions or Home Assistant beta builds.
Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
2
Resources
simple-dwd-weatherforecast — pip install simple-dwd-weatherforecast · libregistry