hydrology-api-uk-client


Namehydrology-api-uk-client JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummaryLoad data from the UK Hydology API
upload_time2023-11-13 15:12:55
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": "hydrology-api-uk-client",
    "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/72/c4/621eb0388fe2aeaaa79d8405b62b815bf7461735f68a009c19fb675ee141/hydrology_api_uk_client-0.0.1.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.1",
    "project_urls": null,
    "split_keywords": [
        "hydology",
        "api",
        "uk",
        "water",
        "data",
        "environment agency",
        "river"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fec69b087cc943cc7b6a9fbf6e7ea767bf79bfeaddc4d930cc75dc9b7da3480c",
                "md5": "c5effc1881080f5c8cf9e300eaaa32e9",
                "sha256": "7eeb7918429822baed716cec5f0fb06debcbd02fa40692ff1bf52570129172a2"
            },
            "downloads": -1,
            "filename": "hydrology_api_uk_client-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5effc1881080f5c8cf9e300eaaa32e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5717,
            "upload_time": "2023-11-13T15:12:53",
            "upload_time_iso_8601": "2023-11-13T15:12:53.910895Z",
            "url": "https://files.pythonhosted.org/packages/fe/c6/9b087cc943cc7b6a9fbf6e7ea767bf79bfeaddc4d930cc75dc9b7da3480c/hydrology_api_uk_client-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72c4621eb0388fe2aeaaa79d8405b62b815bf7461735f68a009c19fb675ee141",
                "md5": "6edeb5a416ed0b1e0d2217464b95691f",
                "sha256": "0cbb0141aa197b20e81375251cbaf2d5e3ab026624c3f562dee38a5f7d3cd6d2"
            },
            "downloads": -1,
            "filename": "hydrology_api_uk_client-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6edeb5a416ed0b1e0d2217464b95691f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5327,
            "upload_time": "2023-11-13T15:12:55",
            "upload_time_iso_8601": "2023-11-13T15:12:55.933830Z",
            "url": "https://files.pythonhosted.org/packages/72/c4/621eb0388fe2aeaaa79d8405b62b815bf7461735f68a009c19fb675ee141/hydrology_api_uk_client-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-13 15:12:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hydrology-api-uk-client"
}
        
Elapsed time: 0.29819s