summaryrefslogtreecommitdiff
path: root/waterspout_radar/cli.py
blob: 24f9e53a60ae7c968aa82e19f905b38cbfcd5a92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import argparse

from . import _config, _radar, _storage


def main():
	parser = argparse.ArgumentParser()
	parser.add_argument(
		"-c", "--config", default="radar.conf",
		help="Pathname of the instance configuration file (default: %(default)s)")
	args = parser.parse_args()
	config = _config.load(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)


if __name__ == "__main__":
	main()