Skip to content
Snippets Groups Projects
Commit ed776a1a authored by Nick Bearson's avatar Nick Bearson
Browse files

replace exits with raises in grid_setup, and remove the realtime check

parent 007fa2f0
No related branches found
No related tags found
1 merge request!28replace exits with raises in grid_setup, and remove the realtime check
......@@ -206,34 +206,20 @@ def grid_setup(glm_files, args, work_dir=os.getcwd()):
min_events = None
min_groups = None
if args.realtime:
if len(args.filenames) != 1:
log.error("realtime mode only accepts one input file")
exit(1)
glminfo = parse_glm_filename(os.path.basename(args.filenames[0]))
if len(glm_files) != 3:
raise RuntimeError("expected three files for this minute, only received {}".format(len(glm_files)))
globstring = "{}_{}_{}_s{}*".format(glminfo[0], glminfo[1], glminfo[2], glminfo[3].strftime("%Y%j%H%M"))
fileglob = glob(os.path.join(os.path.dirname(args.filenames[0]), globstring))
if len(fileglob) != 3:
log.error("There are not (yet) three GLM files from this minute. This may be expected. Exiting.")
exit(0)
args.filenames = fileglob
for f in args.filenames:
for f in glm_files:
if not os.path.exists(f):
log.error("Tried to grid file that does not exist: {}".format(f))
exit(1)
raise RuntimeError("Tried to grid file that does not exist: {}".format(f))
if "meso" in args.goes_sector and (args.ctr_lat == None or args.ctr_lon == None):
log.error("sector 'meso' requires --ctr-lat & --ctr-lon")
exit(1)
raise RuntimeError("sector 'meso' requires --ctr-lat & --ctr-lon")
try:
start_time, end_time = get_start_end(glm_files)
except:
log.error("Could not parse start & end times from one or more of the files provided:")
log.error(", ".join(glm_files))
exit(1)
raise RuntimeError("Could not parse start & end times from one or more of the files provided: {}".format(", ".join(glm_files)))
base_date = datetime(start_time.year, start_time.month, start_time.day)
proj_name = 'geos'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment