Skip to main content

lhpapi

Python client to retrieve data provided by the 16 German federal state flood information centers jointly known as Länderübergreifendes Hochwasser Portal (LHP)

Install

pip install lhpapi

Usage

Quickstart example

Get values for the Isar in Munich

from lhpapi import HochwasserPortalAPI, LHPError

try:
    api = HochwasserPortalAPI("BY_16005701")
    
    print(f"ident:\t\t{api.ident}")
    print(f"name:\t\t{api.name}")
    print(f"url:\t\t{api.url}")
    print(f"hint:\t\t{api.hint}")
    print(f"level:\t\t{api.level} cm")
    print(f"stage:\t\t{api.stage}")
    print(f"flow:\t\t{api.flow} m³/s")
    print(f"last_update:\t{api.last_update}")
except LHPError as err:
    print("Something went wrong!")

Result

ident:          BY_16005701
name:           München / Isar
url:            https://www.hnd.bayern.de/pegel/isar/muenchen-16005701
hint:           None
level:          120.0 cm
stage:          0
flow:           73.6 m³/s
last_update:    2024-03-01 21:15:00+00:00

Detailed description

Methods:

  • __init__(ident: str)
    Create a new LHP API class instance

    The ident must be one of the stream gauges (Pegel) listed in pegel.md. Some stream gauges are listed twice or even more often in pegel.md, because they are listed on more than one state portal. Select the one of your choice.

    Method update() is automatically called at the end of a successfull init.

  • update()
    Update data by querying the LHP servers and parsing the result

    Function should be called regularly, e.g. every 15minutes, to update the data stored in the class attributes.

Attributes (read only):

  • ident : str
    The identifier of the selected stream gauge

  • name : str
    The name of the selected stream gauge

  • url : str
    An URL pointing to additional information about the selected stream gauge

  • hint : str
    A hint reported for the the selected stream gauge

  • level : float
    The actual water level (in German Pegelstand or colloquially Wasserstand). A value in centimetres, starting from 0 cm = Pegelnullpunktshöhe.

  • stage : int
    The actual warning stage (in German depending on ferderal state e.g. Meldestufe in Bavaria, Alarmstufe in Brandenburg). A number between 0 (=no flood) and 4 (= very large flood).

  • flow : float
    The actual flow rate (in German Abfluss or Durchfluss). A value in m³/s.

  • last_update : datetime
    A datetime object representing the last update

List of supported values

  • :heavy_check_mark: Value mostly available. Check individual state portal because not all stream gauges report all values, values not avaiable are reported as None.
  • :x: Value generally yet not available.
Prefix State Level Stage Flow Portal
BB Brandenburg :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Pegelportal Brandenburg
BE Berlin :heavy_check_mark: :x: :heavy_check_mark: Wasserportal Berlin
BW Baden-Württemberg :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Hochwasservorhersagezentrale Baden-Württemberg
BY Bayern :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Hochwassernachrichtendienst Bayern
HB Bremen :heavy_check_mark: :heavy_check_mark: :x: Pegelstände Bremen
HE Hessen :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Hochwasserportal Hessen
HH Hamburg :heavy_check_mark: :heavy_check_mark: :x: Warndienst Binnenhochwasser Hamburg
MV Mecklenburg-Vorpommern :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Pegelportal Mecklenburg-Vorpommern
NI Niedersachsen :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: NLWKN Pegelonline
NW Nordrhein-Westfalen :heavy_check_mark: :heavy_check_mark: :x: Hochwassermeldedienst NRW
RP Rheinland-Pfalz :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Hochwasservorhersagedienst - Landesamt für Umwelt Rheinland-Pfalz
SH Schleswig-Holstein :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Hochwasser-Sturmflut-Information Schleswig-Holstein
SL Saarland :heavy_check_mark: :heavy_check_mark: :x: Pegel Saarland
SN Sachsen :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Landeshochwasserzentrum Sachsen
ST Sachsen-Anhalt :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Landesportal Sachsen-Anhalt
TH Thüringen :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: Hochwassernachrichtenzentrale Thüringen

Download files

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

Source Distribution

lhpapi-1.0.11.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

lhpapi-1.0.11-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file lhpapi-1.0.11.tar.gz.

File metadata

  • Download URL: lhpapi-1.0.11.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lhpapi-1.0.11.tar.gz
Algorithm Hash digest
SHA256 3882fbb07750f97060b0f0ad50f8988826541b2b71c881192b860c402b3cbfed
MD5 35b7c02f0fa66f52019d9614a8274925
BLAKE2b-256 2535ba9be5b98e87f09a89d1f5af9fc0c3bad4109bb51852011dbca0bb943dd3

See more details on using hashes here.

File details

Details for the file lhpapi-1.0.11-py3-none-any.whl.

File metadata

  • Download URL: lhpapi-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lhpapi-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 069e647baf4275b288fb26981309913eef288c70e385c98f575fa2f8e67ce5e7
MD5 fc2254fe6986f24f3daa5f453479847d
BLAKE2b-256 3ea3e8fab169b3ac421afaf031a05473b7c89f5c03b14f6aa103b224a297cffd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.11 This release

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

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