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

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

Metadata

Release files for lhpapi 1.0.13

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

Source distribution (sdist)

Source distribution for lhpapi 1.0.13
File Size Uploaded Provenance Actions
lhpapi-1.0.13.tar.gz 15.6 kB Without provenance Details for lhpapi-1.0.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lhpapi 1.0.13
File Interpreter ABI Platform Actions
lhpapi-1.0.13-py3-none-any.whl Python 3 none any Details for lhpapi-1.0.13-py3-none-any.whl

Total release size: 41.9 kB

Release files / lhpapi-1.0.13.tar.gz

Download URL lhpapi-1.0.13.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d4957b2156eeebb53eca57a7ceb6a4df1d47a1fe38cbbf8a5e9c8d0ed4edc2ca
BLAKE2b-256 checksum
How to use checksums
bf9ff3b75e889c2d978e6ce716611524d51139bbd3712d86530d98a64513fd29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / lhpapi-1.0.13-py3-none-any.whl

Download URL lhpapi-1.0.13-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd008ed73fc97bf5ba6f807ad822644dd009ba8c54013f79e95c2e0095f9a834
BLAKE2b-256 checksum
How to use checksums
626b5f883f5d109812d361c23113c266c42434d5d6bafc09dc5810ed5e52f471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for lhpapi 1.0.13

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