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
11 changes: 9 additions & 2 deletions flopy/mf6/utils/binarygrid_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def __init__(self, filename, precision="double", verbose=False):
# read text strings
for idx in range(self._ntxt):
line = self.read_text(self._lentxt).strip()
if line.startswith("#"):
continue
t = line.split()
key = t[0]
dt = t[1]
Expand All @@ -105,6 +107,8 @@ def __init__(self, filename, precision="double", verbose=False):
dtype = np.float32
elif dt == "DOUBLE":
dtype = np.float64
elif dt == "CHARACTER":
dtype = str
else:
dtype = None
nd = int(t[3])
Expand All @@ -122,7 +126,7 @@ def __init__(self, filename, precision="double", verbose=False):
print(f" File contains data for {key} with shape {s}")

if self.verbose:
print(f"Attempting to read {self._ntxt} records from {filename}")
print(f"Attempting to read {len(self._recordkeys)} records from {filename}")

for key in self._recordkeys:
if self.verbose:
Expand All @@ -133,7 +137,10 @@ def __init__(self, filename, precision="double", verbose=False):
count = 1
for v in shp:
count *= v
v = self.read_record(count=count, dtype=dt)
if dt == str:
v = self.read_text(nchar=count)
else:
v = self.read_record(count=count, dtype=dt)
# read variable data
else:
if dt == np.int32:
Expand Down
Loading