diff --git a/autotest/pst_from_tests.py b/autotest/pst_from_tests.py index 9f584a85..e0002374 100644 --- a/autotest/pst_from_tests.py +++ b/autotest/pst_from_tests.py @@ -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'), @@ -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('.') diff --git a/autotest/utils/arrayskip/AWC_subset.txt b/autotest/utils/arrayskip/AWC_subset.txt new file mode 100644 index 00000000..4122d6d1 --- /dev/null +++ b/autotest/utils/arrayskip/AWC_subset.txt @@ -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 1 1 2 1 1 2 5 2 2 2 1 1 2 2 2 1 1 5 1 1 1 1 1 1 1 1 2 2 1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 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 diff --git a/pyemu/utils/pst_from.py b/pyemu/utils/pst_from.py index 3a142f3a..a1baac5a 100644 --- a/pyemu/utils/pst_from.py +++ b/pyemu/utils/pst_from.py @@ -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) @@ -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) @@ -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}")