diff options
author | Aki <please@ignore.pl> | 2023-04-05 21:55:36 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-04-05 21:55:36 +0200 |
commit | feea05b7c1fcd12ba8bf33670f4d2c40a773718d (patch) | |
tree | b6d50e9eb5b7f7f4ff83abe853074c80857bab54 /waterspout_radar/pull.py | |
parent | 60a8fb3e35ca46cf6d890a90e9f4a7f090e099f9 (diff) | |
download | waterspout-radar-feea05b7c1fcd12ba8bf33670f4d2c40a773718d.zip waterspout-radar-feea05b7c1fcd12ba8bf33670f4d2c40a773718d.tar.gz waterspout-radar-feea05b7c1fcd12ba8bf33670f4d2c40a773718d.tar.bz2 |
Renamed CLI utility to more obvious waterspout-pull
Diffstat (limited to 'waterspout_radar/pull.py')
-rw-r--r-- | waterspout_radar/pull.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/waterspout_radar/pull.py b/waterspout_radar/pull.py new file mode 100644 index 0000000..89c569d --- /dev/null +++ b/waterspout_radar/pull.py @@ -0,0 +1,23 @@ +""" +Pulls weather data, makes predictions and pushes them to persistent storage. +""" + +import argparse + +from . import _config, _radar, _storage + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-c", "--config", help="Overrides configuration file pathname.") + args = parser.parse_args() + config = _config.load(_config.effective_pathname(args.config)) + storage = _storage.Storage(config.db) + 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__": + main() |