summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-04-03 23:15:09 +0200
committerAki <please@ignore.pl>2023-04-03 23:15:09 +0200
commit9451fa019cb084db820f3255b0da2cc863d0f990 (patch)
treee5f43c86e8ec758b7eef0d4e50a0208f74289fb1
parent563ef8786f395ce1abe903f3341bf3a361410b7b (diff)
downloadwaterspout-radar-9451fa019cb084db820f3255b0da2cc863d0f990.zip
waterspout-radar-9451fa019cb084db820f3255b0da2cc863d0f990.tar.gz
waterspout-radar-9451fa019cb084db820f3255b0da2cc863d0f990.tar.bz2
Implemented naive web view
-rw-r--r--pyproject.toml1
-rw-r--r--waterspout_radar/web.py17
2 files changed, 18 insertions, 0 deletions
diff --git a/pyproject.toml b/pyproject.toml
index 94896c5..a0b3b65 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,7 @@
[project]
name="waterspout-radar"
dependencies=[
+ "flask==2.*",
"geopy==2.*",
"metpy==1.*",
"szilagyi",
diff --git a/waterspout_radar/web.py b/waterspout_radar/web.py
new file mode 100644
index 0000000..67ac4ca
--- /dev/null
+++ b/waterspout_radar/web.py
@@ -0,0 +1,17 @@
+import flask
+
+from . import _storage
+
+app = flask.Flask(__name__)
+
+
+@app.route("/")
+def predictions():
+ body = "<!doctype html><html lang='en'><meta charset='utf-8'><title>Predictions</title>"
+ body += "<h1>Prediction</h1><hr>"
+ body += "<table>"
+ body += "<tr><th>Time<th>&Delta;Temp<th>Depth<th>SWI</tr>"
+ for prediction in sorted(_storage.Storage(".waterspout/predictions.json"), key=lambda x: (x.time, x.swi)):
+ body += f"<tr><td>{prediction.time}<td>{prediction.temperature_difference}<td>{prediction.convective_cloud_depth}<td>{prediction.swi}</tr>"
+ body += "</table>"
+ return body