diff options
-rw-r--r-- | pyproject.toml | 1 | ||||
-rw-r--r-- | waterspout_radar/web.py | 17 |
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>Δ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 |