Python client to access weather data from Deutscher Wetterdienst (DWD), the federal meteorological service in Germany.
MIT License
.. image:: https://img.shields.io/badge/Python-3-green.svg :target: https://github.com/panodata/dwdweather2
.. image:: https://img.shields.io/pypi/v/dwdweather2.svg :target: https://pypi.org/project/dwdweather2/
.. image:: https://img.shields.io/pypi/l/dwdweather2.svg :target: https://pypi.org/project/dwdweather2/
.. image:: https://img.shields.io/pypi/dm/dwdweather2.svg :target: https://pypi.org/project/dwdweather2/
.. image:: https://img.shields.io/github/tag/panodata/dwdweather2.svg :target: https://github.com/panodata/dwdweather2
.. image:: https://assets.okfn.org/images/ok_buttons/od_80x15_red_green.png :target: https://okfn.org/opendata/
.. image:: https://assets.okfn.org/images/ok_buttons/oc_80x15_blue.png :target: https://okfn.org/opendata/
.. image:: https://assets.okfn.org/images/ok_buttons/os_80x15_orange_grey.png :target: https://okfn.org/opendata/
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/python/black
.. _dwdweather2-readme:
########### dwdweather2 ###########
Python client to access weather data from Deutscher Wetterdienst
(DWD <https://www.dwd.de/>
__), the federal meteorological service in
Germany.
.. note::
Please note this library will gradually be phased out.
You should consider using its successor library "`Wetterdienst <https://github.com/earthobservations/wetterdienst>`_".
Installation
::
pip install dwdweather2
Synopsis
Get all stations with daily
resolution::
dwdweather stations --resolution=daily
Get all stations with hourly
resolution (default)::
dwdweather stations --resolution=hourly
Get all stations with 10_minutes
resolution::
dwdweather stations --resolution=10_minutes
Get closest station (first argument is longitude, second is latitude)::
dwdweather station 7.0 51.0
Export stations as CSV::
dwdweather stations --type csv --file stations.csv
Export stations as GeoJSON::
dwdweather stations --type geojson --file stations.geojson
Get weather at station for certain hour (UTC)::
dwdweather weather 2667 2019-06-01T15:00
To restrict the import to specified categories, run the program like::
dwdweather weather 2667 2019-06-01T15:00 --categories air_temperature precipitation pressure
Finally, to drop the cache database before performing any work, use the --reset-cache
option::
dwdweather stations --reset-cache
Choose dataset with daily
resolution::
dwdweather weather 44 2020-06-01 --resolution=daily
Choose dataset with hourly
resolution::
dwdweather weather 44 2020-06-01T08 --resolution=hourly
Choose dataset with 10_minutes
resolution::
dwdweather weather 2667 2019-06-01T15:20 --resolution=10_minutes
.. code:: python
from datetime import datetime from dwdweather import DwdWeather
dwd = DwdWeather(resolution="hourly")
closest = dwd.nearest_station(lon=7.0, lat=51.0)
query_hour = datetime(2014, 3, 22, 12)
result = dwd.query(station_id=closest["station_id"], timestamp=query_hour) print(result)
DwdWeather.query()
returns a dictionary with the full set of
possible keys as outlined in doc/usage-library.rst
.
Notes
DwdWeather.stations()
or DwdWeather.nearest_station()
DwdWeather.import_stations()
to do this.DwdWeather.query()
and updated whenever a query cannot be~/.dwd-weather
directory.cachepath
argument ofDwdWeather()
.Licenses
Licensed under the MIT license. See LICENSE <https://github.com/panodata/dwdweather2/blob/master/LICENSE>
__ for details.
The DWD has information about their terms of use policy in
German <https://www.dwd.de/DE/service/copyright/copyright_node.html>
__
and
English <https://www.dwd.de/EN/service/copyright/copyright_node.html>
__.
Project information
Thanks to Marian Steinbach <https://github.com/marians>
, all
other contributors and the DWD <https://www.dwd.de/>
.
See file CHANGES.rst <https://github.com/panodata/dwdweather2/blob/master/CHANGES.rst>
__.
Other projects