Skip to content

Commit

Permalink
BUG: missing model file
Browse files Browse the repository at this point in the history
Routine previously could not handle a missing model file.  New try/except statement will allow matching to continue regardless of the exception thrown by
the user-supplied file loading module.
  • Loading branch information
aburrell committed Oct 24, 2019
1 parent 57aa2b5 commit 069d7a4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pysatModelUtils/utils/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ def collect_inst_model_pairs(start=None, stop=None, tinc=None, inst=None,
mod_file = start.strftime(model_files)

if path.isfile(mod_file):
mdata = model_load_rout(mod_file, start)
lon_high = float(mdata.coords[mod_lon_name].max())
lon_low = float(mdata.coords[mod_lon_name].min())
try:
mdata = model_load_rout(mod_file, start)
lon_high = float(mdata.coords[mod_lon_name].max())
lon_low = float(mdata.coords[mod_lon_name].min())
except Exception as err:
logger.warning("unable to load {:s}: {:}".format(mod_file, err))
mdata = None
else:
mdata = None

Expand Down

0 comments on commit 069d7a4

Please sign in to comment.