Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hydrology

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hydrology

Load data from the UK Hydology API

  • 4.0.2
  • PyPI
  • Socket score

Maintainers
1

Hydrology API

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

This package loads data from the UK Hydrology API. 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. Data is returned as a polars DataFrame. After the first request of a given dataset, the data is cached for up to a week.

Example

>>> from hydrology import HydrologyApi, Measure
>>> from datetime import datetime
>>> api = HydrologyApi()
>>> 
>>> # Get all stations that record the water level along the River Wear in Durham
>>> stations = api.get_stations(Measure.MeasureType.LEVEL, river="River Wear")
>>> 
>>> df = api.get_measures(
>>>     [
>>>       Measure(station_id, Measure.MeasureType.LEVEL) for station_id in stations["station_id"]
>>>     ],
>>>     stations,
>>>     start_date=datetime(2020, 1, 1),
>>> )
>>> 
>>> df.head()
shape: (5, 6)
┌────────────────┬────────────────┬────────────────┬───────────────┬───────────────┬───────────────┐
│ timestamp      ┆ Durham New     ┆ Sunderland     ┆ Chester Le    ┆ Witton Park   ┆ Stanhope      │
│ ---            ┆ Elvet Bridge   ┆ Bridge         ┆ Street        ┆ level-i-900-m ┆ level-i-900-m │
│ datetime[μs]   ┆ level-…        ┆ level-i-900-…  ┆ level-i-900-… ┆ ---           ┆ ---           │
│                ┆ ---            ┆ ---            ┆ ---           ┆ f32           ┆ f32           │
│                ┆ f32            ┆ f32            ┆ f32           ┆               ┆               │
╞════════════════╪════════════════╪════════════════╪═══════════════╪═══════════════╪═══════════════╡
│ 2020-01-01     ┆ 0.3720.4170.4650.4650.344         │
│ 00:00:00       ┆                ┆                ┆               ┆               ┆               │
│ 2020-01-01     ┆ 0.3790.4180.4650.4650.344         │
│ 00:15:00       ┆                ┆                ┆               ┆               ┆               │
│ 2020-01-01     ┆ 0.3780.4170.4640.4650.344         │
│ 00:30:00       ┆                ┆                ┆               ┆               ┆               │
│ 2020-01-01     ┆ 0.3710.4170.4640.4650.344         │
│ 00:45:00       ┆                ┆                ┆               ┆               ┆               │
│ 2020-01-01     ┆ 0.3670.4170.4670.4650.344         │
│ 01:00:00       ┆                ┆                ┆               ┆               ┆               │
└────────────────┴────────────────┴────────────────┴───────────────┴───────────────┴───────────────┘

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc