HydologyApi


NameHydologyApi JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryLoad data from the UK Hydology API
upload_time2023-11-13 13:54:47
maintainer
docs_urlNone
author
requires_python>=3.9
license
keywords hydology api uk water data environment agency river
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hydrology API

**This package was build for internal use, please feel free to use it but it may have bugs**

This package is designed to read data from the UK government [Hydrology API](https://environment.data.gov.uk/hydrology/doc/reference).
The API provides:

-   River Level, Flow and Water Quality Data
-   Rainfall Data
-   Groundwater Level Data

This package currently only provides access to the River Level, Flow, and Rainfall.

## Example

```python
from hydrology_api import HydrologyAPI, Measure, process_hydrology_data

api = HydrologyApi(max_threads=5)

stations = api.get_stations_on_river('River Wear', Measure.LEVEL)
print(f"Loading data for {len(stations)} stations: {stations['label'].values}")
level_df = api.load(Measure.LEVEL, stations)
level_df = process_hydrology_data(level_df)
level_df.info()
>>> Loading data for 5 stations: ['Chester Le Street' 'Witton Park' 'Sunderland Bridge' 'Stanhope'
 'Durham New Elvet Bridge']
>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=e7d8bbb6-5bba-4057-9f49-a299482c3348-level-i-900-m-qualified&mineq-date=2007-01-01
>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=05784319-693a-4d75-b29e-32f01a99ee4f-level-i-900-m-qualified&mineq-date=2007-01-01
>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=ddedb4d9-b2be-47c1-998d-acbc0ffb124b-level-i-900-m-qualified&mineq-date=2007-01-01
>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=b29c481a-5012-40f5-bb0c-f9370be34975-level-i-900-m-qualified&mineq-date=2007-01-01
>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=ba3f8598-e654-430d-9bb8-e1652e6ff93d-level-i-900-m-qualified&mineq-date=2007-01-01
>>> <class 'pandas.core.frame.DataFrame'>
>>> DatetimeIndex: 590967 entries, 2007-01-01 00:00:00 to 2023-11-08 21:30:00
>>> Freq: 15T
>>> Data columns (total 5 columns):
>>>  #   Column                   Non-Null Count   Dtype
>>> ---  ------                   --------------   -----
>>>  0   Chester Le Street        590967 non-null  float16
>>>  1   Durham New Elvet Bridge  563826 non-null  float16
>>>  2   Stanhope                 501615 non-null  float16
>>>  3   Sunderland Bridge        589418 non-null  float16
>>>  4   Witton Park              585167 non-null  float16
>>> dtypes: float16(5)
>>> memory usage: 10.1 MB
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "HydologyApi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "Hydology,API,UK,Water,Data,Environment Agency,River",
    "author": "",
    "author_email": "Edward Jex <edwardjex@live.co.uk>",
    "download_url": "https://files.pythonhosted.org/packages/16/c2/f8d288dcf44f3b687ba172bfe8248512b5f7b2dfb0d8d731e7ad595e2909/HydologyApi-0.0.2.tar.gz",
    "platform": null,
    "description": "# Hydrology API\n\n**This package was build for internal use, please feel free to use it but it may have bugs**\n\nThis package is designed to read data from the UK government [Hydrology API](https://environment.data.gov.uk/hydrology/doc/reference).\nThe API provides:\n\n-   River Level, Flow and Water Quality Data\n-   Rainfall Data\n-   Groundwater Level Data\n\nThis package currently only provides access to the River Level, Flow, and Rainfall.\n\n## Example\n\n```python\nfrom hydrology_api import HydrologyAPI, Measure, process_hydrology_data\n\napi = HydrologyApi(max_threads=5)\n\nstations = api.get_stations_on_river('River Wear', Measure.LEVEL)\nprint(f\"Loading data for {len(stations)} stations: {stations['label'].values}\")\nlevel_df = api.load(Measure.LEVEL, stations)\nlevel_df = process_hydrology_data(level_df)\nlevel_df.info()\n>>> Loading data for 5 stations: ['Chester Le Street' 'Witton Park' 'Sunderland Bridge' 'Stanhope'\n 'Durham New Elvet Bridge']\n>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=e7d8bbb6-5bba-4057-9f49-a299482c3348-level-i-900-m-qualified&mineq-date=2007-01-01\n>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=05784319-693a-4d75-b29e-32f01a99ee4f-level-i-900-m-qualified&mineq-date=2007-01-01\n>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=ddedb4d9-b2be-47c1-998d-acbc0ffb124b-level-i-900-m-qualified&mineq-date=2007-01-01\n>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=b29c481a-5012-40f5-bb0c-f9370be34975-level-i-900-m-qualified&mineq-date=2007-01-01\n>>> Loading from cache: https://environment.data.gov.uk/hydrology/data/batch-readings/batch/?measure=ba3f8598-e654-430d-9bb8-e1652e6ff93d-level-i-900-m-qualified&mineq-date=2007-01-01\n>>> <class 'pandas.core.frame.DataFrame'>\n>>> DatetimeIndex: 590967 entries, 2007-01-01 00:00:00 to 2023-11-08 21:30:00\n>>> Freq: 15T\n>>> Data columns (total 5 columns):\n>>>  #   Column                   Non-Null Count   Dtype\n>>> ---  ------                   --------------   -----\n>>>  0   Chester Le Street        590967 non-null  float16\n>>>  1   Durham New Elvet Bridge  563826 non-null  float16\n>>>  2   Stanhope                 501615 non-null  float16\n>>>  3   Sunderland Bridge        589418 non-null  float16\n>>>  4   Witton Park              585167 non-null  float16\n>>> dtypes: float16(5)\n>>> memory usage: 10.1 MB\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Load data from the UK Hydology API",
    "version": "0.0.2",
    "project_urls": null,
    "split_keywords": [
        "hydology",
        "api",
        "uk",
        "water",
        "data",
        "environment agency",
        "river"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a82e3b0e535dd792aaaba5383cf73adb75062c75390436f11a7dbd11fc01003",
                "md5": "3eb5d95eacf26e6ba9d50405f88810b0",
                "sha256": "edeb1dca3469f6440133bb8cafeddd28377c9e9119aba1c716bdd798517b66fd"
            },
            "downloads": -1,
            "filename": "HydologyApi-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3eb5d95eacf26e6ba9d50405f88810b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5580,
            "upload_time": "2023-11-13T13:54:45",
            "upload_time_iso_8601": "2023-11-13T13:54:45.853300Z",
            "url": "https://files.pythonhosted.org/packages/3a/82/e3b0e535dd792aaaba5383cf73adb75062c75390436f11a7dbd11fc01003/HydologyApi-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16c2f8d288dcf44f3b687ba172bfe8248512b5f7b2dfb0d8d731e7ad595e2909",
                "md5": "139621ead9543c663742ed8546e8e2f3",
                "sha256": "695d81d40d66d76cb8ef5c3af535969d173bbe5cfd03459109f214897a7307a1"
            },
            "downloads": -1,
            "filename": "HydologyApi-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "139621ead9543c663742ed8546e8e2f3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5297,
            "upload_time": "2023-11-13T13:54:47",
            "upload_time_iso_8601": "2023-11-13T13:54:47.448231Z",
            "url": "https://files.pythonhosted.org/packages/16/c2/f8d288dcf44f3b687ba172bfe8248512b5f7b2dfb0d8d731e7ad595e2909/HydologyApi-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-13 13:54:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hydologyapi"
}
        
Elapsed time: 2.86507s