Name | lhpapi JSON |
Version |
1.0.4
JSON |
| download |
home_page | None |
Summary | API to retrieve data from the Länderübergreifendes Hochwasser Portal (LHP) |
upload_time | 2024-12-24 08:39:47 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.11 |
license | None |
keywords |
hochwasser
lhp
lhpapi
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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)](https://www.hochwasserzentralen.de)
## 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](https://github.com/stephan192/lhpapi/blob/master/docs/pegel.md). Some stream gauges are listed twice or even more often in [pegel.md](https://github.com/stephan192/lhpapi/blob/master/docs/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](https://pegelportal.brandenburg.de) |
| BE | Berlin | :heavy_check_mark: | :x: | :heavy_check_mark: | [Wasserportal Berlin](https://wasserportal.berlin.de) |
| BW | Baden-Württemberg | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasservorhersagezentrale Baden-Württemberg](https://www.hvz.baden-wuerttemberg.de) |
| BY | Bayern | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwassernachrichtendienst Bayern](https://www.hnd.bayern.de) |
| HB | Bremen | :heavy_check_mark: | :heavy_check_mark: | :x: | [Pegelstände Bremen](https://geoportale.dp.dsecurecloud.de/pegelbremen) |
| HE | Hessen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasserportal Hessen](https://www.hochwasser-hessen.de) |
| HH | Hamburg | :heavy_check_mark: | :heavy_check_mark: | :x: | [Warndienst Binnenhochwasser Hamburg](https://www.wabiha.de/karte.html) |
| MV | Mecklenburg-Vorpommern | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Pegelportal Mecklenburg-Vorpommern](https://pegelportal-mv.de) |
| NI | Niedersachsen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [NLWKN Pegelonline](https://www.pegelonline.nlwkn.niedersachsen.de) |
| NW | Nordrhein-Westfalen | :heavy_check_mark: | :heavy_check_mark: | :x: | [Hochwassermeldedienst NRW](https://www.hochwasserportal.nrw.de)|
| RP | Rheinland-Pfalz | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasservorhersagedienst - Landesamt für Umwelt Rheinland-Pfalz](https://hochwasser.rlp.de)|
| SH | Schleswig-Holstein | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasser-Sturmflut-Information Schleswig-Holstein](https://hsi-sh.de) |
| SL | Saarland | :heavy_check_mark: | :heavy_check_mark: | :x: | [Pegel Saarland](https://www.saarland.de/mukmav/DE/portale/wasser/informationen/hochwassermeldedienst/wasserstaende_warnlage/wasserstaende_warnlage_node.html) |
| SN | Sachsen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Landeshochwasserzentrum Sachsen](https://www.umwelt.sachsen.de/umwelt/infosysteme/hwims/portal/web/wasserstand-uebersicht) |
| ST | Sachsen-Anhalt | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Landesportal Sachsen-Anhalt](https://hochwasservorhersage.sachsen-anhalt.de) |
| TH | Thüringen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwassernachrichtenzentrale Thüringen](https://hnz.thueringen.de/hw-portal) |
Raw data
{
"_id": null,
"home_page": null,
"name": "lhpapi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "hochwasser, lhp, lhpapi",
"author": null,
"author_email": "stephan192 <stephan192@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/08/d8/a5228493bca1c1ee87220795a422314c072b209499f24dff1d8f01d2d897/lhpapi-1.0.4.tar.gz",
"platform": null,
"description": "# lhpapi\nPython client to retrieve data provided by the 16 German federal state flood information centers jointly known as [L\u00e4nder\u00fcbergreifendes Hochwasser Portal (LHP)](https://www.hochwasserzentralen.de)\n\n## Install\n```\npip install lhpapi\n```\n\n## Usage\n\n### Quickstart example\nGet values for the Isar in Munich\n```\nfrom lhpapi import HochwasserPortalAPI, LHPError\n\ntry:\n api = HochwasserPortalAPI(\"BY_16005701\")\n \n print(f\"ident:\\t\\t{api.ident}\")\n print(f\"name:\\t\\t{api.name}\")\n print(f\"url:\\t\\t{api.url}\")\n print(f\"hint:\\t\\t{api.hint}\")\n print(f\"level:\\t\\t{api.level} cm\")\n print(f\"stage:\\t\\t{api.stage}\")\n print(f\"flow:\\t\\t{api.flow} m\u00b3/s\")\n print(f\"last_update:\\t{api.last_update}\")\nexcept LHPError as err:\n print(\"Something went wrong!\")\n```\n\nResult\n```\nident: BY_16005701\nname: M\u00fcnchen / Isar\nurl: https://www.hnd.bayern.de/pegel/isar/muenchen-16005701\nhint: None\nlevel: 120.0 cm\nstage: 0\nflow: 73.6 m\u00b3/s\nlast_update: 2024-03-01 21:15:00+00:00\n```\n\n### Detailed description\n**Methods:**\n- **`__init__(ident: str)`** \n Create a new LHP API class instance\n \n The `ident` must be one of the stream gauges (`Pegel`) listed in [pegel.md](https://github.com/stephan192/lhpapi/blob/master/docs/pegel.md). Some stream gauges are listed twice or even more often in [pegel.md](https://github.com/stephan192/lhpapi/blob/master/docs/pegel.md), because they are listed on more than one state portal. Select the one of your choice.\n \n Method `update()` is automatically called at the end of a successfull init.\n\n- **`update()`** \n Update data by querying the LHP servers and parsing the result\n \n Function should be called regularly, e.g. every 15minutes, to update the data stored in the class attributes.\n\n**Attributes (read only):**\n- **`ident : str`** \n The identifier of the selected stream gauge\n\n- **`name : str`** \n The name of the selected stream gauge\n\n- **`url : str`** \n An URL pointing to additional information about the selected stream gauge\n\n- **`hint : str`** \n A hint reported for the the selected stream gauge\n\n- **`level : float`** \n The actual water level (in German *Pegelstand* or colloquially *Wasserstand*). A value in centimetres, starting from 0 cm = *Pegelnullpunktsh\u00f6he*.\n \n- **`stage : int`** \n 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).\n\n- **`flow : float`** \n The actual flow rate (in German *Abfluss* or *Durchfluss*). A value in m\u00b3/s.\n\n- **`last_update : datetime`** \n A datetime object representing the last update\n\n\n### List of supported values\n* :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`.\n* :x: Value generally yet not available.\n\n| Prefix | State | Level | Stage | Flow | Portal |\n|--------|------------------------|--------------------|--------------------|--------------------|--------|\n| BB | Brandenburg | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Pegelportal Brandenburg](https://pegelportal.brandenburg.de) |\n| BE | Berlin | :heavy_check_mark: | :x: | :heavy_check_mark: | [Wasserportal Berlin](https://wasserportal.berlin.de) |\n| BW | Baden-W\u00fcrttemberg | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasservorhersagezentrale Baden-W\u00fcrttemberg](https://www.hvz.baden-wuerttemberg.de) |\n| BY | Bayern | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwassernachrichtendienst Bayern](https://www.hnd.bayern.de) |\n| HB | Bremen | :heavy_check_mark: | :heavy_check_mark: | :x: | [Pegelst\u00e4nde Bremen](https://geoportale.dp.dsecurecloud.de/pegelbremen) |\n| HE | Hessen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasserportal Hessen](https://www.hochwasser-hessen.de) |\n| HH | Hamburg | :heavy_check_mark: | :heavy_check_mark: | :x: | [Warndienst Binnenhochwasser Hamburg](https://www.wabiha.de/karte.html) |\n| MV | Mecklenburg-Vorpommern | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Pegelportal Mecklenburg-Vorpommern](https://pegelportal-mv.de) |\n| NI | Niedersachsen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [NLWKN Pegelonline](https://www.pegelonline.nlwkn.niedersachsen.de) |\n| NW | Nordrhein-Westfalen | :heavy_check_mark: | :heavy_check_mark: | :x: | [Hochwassermeldedienst NRW](https://www.hochwasserportal.nrw.de)|\n| RP | Rheinland-Pfalz | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasservorhersagedienst - Landesamt f\u00fcr Umwelt Rheinland-Pfalz](https://hochwasser.rlp.de)|\n| SH | Schleswig-Holstein | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwasser-Sturmflut-Information Schleswig-Holstein](https://hsi-sh.de) |\n| SL | Saarland | :heavy_check_mark: | :heavy_check_mark: | :x: | [Pegel Saarland](https://www.saarland.de/mukmav/DE/portale/wasser/informationen/hochwassermeldedienst/wasserstaende_warnlage/wasserstaende_warnlage_node.html) |\n| SN | Sachsen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Landeshochwasserzentrum Sachsen](https://www.umwelt.sachsen.de/umwelt/infosysteme/hwims/portal/web/wasserstand-uebersicht) |\n| ST | Sachsen-Anhalt | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Landesportal Sachsen-Anhalt](https://hochwasservorhersage.sachsen-anhalt.de) |\n| TH | Th\u00fcringen | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | [Hochwassernachrichtenzentrale Th\u00fcringen](https://hnz.thueringen.de/hw-portal) |\n",
"bugtrack_url": null,
"license": null,
"summary": "API to retrieve data from the L\u00e4nder\u00fcbergreifendes Hochwasser Portal (LHP)",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/stephan192/lhpapi",
"Issues": "https://github.com/stephan192/lhpapi/issues"
},
"split_keywords": [
"hochwasser",
" lhp",
" lhpapi"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a1d2f82fd721d22142b3552ef5d1ebf88125c36c1ad71eacd6067a0957984251",
"md5": "53ca9fc4d71821a39af88042a57c346b",
"sha256": "4d0a32c0255e635dcafe53b7805ced3d0e3374e5d8bf6ad2c15e1e68fe461161"
},
"downloads": -1,
"filename": "lhpapi-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "53ca9fc4d71821a39af88042a57c346b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 25924,
"upload_time": "2024-12-24T08:39:45",
"upload_time_iso_8601": "2024-12-24T08:39:45.316120Z",
"url": "https://files.pythonhosted.org/packages/a1/d2/f82fd721d22142b3552ef5d1ebf88125c36c1ad71eacd6067a0957984251/lhpapi-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "08d8a5228493bca1c1ee87220795a422314c072b209499f24dff1d8f01d2d897",
"md5": "15e6ccbf7f1d88176a336867352bf338",
"sha256": "3564d521afd1f58bb45df9aa34966ae96cb4f71f069c89dc6117482016a9de14"
},
"downloads": -1,
"filename": "lhpapi-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "15e6ccbf7f1d88176a336867352bf338",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 15234,
"upload_time": "2024-12-24T08:39:47",
"upload_time_iso_8601": "2024-12-24T08:39:47.654248Z",
"url": "https://files.pythonhosted.org/packages/08/d8/a5228493bca1c1ee87220795a422314c072b209499f24dff1d8f01d2d897/lhpapi-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-24 08:39:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stephan192",
"github_project": "lhpapi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "lhpapi"
}