Skip to content

ASW-Analyst/river_depth

Repository files navigation

River Depth

This repository has been created for displaying the latest river depth information from GOV.UK and displaying this on a Sense HAT with a raspberry pi.

Why do this?

Good question. This is a small side project so that I could get some more practice with python particularly for web-scraping and playing around with Sense HAT.

Repository Structure


├───README.md
├───LICENSE
├───requirements.txt
├───.gitignore
├───.pre-commit-config.yaml
├───.github/workflows
    └───linter.yaml
└───src
    ├───config.py
    ├───output.py
    └───scrape.py

  • README.md: This file containing an overview and instructions for using the repository.
  • LICENSE: License information for the repository.
  • requirements.txt: Python dependencies required.
  • .gitignore: Specifies the files and folders that are ignored (not tracked) in the repository.
  • .pre-commit-config.yaml: Pre-commit hooks configuration
  • .github/workflows/linter.yaml: GitHub Actions workflow for linting on push and pull requests to main
  • src: Contains python scripts for scraping and outputs
    • config.py: For setting the station_id to scrape data from.
    • output.py: For creating the message to display on the Sense HAT and the graphic of the river height.
    • scrape.py: Contains function for scraping data on the river height for the latest reading at the specified station.

Using the repository

Setup

Firstly either fork or clone the repository:

git clone https://github.com/ASW-Analyst/river_depth/river_depth.git
cd river_depth

Now create a virtual environment:

python -m venv venv
source venv/bin/activate  # On Linux/Mac
venv\Scripts\activate     # On Windows

Install dependencies:

pip install -r requirements.txt

Configuration

Open config.py and set the station_id for the location that you wish to use.

Running

You can then run the output script output.py to scrape the data and display the message and graphic on the Sense HAT:

python src/output.py

This script will:

  • Scrape the latest data from the specified station
  • Display a scrolling message with the latest readings
  • Show a visual graphic representing current water level relative to top of the normal range.

River depth message demo

Acknowledgements

This is only possible due to river height data being made available via Flood Service at GOV.UK

About

Repository for displaying river Mersey depth on Pi Hat

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages