Skip to content
Merged
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
55 changes: 21 additions & 34 deletions flopy/modflow/mffhb.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from ..pakbase import Package
from ..utils.recarray_utils import create_empty_recarray
from ..utils import read1d


class ModflowFhb(Package):
Expand Down Expand Up @@ -475,7 +476,7 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
if nfhbx1 > 0:
if model.verbose:
print("loading fhb dataset 2")
print("dataset 2 will not be preserved in the created hfb object.")
print("dataset 2 will not be preserved in the created fhb object.")
for idx in range(nfhbx1):
line = f.readline()
raw = line.strip().split()
Expand All @@ -490,7 +491,7 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
if nfhbx2 > 0:
if model.verbose:
print("loading fhb dataset 3")
print("dataset 3 will not be preserved in the created hfb object.")
print("dataset 3 will not be preserved in the created fhb object.")
for idx in range(nfhbx2):
line = f.readline()
raw = line.strip().split()
Expand All @@ -517,16 +518,12 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
# Dataset 4b
if model.verbose:
print("loading fhb dataset 4b")
line = f.readline()
raw = line.strip().split()
bdtime = []
for n in range(nbdtim):
bdtime.append(float(raw[n]))

bdtime = read1d(f, np.zeros((nbdtim,)))

# Dataset 5 and 6
cnstm5 = None
ds5 = None
cnstm6 = None
ds6 = None
if nflw > 0:
if model.verbose:
Expand All @@ -545,19 +542,16 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):

if model.verbose:
print("loading fhb dataset 5b")
dtype = ModflowFhb.get_default_dtype(
nbdtim=nbdtim, head=False, structured=model.structured
)

ds5 = ModflowFhb.get_empty(
ncells=nflw,
nbdtim=nbdtim,
head=False,
structured=model.structured,
)
for n in range(nflw):
line = f.readline()
raw = line.strip().split()
ds5[n] = tuple(raw[: len(dtype.names)])
tds5 = read1d(f, np.zeros((nbdtim + 4)))
ds5[n] = tuple(tds5)

if model.structured:
ds5["k"] -= 1
Expand All @@ -572,13 +566,13 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
ds6 = []
dtype = []
for name, weight in flow_aux:
dtype.append((name, np.float32))
dtype.append((name, object))
for naux in range(nfhbx1):
if model.verbose:
print(f"loading fhb dataset 6a - aux {naux + 1}")
print(
"dataset 6a will not be preserved in "
"the created hfb object."
"the created fhb object."
)
# Dataset 6a IFHBUN CNSTM IFHBPT
line = f.readline()
Expand All @@ -597,20 +591,17 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
print(f"loading fhb dataset 6b - aux {naux + 1}")
print(
"dataset 6b will not be preserved in "
"the created hfb object."
"the created fhb object."
)
current = np.recarray(nflw, dtype=dtype)
for n in range(nflw):
line = f.readline()
raw = line.strip().split()
current[n] = tuple(raw[: len(dtype.names)])
ds6b = read1d(f, np.zeros((nbdtim,)))
current[n] = (tuple(ds6b),)
ds6.append(current.copy())

# Dataset 7
cnstm7 = None
ds7 = None
cnstm8 = None
ds8 = None
if nhed > 0:
if model.verbose:
print("loading fhb dataset 7a")
Expand All @@ -628,19 +619,16 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):

if model.verbose:
print("loading fhb dataset 7b")
dtype = ModflowFhb.get_default_dtype(
nbdtim=nbdtim, head=True, structured=model.structured
)

ds7 = ModflowFhb.get_empty(
ncells=nhed,
nbdtim=nbdtim,
head=True,
structured=model.structured,
)
for n in range(nhed):
line = f.readline()
raw = line.strip().split()
ds7[n] = tuple(raw[: len(dtype.names)])
tds7 = read1d(f, np.empty((nbdtim + 4)))
ds7[n] = tuple(tds7)

if model.structured:
ds7["k"] -= 1
Expand All @@ -655,13 +643,13 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
ds8 = []
dtype = []
for name, weight in head_aux:
dtype.append((name, np.float32))
dtype.append((name, object))
for naux in range(nfhbx1):
if model.verbose:
print(f"loading fhb dataset 8a - aux {naux + 1}")
print(
"dataset 8a will not be preserved in "
"the created hfb object."
"the created fhb object."
)
# Dataset 6a IFHBUN CNSTM IFHBPT
line = f.readline()
Expand All @@ -681,13 +669,12 @@ def load(cls, f, model, nper=None, ext_unit_dict=None):
print(f"loading fhb dataset 8b - aux {naux + 1}")
print(
"dataset 8b will not be preserved in "
"the created hfb object."
"the created fhb object."
)
current = np.recarray(nflw, dtype=dtype)
for n in range(nhed):
line = f.readline()
raw = line.strip().split()
current[n] = tuple(raw[: len(dtype.names)])
ds8b = read1d(f, np.zeros((nbdtim,)))
current[n] = (tuple(ds8b),)
ds8.append(current.copy())

if openfile:
Expand Down