summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-04-05 21:55:36 +0200
committerAki <please@ignore.pl>2023-04-05 21:55:36 +0200
commitfeea05b7c1fcd12ba8bf33670f4d2c40a773718d (patch)
treeb6d50e9eb5b7f7f4ff83abe853074c80857bab54
parent60a8fb3e35ca46cf6d890a90e9f4a7f090e099f9 (diff)
downloadwaterspout-radar-feea05b7c1fcd12ba8bf33670f4d2c40a773718d.zip
waterspout-radar-feea05b7c1fcd12ba8bf33670f4d2c40a773718d.tar.gz
waterspout-radar-feea05b7c1fcd12ba8bf33670f4d2c40a773718d.tar.bz2
Renamed CLI utility to more obvious waterspout-pull
-rw-r--r--contrib/waterspout-pull.service2
-rw-r--r--pyproject.toml2
-rw-r--r--waterspout_radar/pull.py (renamed from waterspout_radar/cli.py)11
3 files changed, 10 insertions, 5 deletions
diff --git a/contrib/waterspout-pull.service b/contrib/waterspout-pull.service
index a212b63..74cebd1 100644
--- a/contrib/waterspout-pull.service
+++ b/contrib/waterspout-pull.service
@@ -3,5 +3,5 @@ Description=Pull data for Waterspout Radar
[Service]
Type=oneshot
-ExecStart=/usr/bin/env waterspout-radar -c /etc/waterspout-radar.ini
+ExecStart=/usr/bin/env waterspout-pull -c /etc/waterspout-radar.ini
User=waterspout
diff --git a/pyproject.toml b/pyproject.toml
index 714518f..167090b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,7 +12,7 @@ dynamic=["version"]
[project.scripts]
-waterspout-radar="waterspout_radar.cli:main"
+waterspout-pull="waterspout_radar.pull:main"
[tool.setuptools]
diff --git a/waterspout_radar/cli.py b/waterspout_radar/pull.py
index b8fb041..89c569d 100644
--- a/waterspout_radar/cli.py
+++ b/waterspout_radar/pull.py
@@ -1,3 +1,7 @@
+"""
+Pulls weather data, makes predictions and pushes them to persistent storage.
+"""
+
import argparse
from . import _config, _radar, _storage
@@ -9,9 +13,10 @@ def main():
args = parser.parse_args()
config = _config.load(_config.effective_pathname(args.config))
storage = _storage.Storage(config.db)
- storage.extend(_radar.calculate(config))
- for prediction in sorted(storage, key=lambda x: (x.time, x.swi)):
- print(prediction.time, prediction.low_clouds, prediction.swi)
+ predictions = _radar.calculate(config)
+ storage.extend(predictions)
+ for prediction in sorted(predictions, key=lambda x: (x.time, x.swi)):
+ print(prediction.time, prediction.swi)
if __name__ == "__main__":