Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mfmodel): fix budgetkey for transport models #2176

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,13 @@ def laycbd(self):

@property
def output(self):
budgetkey = None
if self.model_type == "gwt6":
budgetkey = "MASS BUDGET FOR ENTIRE MODEL"
try:
return self.oc.output
return MF6Output(self.oc, budgetkey=budgetkey)
except AttributeError:
return MF6Output(self)
return MF6Output(self, budgetkey=budgetkey)

def export(self, f, **kwargs):
"""Method to export a model to a shapefile or netcdf file
Expand Down
9 changes: 7 additions & 2 deletions flopy/mf6/utils/output_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MF6Output:

"""

def __init__(self, obj):
def __init__(self, obj, budgetkey=None):
from ..modflow import ModflowGwfoc, ModflowGwtoc, ModflowUtlobs

# set initial observation definitions
Expand All @@ -39,6 +39,11 @@ def __init__(self, obj):
self._obj = obj
self._methods = []
self._sim_ws = obj.simulation_data.mfpath.get_sim_path()
self._budgetkey = (
"VOLUME BUDGET FOR ENTIRE MODEL"
if budgetkey is None
else budgetkey
)
self.__budgetcsv = False

if not isinstance(obj, (PackageInterface, ModelInterface)):
Expand Down Expand Up @@ -382,7 +387,7 @@ def __list(self):
if self._lst is not None:
try:
list_file = os.path.join(self._sim_ws, self._lst)
return Mf6ListBudget(list_file)
return Mf6ListBudget(list_file, budgetkey=self._budgetkey)
except (AssertionError, OSError):
return None

Expand Down
Loading