Skip to content

Commit

Permalink
fix(MF6model.write_input): handle case of single obs package
Browse files Browse the repository at this point in the history
  • Loading branch information
aleaf committed Aug 27, 2024
1 parent 96d82b6 commit 0215fb8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mfsetup/mf6model.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ def _set_idomain(self):
# re-write the input files
# todo: integrate this better with setup_dis
# to reduce the number of times the arrays need to be remade

self._setup_array('dis', 'botm',
data={i: arr for i, arr in enumerate(botm)},
datatype='array3d', resample_method='linear',
Expand Down Expand Up @@ -981,7 +980,14 @@ def write_input(self):
remove_inactive_bcs(package_instance,
external_files=external_files)
if hasattr(model, 'obs'):
for obs_package_instance in model.obs:
# handle case of single obs package, in which case model.obs
# will be a ModflowUtlobs package instance
try:
len(model.obs)
obs_packages = model.obs
except:
obs_packages = [model.obs]
for obs_package_instance in obs_packages:
remove_inactive_obs(obs_package_instance)

# write the model with flopy
Expand Down

0 comments on commit 0215fb8

Please sign in to comment.