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.
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.
├───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 tomainsrc: Contains python scripts for scraping and outputsconfig.py: For setting thestation_idto 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.
Firstly either fork or clone the repository:
git clone https://github.com/ASW-Analyst/river_depth/river_depth.git
cd river_depthNow create a virtual environment:
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On WindowsInstall dependencies:
pip install -r requirements.txtOpen config.py and set the station_id for the location that you wish to use.
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.
This is only possible due to river height data being made available via Flood Service at GOV.UK
