| .streamlit | Loading last commit info... | |
| app | ||
| assets | ||
| test | ||
| .dockerignore | ||
| .gitignore | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| docker-compose.yaml | ||
| main.py | ||
| mqtt_process.py | ||
| pytest.ini | ||
| requirements.txt | ||
| run.sh |
🌦️ Weather data visualizer
A web application for visualizing weather data from multiple sources with customizable parameters.
See demo here.
✨ Features
Visualization Options
- Metrics:
- 🌡️ Average/Min/Max temperature
- 🌧️ Precipitation
- ❄️ Snow height
- Parameters:
- 📅 Date range
- 📍 Station selection
- 🔍 Data smoothing
Data Sources
- CHMI (Czech Hydrometeorological Institute) ❗❗SEE THIS❗❗
- AERIS (French meteorological data) (Météo-France)
- OpenWeatherMap (Weather data API)
- Custom Data Input:
- 📡 MQTT/Mosquitto broker integration
- 📄 CSV file upload (single temperature datapoint per datetime only)
Available Pages
| Page | Description |
|---|---|
| Visualize | View data from automatic imports (AERIS/CHMI) |
| OpenWeatherMap | View Forecast from OpenWeatherMap API (API Key needed) |
| Visualize MQTT | View data from MQTT streams |
| Compare | Compare data from different sources |
| Aggregate | Show combined metrics across stations |
| Precipitation/Snow | Specialized precipitation views |
Admin Features (when logged in under admin email)
- Import - Add data from sources or CSV
- Delete - Remove station data
Dependencies
If you want to use docker, you need to install it.
Otherwise, you need to install the following dependencies:
- Python and pip and install the requirements from
requirements.txt:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Usage
Configuration
- Configure
.streamlit/secrets.template.toml-> rename tosecrets.toml. - MQTT: Configure
app/mosquitto_handler/config_template.py-> rename toconfig.py. - For production: Use reverse proxy (nginx/traefik recommended) for https.
Docker
- Run:
docker-compose up
- Open the browser and go to
http://localhost:8502/.
Without Docker
-
You need to change credentials in
app/db_config.pyto your own database, app is tested with PostgreSQL. -
Run:
./run.sh
Tests
- If you have a database running, you can run the tests with:
- You may have to change the database connection in
app/db_config.pyto your own database. - One test will fail. To pass it, see this.
pytest
- In the opposite case, you can run the tests with:
pytest -v -m "not real_database_connection"
PIP8
Code is written in accordance with a PEP8 style guide, without C0301 (line length) and C0103 (variable name) checks.
- You can check the code with:
pylint --disable=C0301,C0103 -sn app main.py mqtt_process.py
Exceptions
| File | Exception | Reason |
|---|---|---|
| app/mosquitto_handler/connection.py:56 | unexpected-keyword-arg | Pylint doesnt see the correct constructor. |
| app/mosquitto_handler/connection.py:56 | no-member | Pylint doesnt see the correct constructor. |
| app/importer/import_data_openweather.py:74 | too-many-instance-attributes | No way of making this smaller without losing readability |
| app/importer/import_data_openweather.py:123 | too-many-locals | We need all these variables, making class would be less readable. |
| app/streamlit_pages/aggregate.py:22-27 | R0801 | Making one function for everything would lose readability. |
| app/streamlit_pages/town_visualize.py:20 | too-many-locals | We need all these variables, making class would be less readable. |
| app/streamlit_pages/town_visualize.py:27-38 | R0801 | Making one function for everything would lose readability. |
| app/streamlit_pages/town_visualize.py:72 | too-many-arguments, too-many-positional-arguments | We need all these variables, making class would be less readable. |
| app/streamlit_pages/town_visualize.py:93 | R0801 | No need making a function when its just a graph config of few lines used on two places. |
CHMI discontinued source
CHMI discontinued this service and is now offering a new one
here.
The import process is not compatible with this.
Fortunately, I have all the files saved.
You can get them here.
All you need to do now is create data/downloaded directories in the project root and paste the unzipped files there.
Then you can click the import button and it should import successfully.
When using docker, you need to remove the data directory from .dockerignore and rebuild.
Screenshots
Main Page

Visualization
Visualize

OpenWeatherMap

Visualize MQTT

Compare

Aggregate

Precipitation/Snow

Import
