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

passing mfile_skip through to format eval #565

Merged
merged 1 commit into from
Dec 16, 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
14 changes: 14 additions & 0 deletions autotest/pst_from_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5307,6 +5307,12 @@ def test_array_fmt(tmp_path):
assert fmt == "%12.10G"
assert arr.sum(axis=1).sum() == 18

shutil.copy(Path('utils','arrayskip', "AWC_subset.txt"), tmp_path)
arr, fmt = _load_array_get_fmt(Path(tmp_path, "AWC_subset.txt"), skip=6)

arr, fmt = _load_array_get_fmt(Path(tmp_path, "AWC_subset.txt"), fullfile=True, skip=6)



def test_array_fmt_pst_from(tmp_path):
pf = PstFrom(Path("utils",'weird_array'),
Expand Down Expand Up @@ -6097,6 +6103,14 @@ def mf6_freyberg_ppu_hyperpars_thresh_invest(tmp_path):
# assert phidf["mean"].min() < phidf["mean"].max()


def arrayskip_test(tmp_path):
from pathlib import Path
pf = pyemu.utils.PstFrom(Path('utils','arrayskip'), Path(tmp_path, "template"))
pf.add_parameters("AWC_subset.txt", 'grid', mfile_skip=6)
assert pf.par_dfs[0].shape[0] == 81*57
pass



if __name__ == "__main__":
#mf6_freyberg_pp_locs_test('.')
Expand Down
63 changes: 63 additions & 0 deletions autotest/utils/arrayskip/AWC_subset.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
ncols 81
nrows 57
xllcorner 841955.000000000000
yllcorner 2208285.000000000000
cellsize 1000.000000000000
NODATA_value -9999
2 2 5 2 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 2 1 1 2 2 2 2 2 1 1 1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 @@ def _check_var_len(var, n, fill=None):
return var


def _load_array_get_fmt(fname, sep=None, fullfile=False, logger=None):
def _load_array_get_fmt(fname, sep=None, fullfile=False, skip=0, logger=None):
splitsep = sep # sep for splitting string for fmt (need to count mult delim.)
if sep is None: # need to split line with space and count multiple
splitsep = ' '
with open(fname, 'r') as fp: # load file or line
_ = [fp.readline() for _ in range(skip)]
if fullfile:
lines = [line for line in fp.readlines()]
arr = np.genfromtxt(lines, delimiter=sep, ndmin=2)
Expand All @@ -62,7 +63,7 @@ def _load_array_get_fmt(fname, sep=None, fullfile=False, logger=None):
if splitsep not in lines[0]:
return _load_array_get_fmt(fname, sep, True)
fp.seek(0) # reset pointer
arr = np.loadtxt(fp, delimiter=sep, ndmin=2) # read array
arr = np.loadtxt(fp, delimiter=sep, ndmin=2, skiprows=skip) # read array
n = 0 # counter for repeat delim when sep is None
lens, prec = [], [] # container for fmt length and precision
exps = 0 # exponential counter (could be bool)
Expand Down Expand Up @@ -1154,7 +1155,7 @@ def _par_prep(
if not dest_filepath.exists():
self.logger.lraise(f"par filename '{dest_filepath}' not found ")
# read array type input file
arr, infmt = _load_array_get_fmt(dest_filepath, sep=sep,
arr, infmt = _load_array_get_fmt(dest_filepath, sep=sep, skip=skip,
logger=self.logger)
# arr = np.loadtxt(dest_filepath, delimiter=sep, ndmin=2)
self.logger.log(f"loading array {dest_filepath}")
Expand Down
Loading