lhp-api


Namelhp-api JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryAPI to retrieve data from the Länderübergreifendes Hochwasser Portal (LHP)
upload_time2024-03-02 07:10:30
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords hochwasser lhp lhp_api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lhp_api
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 lhp_api
```

## Usage

### Quickstart example
Get values for the Isar in Munich
```
from lhp_api 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/lhp_api/blob/master/docs/pegel.md). Some stream gauges are listed twice or even more often in [pegel.md](https://github.com/stephan192/lhp_api/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": "",
    "name": "lhp-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "hochwasser,lhp,lhp_api",
    "author": "",
    "author_email": "stephan192 <stephan192@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/a0/c7/42cf0c55c813566f163a9d91d4a888bda8b123acf66be39146dc3bb7c4b9/lhp_api-1.0.0.tar.gz",
    "platform": null,
    "description": "# lhp_api\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 lhp_api\n```\n\n## Usage\n\n### Quickstart example\nGet values for the Isar in Munich\n```\nfrom lhp_api 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/lhp_api/blob/master/docs/pegel.md). Some stream gauges are listed twice or even more often in [pegel.md](https://github.com/stephan192/lhp_api/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": "",
    "summary": "API to retrieve data from the L\u00e4nder\u00fcbergreifendes Hochwasser Portal (LHP)",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/stephan192/lhp_api",
        "Issues": "https://github.com/stephan192/lhp_api/issues"
    },
    "split_keywords": [
        "hochwasser",
        "lhp",
        "lhp_api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5c394a9b4c6d420e3ab1d5ff1bac0161f09cbac0fc196ff33fbcde0d0f3b307",
                "md5": "4b392c498dcb3156989ee681469ef476",
                "sha256": "f57665c431671fd1b1c0e24ce83444fd455ab273e85e473080be833c09e6de50"
            },
            "downloads": -1,
            "filename": "lhp_api-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4b392c498dcb3156989ee681469ef476",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 25868,
            "upload_time": "2024-03-02T07:10:28",
            "upload_time_iso_8601": "2024-03-02T07:10:28.791954Z",
            "url": "https://files.pythonhosted.org/packages/d5/c3/94a9b4c6d420e3ab1d5ff1bac0161f09cbac0fc196ff33fbcde0d0f3b307/lhp_api-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0c742cf0c55c813566f163a9d91d4a888bda8b123acf66be39146dc3bb7c4b9",
                "md5": "2a19ced71c60a65012804774c6895e56",
                "sha256": "bf0c5491daff8f89e3e9c2b333ea54f6e10e77129e53b38b229e317caf3e6b07"
            },
            "downloads": -1,
            "filename": "lhp_api-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2a19ced71c60a65012804774c6895e56",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14798,
            "upload_time": "2024-03-02T07:10:30",
            "upload_time_iso_8601": "2024-03-02T07:10:30.649162Z",
            "url": "https://files.pythonhosted.org/packages/a0/c7/42cf0c55c813566f163a9d91d4a888bda8b123acf66be39146dc3bb7c4b9/lhp_api-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-02 07:10:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stephan192",
    "github_project": "lhp_api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lhp-api"
}
        
Elapsed time: 0.65084s