Skip to content

Commit ee70873

Browse files
authored
Implement error message for missing ne_file
Added error handling for missing 'ne_file' when using Avalanching.
1 parent be8d746 commit ee70873

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

aeolis/inout.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ def read_configfile(configfile, parse_files=True, load_defaults=True):
117117
# set default for nsavetimes, if not given
118118
if 'nsavetimes' in p and not p['nsavetimes']:
119119
p['nsavetimes'] = int(p['dzb_interval']/p['dt'])
120+
121+
# catch some incompatible parameter combinations.
122+
if (p['ne_file'] is None) and (p['process_avalanche'] == True):
123+
print('Please provide a valid ne_file path in the configuration file when using Avalanching.')
124+
print('Code does not proceed until this is provided.')
125+
print('Hint: If you do not have a ne_file, you can create one with all zeros, with the same dimensions as your grid.')
126+
exit("Exiting due to error")
120127

121128
return p
122129

@@ -603,4 +610,4 @@ def output_sedtrails(s, p):
603610
savemat(os.path.join('sedtrails_output', str(int(time)).zfill(12) + '.mat'), mdic)
604611
else:
605612
mdic = {'us': us, 'un': un, 'dzb': dzb, 'pickup': pickup}
606-
savemat(os.path.join('sedtrails_output', str(int(time)).zfill(12) + '.mat'), mdic)
613+
savemat(os.path.join('sedtrails_output', str(int(time)).zfill(12) + '.mat'), mdic)

0 commit comments

Comments
 (0)