Skip to content

Commit

Permalink
passing mfile_skip through to format eval (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
briochh authored Dec 16, 2024
1 parent 0d4d87d commit 0f69c6b
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
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 2 3 1 2 1 1 1 2 1 1 1 1 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 4 4 1 1 1 2 2 2 1 2 1
2 2 2 2 2 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1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 2 4 4 2 2 2 1 2 2 4 5 2 1 5 3
2 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 5 5 5 1 1 5 5 1 2 2 2 1 2 1 5 5 1 5 5 1 5 5 1 1 2 5 5 1 2 5 5 2 1 1 1 1 5 5 1 2 2 2 2 2 5 2 2 4 2 2 2 2 2 2 4 3 5 2 2 4 2
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 2 5 5 2 2 2 1 2 1 1 5 1 5 5 1 5 5 1 1 1 1 5 1 5 4 2 1 1 1 1 5 1 1 2 2 5 1 2 2 1 2 2 4 2 2 1 1 2 2 4 5 4 2 2 5 1
2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 1 1 1 5 5 1 1 2 2 5 2 2 1 2 1 5 5 1 1 1 1 5 1 1 4 2 2 1 1 2 1 5 5 2 2 1 2 1 2 2 2 2 2 4 2 2 2 2 2 2 4 2 2 2 4 2 1
1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 2 2 2 2 1 1 2 2 2 2 1 5 1 1 1 1 2 2 1 1 2 1 5 5 1 1 1 5 1 1 1 1 2 2 1 1 4 1 2 2 4 1 1 1 2 2 2 2 2 2 4 2 2 2 2 2 4 2 2 2 2 1 1 1
1 1 1 1 1 1 1 1 1 3 1 2 2 2 2 2 1 1 2 2 2 2 1 2 2 2 4 2 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 5 5 3 1 1 1 1 1 4 4 4 4 2 2 4 4 4 2 2 2 4 2 2 2 2 2 2 4 2 2 2 2 2 2 1 4 1 1
7 changes: 4 additions & 3 deletions pyemu/utils/pst_from.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ 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

0 comments on commit 0f69c6b

Please sign in to comment.