Skip to main content

Download data from DWD's ftp server and return it as xarray DataArray

Project description

German Weather Service (DWD) Open Data Client

A Python library for downloading and processing meteorological data from the German Weather Service (Deutscher Wetterdienst - DWD) open data platform.

Features

  • Load data from multiple stations and variables into xarray DataArrays
  • Station mapping functionality to identify which stations provide specific variables
  • Automatic handling of DWD data structure idiosyncrasies

Installation

This project uses uv for package management. If you don't have uv installed, follow the installation instructions.

From source

Clone the repository and install with uv:

git clone https://github.com/yourusername/dwd_opendata_client.git
cd dwd_opendata_client
uv sync

Development installation

To install with development dependencies:

uv sync --all-extras

Key Dependencies

  • xarray - For handling multi-dimensional meteorological data
  • pandas - Data processing and manipulation
  • cartopy - Mapping and geospatial visualization

All dependencies are managed by uv and will be installed automatically with uv sync.

Usage

Find stations that offer a set of variables within a bounding box and time frame:

import dwd_opendata as dwd
from datetime import datetime

start = datetime(1980, 1, 1)
end = datetime(2016, 12, 31)
variables = ("wind", "air_temperature", "sun", "precipitation")
fig, ax = dwd.map_stations(
    variables,
    lon_min=7,
    lat_min=47.4,
    lon_max=12.0,
    lat_max=49.0,
    start=start,
    end=end,
)

Download data for multiple stations and variables at once and load as an xarray.DataArray:

data = dwd.load_data(
    ("Konstanz", "Feldberg/Schwarzwald"),
    variables=variables,
    start_year=start,
    end_year=end,
)

Data Directory

By default, data is stored in ~/.local/share/opendata_dwd (following XDG Base Directory specification). You can override this by setting the XDG_DATA_HOME environment variable.

CI/CD and Publishing

The project uses GitHub Actions to automatically build wheels on pushes to main and publish to PyPI when a version tag is created.

Releasing a New Version

To release a new version:

  1. Update the version in pyproject.toml
  2. Update the relevant section in CHANGELOG.md with release notes
  3. Create a git tag: git tag vX.Y.Z
  4. Push the tag: git push origin vX.Y.Z

The GitHub Actions workflow will automatically:

  • Build wheels
  • Create a GitHub Release with the changelog excerpt
  • Publish the wheels to PyPI

Building Locally

To build wheels locally using uv:

uv build

The wheels will be created in the dist/ directory.

Testing Releases on TestPyPI

Before releasing to production PyPI, you can test the publishing workflow on TestPyPI:

  1. Create a test tag: git tag vX.Y.Z-test
  2. Push the tag: git push origin vX.Y.Z-test
  3. Monitor the workflow at https://github.com/iskur/dwd_opendata/actions
  4. Verify the release on https://test.pypi.org/project/dwd_opendata/
  5. Test installation: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ dwd_opendata

Once verified, create the production release tag without the -test suffix.

Status

⚠️ Experimental: This library is under active development and the API is not stable yet.

License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Acknowledgments

Data provided by Deutscher Wetterdienst (DWD) - German Weather Service

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dwd_opendata-0.1.0.tar.gz (819.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dwd_opendata-0.1.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file dwd_opendata-0.1.0.tar.gz.

File metadata

  • Download URL: dwd_opendata-0.1.0.tar.gz
  • Upload date:
  • Size: 819.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dwd_opendata-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab572394e33d7e58ffcbb38ad8365320878849021718637cd7fb806d0cf1bb6c
MD5 7cc9cea376736f8f2abda0f935cfb0a5
BLAKE2b-256 a198c0ae7d0e954e293a475e08119da33e12f922e1e7032456a41ccdc027584e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwd_opendata-0.1.0.tar.gz:

Publisher: build-and-publish.yml on iskur/dwd_opendata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dwd_opendata-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dwd_opendata-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dwd_opendata-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d96dcb758dcc7e2099c5d3b79cd327bf7344854d5c9b47861071dc4db3aea773
MD5 910ea79307617736ab5bb8361cb23f6a
BLAKE2b-256 5597a138cbd1293804e64117f26005ca9d804f7ef2677a7b4a556db2798c55ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for dwd_opendata-0.1.0-py3-none-any.whl:

Publisher: build-and-publish.yml on iskur/dwd_opendata

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page