From 4c7954b33c2be0e0fcebf622c51f398299016990 Mon Sep 17 00:00:00 2001 From: davidh-ssec <david.hoese@ssec.wisc.edu> Date: Mon, 5 Feb 2018 18:52:30 -0600 Subject: [PATCH] Fix NetCDF generation when one of the input files is missing --- aosstower/level_b1/nc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aosstower/level_b1/nc.py b/aosstower/level_b1/nc.py index fe2d320..5d89d1d 100644 --- a/aosstower/level_b1/nc.py +++ b/aosstower/level_b1/nc.py @@ -302,8 +302,16 @@ def summary_over_interval(frame, interval_width): def _get_data(input_files): + bad_files = 0 for filename in input_files: - yield from parser.read_frames(filename) + try: + yield from parser.read_frames(filename) + except FileNotFoundError: + LOG.warning("Input data file was not found: {}".format(filename)) + bad_files += 1 + continue + if bad_files == len(input_files): + raise ValueError("No valid input data files found") def get_data(input_files): -- GitLab