Skip to main content

dwd-weather

Python client to access DWD weather data (Germany)

Quick reference

from dwdweather import DwdWeather
from datetime import datetime

# Your personal DWD GDS FTP credentials
user = "myuser"
passwd = "mypasswd"

# create client
dw = DwdWeather(user=user, passwd=passwd)

# Find closest station to position
closest = dw.nearest_station(lon=7, lat=51)

# The hour you're interested in.
# The example is 2014-03-22 12:00 (UTC).
query_hour = datetime(2014, 3, 22, 12)

result = dw.query(station_id=closest["station_id"], hour=query_hour)
print result

DwdWeather.query() returns a dict with the following keys:

  • station_id: Station identifier, as int.

  • datetime: The hour as int, e.g. 2013011212.

  • precipitation_fallen: Whether or not there has been precipitation within the hour, as int. 0 for no, 1 for yes.

  • precipitation_form: TODO

  • precipitation_height: Height of hourly precipitation in mm, as float.

  • precipitation_quality_level: Data quality level, as int.

  • soiltemp_1_depth: first soil temperature measurement, depth in meters, as float.

  • soiltemp_1_temperature: first soil temperature measurement, temperature in degrees centigrade, as float.

  • soiltemp_2_depth: second soil temperature measurement, depth in meters, as float.

  • soiltemp_2_temperature: second soil temperature measurement, temperature in degrees centigrade, as float.

  • soiltemp_3_depth: third soil temperature measurement, depth in meters, as float.

  • soiltemp_3_temperature: third soil temperature measurement, temperature in degrees centigrade, as float.

  • soiltemp_4_depth: fourth soil temperature measurement, depth in meters, as float.

  • soiltemp_4_temperature: fourth soil temperature measurement, temperature in degrees centigrade, as float.

  • soiltemp_5_depth: fifth soil temperature measurement, depth in meters, as float.

  • soiltemp_5_temperature: fifth soil temperature measurement, temperature in degrees centigrade, as float.

  • soiltemp_quality_level: soil temperature quality level, as int.

  • sun_duration: Duration of sunshine per hour in minutes, as float.

  • sun_quality_level: quality level of sunshine data, as int.

  • sun_structure_version: version number, as int.

  • temphum_humidity: relative air humidity in percent, as float.

  • temphum_quality_level: data qqualit level of air temperature and humidity data, as int.

  • temphum_structure_version: version number, as int.

  • temphum_temperature: air temperature in degrees centigrade, as float.

  • wind_direction: wind direction in degrees, as int (0 - 360).

  • wind_quality_level: wind data quality level, as int.

  • wind_speed: wind speed in meters per second, as float.

  • wind_structure_version: version number, as int.

Some notes

  • Personal FTP user account with DWD GDS is needed. See here for details.

  • Data is cached in a local sqlite3 database for fast queries.

  • The Stations cache is filled upon first request to DwdWeather.stations() or DwdWeather.nearest_station()

  • The Stations cache will not be refreshed automatically. Use DwdWeather.import_stations() to do this.

  • The Measures cache is filled upon first access to measures using DwdWeather.query() and updated whenever a query cannot be fullfilled from the cache.

  • The cache by default resides in ~/.dwd-weather directory. This can be influenced using the cachepath argument of DwdWeather().

  • The amount of data can be ~60 MB per station for full historic extend and this will of course grow in the future.

Status

This piece of software is in a very early stage. No test cases yet. Use at your own risk.

Metadata

Release files for dwdweather 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dwdweather 0.1
File Size Uploaded Provenance Actions
dwdweather-0.1.tar.gz 7.0 kB Without provenance Details for dwdweather-0.1.tar.gz

Release files / dwdweather-0.1.tar.gz

Download URL dwdweather-0.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ac5ad45d06c38ac2c6ab4d14441ddf4f7c96c8f9fd130b40e2e9a30ed26c83fb
BLAKE2b-256 checksum
How to use checksums
5e9344c89cbfea197b23c3bf4b68aaefcf1678faf2d719304afaab1802306c01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dwdweather 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page