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(io): read comma separated list #1285

Merged
merged 1 commit into from
Nov 2, 2021
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: 5 additions & 6 deletions flopy/utils/flopy_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def read_fixed_var(line, ncol=1, length=10, ipos=None, free=False):

"""
if free:
out = line.rstrip().split()
out = line_parse(line)
else:
# construct ipos if it was not passed
if ipos is None:
Expand Down Expand Up @@ -415,7 +415,7 @@ def ulstrd(f, nlist, ra, model, sfac_columns, ext_unit_dict):
sfac = 1.0
binary = False
ncol = len(ra.dtype.names)
line_list = line.strip().split()
line_list = line_parse(line)
close_the_file = False
file_handle = f
mode = "r"
Expand Down Expand Up @@ -461,7 +461,6 @@ def ulstrd(f, nlist, ra, model, sfac_columns, ext_unit_dict):

# check for scaling factor
if not binary:
line_list = line.strip().split()
if line.strip().lower().startswith("sfac"):
sfac = float(line_list[1])
line = file_handle.readline()
Expand All @@ -487,7 +486,7 @@ def ulstrd(f, nlist, ra, model, sfac_columns, ext_unit_dict):

if model.free_format_input:
# whitespace separated
t = line.strip().split()
t = line_parse(line)
if len(t) < ncol:
t = t + (ncol - len(t)) * [0.0]
else:
Expand Down Expand Up @@ -532,12 +531,12 @@ def get_ts_sp(line):

searchstring = "TIME STEP"
idx = line.index(searchstring) + len(searchstring)
ll = line[idx:].strip().split()
ll = line_parse(line[idx:])
ts = int(ll[0])

searchstring = "STRESS PERIOD"
idx = line.index(searchstring) + len(searchstring)
ll = line[idx:].strip().split()
ll = line_parse(line[idx:])
sp = int(ll[0])

return ts, sp