# 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": "HydrologyApi",
"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/5b/51/43d1780767c878e4963cb51748116ff3d4951ee97f1ef15a88de2a196617/HydrologyApi-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": "9a4e12f48aced286db6e5f0f246404ecdeb548ce77b696ea30371f32b64263f8",
"md5": "1c70f09c0aaf304687bd3ec7ca3d3975",
"sha256": "8ecccf5b7f0eb672789069b1375ceaf872d9dd2fc8efd836544ddbb1fd81c981"
},
"downloads": -1,
"filename": "HydrologyApi-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1c70f09c0aaf304687bd3ec7ca3d3975",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5588,
"upload_time": "2023-11-13T14:20:45",
"upload_time_iso_8601": "2023-11-13T14:20:45.514910Z",
"url": "https://files.pythonhosted.org/packages/9a/4e/12f48aced286db6e5f0f246404ecdeb548ce77b696ea30371f32b64263f8/HydrologyApi-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5b5143d1780767c878e4963cb51748116ff3d4951ee97f1ef15a88de2a196617",
"md5": "e07bea81b69f2f0cff4ecd2ac6a18e71",
"sha256": "2c30b1e7e1ce1b82ccc7081818349225d17538dfcb314f0dd7221222baaf8cb4"
},
"downloads": -1,
"filename": "HydrologyApi-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "e07bea81b69f2f0cff4ecd2ac6a18e71",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5304,
"upload_time": "2023-11-13T14:20:47",
"upload_time_iso_8601": "2023-11-13T14:20:47.261686Z",
"url": "https://files.pythonhosted.org/packages/5b/51/43d1780767c878e4963cb51748116ff3d4951ee97f1ef15a88de2a196617/HydrologyApi-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-13 14:20:47",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "hydrologyapi"
}