Skip to content

Commit

Permalink
refactor(mfmodel.py): add error trap for missing setup_grid input; fi…
Browse files Browse the repository at this point in the history
…x error message in mf6model.py
  • Loading branch information
aleaf committed Aug 6, 2024
1 parent c303cf1 commit f01a9e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mfsetup/mf6model.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def create_lgr_models(self):
last_refined_layer = max(np.where(is_refined > 0)[0])
consecutive = all(np.diff(is_refined)[:last_refined_layer] == 0)
if (is_refined[0] != 1) | (not consecutive):
raise ValueError("Configuration input: layer_refinement must"
raise ValueError("Configuration input: layer_refinement must "
"include consecutive sequence of layers, "
"starting with the top layer.")
# check the specified DIS package input is consistent
Expand Down
6 changes: 6 additions & 0 deletions mfsetup/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,12 @@ def setup_grid(self):
self._modelgrid.cfg = self.cfg['grid']
else:
kwargs = get_input_arguments(cfg, setup_structured_grid)
if not set(kwargs.keys()).intersection({
'features_shapefile', 'features', 'xoff', 'yoff', 'xul', 'yul'}):
raise ValueError(
"No features_shapefile or xoff, yoff supplied "
"to setup_grid: block. Check configuration file input, "
"including for accidental indentation of the setup_grid: block.")
self._modelgrid = setup_structured_grid(**kwargs)
self.cfg['grid'] = self._modelgrid.cfg
# update DIS package configuration
Expand Down

0 comments on commit f01a9e5

Please sign in to comment.