Skip to content

Commit 5a94526

Browse files
fix(MfUsgWel): add get_empty() override to support WELLBOT parameter (#2656)
- Fixes TypeError when loading MFUSG models with WELLBOT option - Adds static method get_empty() that accepts wellbot parameter - WELLBOT option was already parsed in pakbase.py but not handled in dtype creation - Enables loading of USG-Transport models with well bottom elevations Resolves issue where models using 'WELLBOT' option in WEL package would fail with: TypeError: ModflowWel.get_empty() got an unexpected keyword argument 'wellbot'
1 parent e42f511 commit 5a94526

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

flopy/mfusg/mfusgwel.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,45 @@ def __init__(
238238
if add_package:
239239
self.parent.add_package(self)
240240

241+
@staticmethod
242+
def get_empty(ncells=0, aux_names=None, structured=True, wellbot=False):
243+
"""Get empty recarray for MFUSG wells.
244+
245+
Parameters
246+
----------
247+
ncells : int
248+
Number of cells
249+
aux_names : list
250+
Auxiliary variable names
251+
structured : bool
252+
Whether grid is structured
253+
wellbot : bool
254+
Whether WELLBOT option is used
255+
256+
Returns
257+
-------
258+
recarray
259+
Empty recarray for well data
260+
"""
261+
import numpy as np
262+
263+
from ..modflow.mfwel import ModflowWel
264+
from ..pakbase import Package
265+
from ..utils import create_empty_recarray
266+
267+
# Get base dtype
268+
dtype = ModflowWel.get_default_dtype(structured=structured)
269+
270+
# Add wellbot field if specified
271+
if wellbot:
272+
dtype = Package.add_to_dtype(dtype, ["wellbot"], np.float32)
273+
274+
# Add auxiliary fields
275+
if aux_names is not None:
276+
dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
277+
278+
return create_empty_recarray(ncells, dtype, default_value=-1.0e10)
279+
241280
def _check_for_aux(self, options, cln=False):
242281
"""Check dtype for auxiliary variables, and add to options.
243282

0 commit comments

Comments
 (0)