blob: 89c569d1980664e566a21d28eb8e8e02f987c928 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()
|