Skip to content
Snippets Groups Projects
Commit 4471398d authored by lkugler's avatar lkugler
Browse files

catch indexerror

parent af7a41ea
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,10 @@ def _find_nature(time):
"""
glob_pattern = time.strftime(exp.nature_wrfout_pattern) # replace time in pattern
print('searching for nature in pattern:', glob_pattern)
f_nat = glob.glob(glob_pattern)[0] # find the nature wrfout-file
try:
f_nat = glob.glob(glob_pattern)[0] # find the nature wrfout-file
except IndexError:
raise IOError("no nature found with pattern "+glob_pattern)
# check user input
if not 'wrfout' in f_nat.split('/')[-1]:
......
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