Ensure either --file or --valid and --day are given
This commit is contained in:
parent
1cec726451
commit
3d97aa45cb
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
import cairo
|
||||
|
||||
|
@ -71,6 +72,8 @@ argparser = argparse.ArgumentParser(description='Render graphical SPC outlooks f
|
|||
argparser.add_argument('--dark', action='store_true', help='Output dark mode graphics')
|
||||
argparser.add_argument('--cities', action='store_true', help='Render major cities')
|
||||
argparser.add_argument('--file', type=str, help='Load outlook from file, not database')
|
||||
|
||||
group_day_valid = argparser.add_argument_group('group_day_valid', 'SPC outlook from database')
|
||||
argparser.add_argument('--valid', type=str, help='Timestamp on or after most recent outlook')
|
||||
argparser.add_argument('--day', type=int, help='Number of days from issuance outlook applies to')
|
||||
argparser.add_argument('--categorical', type=str, help='Output categorical risk graphic file')
|
||||
|
@ -87,6 +90,10 @@ db = Database.from_config(config)
|
|||
conus = SPCOutlookMap(args.dark)
|
||||
|
||||
if args.file is None:
|
||||
if args.valid is None or args.day is None:
|
||||
print("Must specify either --file or --valid and --day", file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
outlook = SPCOutlook.for_timestamp(db, args.valid, args.day)
|
||||
else:
|
||||
with open(args.file, 'r') as fh:
|
||||
|
|
Loading…
Add table
Reference in a new issue