From f51bd54f5663d24be2fda64dff5389372ced39d1 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 09:58:47 -0500 Subject: [PATCH 1/8] fix(sfr): read bedk, manning, and upstream_frac from the input context MODFLOW 6.8.2 reads SFR packagedata through IDM and keeps HK, ROUGH, and USTRF only as aliases that are reported as deprecated when used through the API. For libmf6 6.8.2 and later, the packagedata hk, rough, and ustrf columns are now read from __INPUT__///BEDK, MANNING, and UPSTREAM_FRAC; earlier versions still use the legacy names. Column names are unchanged. --- autotest/test_interface.py | 38 ++++++ .../data/sfr_model/ex-gwf-sfr-p01.dis | 69 +++++++++++ .../data/sfr_model/ex-gwf-sfr-p01.evta | 29 +++++ .../data/sfr_model/ex-gwf-sfr-p01.ghb | 13 ++ .../examples/data/sfr_model/ex-gwf-sfr-p01.ic | 9 ++ .../data/sfr_model/ex-gwf-sfr-p01.ims | 17 +++ .../data/sfr_model/ex-gwf-sfr-p01.nam | 19 +++ .../data/sfr_model/ex-gwf-sfr-p01.npf | 27 +++++ .../examples/data/sfr_model/ex-gwf-sfr-p01.oc | 11 ++ .../data/sfr_model/ex-gwf-sfr-p01.rcha | 25 ++++ .../data/sfr_model/ex-gwf-sfr-p01.sfr | 111 ++++++++++++++++++ .../data/sfr_model/ex-gwf-sfr-p01.sfr.obs | 17 +++ .../data/sfr_model/ex-gwf-sfr-p01.sto | 36 ++++++ .../data/sfr_model/ex-gwf-sfr-p01.tdis | 15 +++ .../data/sfr_model/ex-gwf-sfr-p01.wel | 25 ++++ docs/examples/data/sfr_model/mfsim.nam | 19 +++ modflowapi/extensions/data.py | 4 +- modflowapi/extensions/datamodel.py | 10 ++ modflowapi/extensions/pakbase.py | 14 ++- modflowapi/util.py | 7 ++ 20 files changed, 513 insertions(+), 2 deletions(-) create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis create mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel create mode 100755 docs/examples/data/sfr_model/mfsim.nam diff --git a/autotest/test_interface.py b/autotest/test_interface.py index 79a0fcc..3db1951 100644 --- a/autotest/test_interface.py +++ b/autotest/test_interface.py @@ -9,6 +9,7 @@ from modflowapi import Callbacks, ModflowApi, run_simulation from modflowapi.extensions.apiexchange import ApiExchange from modflowapi.extensions.pakbase import AdvancedPackage, ArrayPackage, ListPackage +from modflowapi.util import libmf6_version data_pth = Path("../docs/examples/data") pytestmark = pytest.mark.extensions @@ -341,6 +342,43 @@ def callback(sim, step): raise Exception(e) +def test_sfr_input_context_names(function_tmpdir): + def callback(sim, step): + if step != Callbacks.timestep_start or sim.kper != 0 or sim.kstp != 0: + return + model = sim.get_model() + sfr = model.get_package("sfr_0") + if libmf6_version(sim.mf6) >= (6, 8, 2): + path = f"__INPUT__/{model.name}/SFR_0" + names = ("BEDK", "MANNING", "UPSTREAM_FRAC") + else: + path = f"{model.name}/SFR_0" + names = ("HK", "ROUGH", "USTRF") + addrs = [f"{path}/{name}" for name in names] + for addr in addrs: + assert addr in sfr._package_var_addrs, f"{addr} not used" + + pd = sfr.packagedata.values + for column, values in expected.items(): + np.testing.assert_allclose(pd[column], values, err_msg=f"{column} does not match the input") + + pd["hk"] *= 10.0 + sfr.packagedata = pd + np.testing.assert_allclose(sim.mf6.get_value(addrs[0]), pd["hk"], err_msg="hk is not being properly set") + + name = "sfr_model" + sim_pth = data_pth / name + test_pth = function_tmpdir / name + shutil.copytree(sim_pth, test_pth, dirs_exist_ok=True) + + # hk, rough, and ustrf columns of the packagedata block + lines = (test_pth / "ex-gwf-sfr-p01.sfr").read_text().lower().split("packagedata")[1].splitlines() + rows = [line.split() for line in lines[1:] if line.strip() and not line.strip().startswith("end")] + expected = {column: [float(row[i]) for row in rows] for column, i in (("hk", 9), ("rough", 10), ("ustrf", 12))} + + run_simulation(so, test_pth, callback) + + def test_rhs_hcof_advanced(function_tmpdir): def callback(sim, step): model = sim.test_model diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis new file mode 100755 index 0000000..54c107c --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis @@ -0,0 +1,69 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + LENGTH_UNITS feet +END options + +BEGIN dimensions + NLAY 1 + NROW 15 + NCOL 10 +END dimensions + +BEGIN griddata + delr + CONSTANT 5000.00000000 + delc + CONSTANT 5000.00000000 + top + INTERNAL FACTOR 1.0 + 1105.00000000 1105.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + 1105.00000000 1095.00000000 1105.00000000 0.00000000 0.00000000 1100.00000000 1100.00000000 1110.00000000 0.00000000 0.00000000 + 0.00000000 1100.00000000 1085.00000000 1080.00000000 1078.00000000 1076.00000000 1073.00000000 1090.00000000 0.00000000 0.00000000 + 1110.00000000 1100.00000000 1090.00000000 1085.00000000 1076.00000000 1080.00000000 1080.00000000 1070.00000000 1100.00000000 0.00000000 + 1110.00000000 1100.00000000 1085.00000000 1080.00000000 1078.00000000 1074.00000000 1077.00000000 1066.00000000 1075.00000000 1080.00000000 + 1105.00000000 1095.00000000 1080.00000000 1077.00000000 1073.00000000 1069.00000000 1070.00000000 1063.00000000 1085.00000000 1095.00000000 + 1105.00000000 1090.00000000 1075.00000000 1072.00000000 1070.00000000 1065.00000000 1065.00000000 1069.00000000 1090.00000000 0.00000000 + 0.00000000 1080.00000000 1070.00000000 1068.00000000 1063.00000000 1060.00000000 1063.00000000 1067.00000000 1090.00000000 0.00000000 + 0.00000000 1075.00000000 1065.00000000 1062.00000000 1058.00000000 1052.00000000 1055.00000000 1065.00000000 1090.00000000 0.00000000 + 0.00000000 1070.00000000 1060.00000000 1055.00000000 1046.00000000 1046.00000000 1044.00000000 1060.00000000 1088.00000000 1100.00000000 + 0.00000000 1055.00000000 1050.00000000 1045.00000000 1041.00000000 1042.00000000 1040.00000000 1050.00000000 1075.00000000 0.00000000 + 1027.00000000 1028.00000000 1028.00000000 1032.00000000 1032.00000000 1033.00000000 1032.00000000 1040.00000000 1060.00000000 0.00000000 + 997.00000000 1004.00000000 1008.00000000 1014.00000000 1020.00000000 1027.00000000 1032.00000000 1038.00000000 1050.00000000 0.00000000 + 0.00000000 1030.00000000 1040.00000000 1045.00000000 1050.00000000 1050.00000000 1050.00000000 1050.00000000 1044.00000000 0.00000000 + 0.00000000 0.00000000 1080.00000000 1080.00000000 1080.00000000 1080.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + botm + INTERNAL FACTOR 1.0 + 1000.00000000 1000.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + 1000.00000000 900.00000000 900.00000000 0.00000000 0.00000000 950.00000000 950.00000000 950.00000000 0.00000000 0.00000000 + 0.00000000 850.00000000 670.00000000 680.00000000 680.00000000 770.00000000 770.00000000 890.00000000 0.00000000 0.00000000 + 925.00000000 850.00000000 650.00000000 650.00000000 650.00000000 680.00000000 740.00000000 850.00000000 950.00000000 0.00000000 + 925.00000000 800.00000000 650.00000000 600.00000000 600.00000000 600.00000000 650.00000000 720.00000000 850.00000000 950.00000000 + 925.00000000 800.00000000 650.00000000 600.00000000 550.00000000 600.00000000 650.00000000 720.00000000 850.00000000 970.00000000 + 925.00000000 800.00000000 650.00000000 600.00000000 550.00000000 600.00000000 650.00000000 720.00000000 950.00000000 0.00000000 + 0.00000000 850.00000000 700.00000000 650.00000000 570.00000000 600.00000000 700.00000000 850.00000000 950.00000000 0.00000000 + 0.00000000 850.00000000 700.00000000 650.00000000 540.00000000 580.00000000 700.00000000 850.00000000 950.00000000 0.00000000 + 0.00000000 850.00000000 700.00000000 630.00000000 530.00000000 580.00000000 650.00000000 800.00000000 900.00000000 950.00000000 + 0.00000000 850.00000000 700.00000000 620.00000000 580.00000000 620.00000000 700.00000000 800.00000000 900.00000000 0.00000000 + 900.00000000 830.00000000 710.00000000 640.00000000 600.00000000 650.00000000 700.00000000 800.00000000 900.00000000 0.00000000 + 900.00000000 810.00000000 750.00000000 700.00000000 650.00000000 700.00000000 750.00000000 800.00000000 900.00000000 0.00000000 + 0.00000000 950.00000000 850.00000000 850.00000000 850.00000000 850.00000000 850.00000000 850.00000000 850.00000000 0.00000000 + 0.00000000 0.00000000 950.00000000 950.00000000 950.00000000 950.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + idomain + INTERNAL FACTOR 1 + 1 1 0 0 0 0 0 0 0 0 + 2 1 1 0 0 2 2 2 0 0 + 0 2 1 1 2 2 2 2 0 0 + 2 2 2 1 1 1 2 2 2 0 + 2 2 2 1 1 1 1 1 1 1 + 2 2 2 1 1 1 1 1 2 2 + 2 2 2 1 1 1 1 1 2 0 + 0 2 2 1 1 1 1 2 2 0 + 0 2 2 1 1 1 1 2 2 0 + 0 2 2 1 1 1 1 2 2 2 + 0 2 2 1 1 1 1 2 2 0 + 2 2 1 1 1 1 1 2 2 0 + 1 1 1 1 1 1 1 1 1 0 + 0 2 2 2 2 2 2 2 1 0 + 0 0 2 2 2 2 0 0 0 0 +END griddata + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta new file mode 100755 index 0000000..8f14986 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta @@ -0,0 +1,29 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + READASARRAYS +END options + +BEGIN period 1 + surface + INTERNAL FACTOR 1.0 + 1110.00000000 1110.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + 1110.00000000 1105.00000000 1110.00000000 0.00000000 0.00000000 1100.00000000 1100.00000000 1110.00000000 0.00000000 0.00000000 + 0.00000000 1100.00000000 1095.00000000 1088.00000000 1085.00000000 1085.00000000 1085.00000000 1090.00000000 0.00000000 0.00000000 + 1105.00000000 1100.00000000 1090.00000000 1083.00000000 1078.00000000 1075.00000000 1080.00000000 1085.00000000 1100.00000000 0.00000000 + 1105.00000000 1090.00000000 1080.00000000 1077.00000000 1074.00000000 1073.00000000 1074.00000000 1078.00000000 1080.00000000 1085.00000000 + 1100.00000000 1080.00000000 1075.00000000 1072.00000000 1071.00000000 1069.00000000 1070.00000000 1075.00000000 1080.00000000 1100.00000000 + 1100.00000000 1080.00000000 1070.00000000 1065.00000000 1065.00000000 1065.00000000 1065.00000000 1070.00000000 1090.00000000 0.00000000 + 0.00000000 1075.00000000 1065.00000000 1059.00000000 1059.00000000 1058.00000000 1063.00000000 1070.00000000 1090.00000000 0.00000000 + 0.00000000 1065.00000000 1055.00000000 1053.00000000 1053.00000000 1052.00000000 1055.00000000 1065.00000000 1090.00000000 0.00000000 + 0.00000000 1060.00000000 1046.00000000 1046.00000000 1046.00000000 1046.00000000 1044.00000000 1060.00000000 1088.00000000 1100.00000000 + 0.00000000 1045.00000000 1039.00000000 1040.00000000 1041.00000000 1042.00000000 1040.00000000 1050.00000000 1075.00000000 0.00000000 + 1027.00000000 1028.00000000 1028.00000000 1032.00000000 1032.00000000 1033.00000000 1032.00000000 1040.00000000 1060.00000000 0.00000000 + 997.00000000 1004.00000000 1008.00000000 1014.00000000 1020.00000000 1027.00000000 1032.00000000 1038.00000000 1050.00000000 0.00000000 + 0.00000000 1030.00000000 1040.00000000 1045.00000000 1050.00000000 1050.00000000 1050.00000000 1050.00000000 1044.00000000 0.00000000 + 0.00000000 0.00000000 1080.00000000 1080.00000000 1080.00000000 1080.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + rate + CONSTANT 9.50000000E-08 + depth + CONSTANT 15.00000000 +END period 1 + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb new file mode 100755 index 0000000..afabc48 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb @@ -0,0 +1,13 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options +END options + +BEGIN dimensions + MAXBOUND 2 +END dimensions + +BEGIN period 1 + 1 13 1 9.88000000E+02 3.80000000E-02 + 1 14 9 1.04500000E+03 3.80000000E-02 +END period 1 + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic new file mode 100755 index 0000000..c20c6c2 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic @@ -0,0 +1,9 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options +END options + +BEGIN griddata + strt + CONSTANT 1050.00000000 +END griddata + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims new file mode 100755 index 0000000..83ff848 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims @@ -0,0 +1,17 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + PRINT_OPTION summary +END options + +BEGIN nonlinear + OUTER_DVCLOSE 1.00000000E-06 + OUTER_MAXIMUM 100 +END nonlinear + +BEGIN linear + INNER_MAXIMUM 50 + INNER_DVCLOSE 1.00000000E-06 + inner_rclose 1.00000000E-06 strict + LINEAR_ACCELERATION bicgstab +END linear + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam new file mode 100755 index 0000000..3387770 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam @@ -0,0 +1,19 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + SAVE_FLOWS + NEWTON +END options + +BEGIN packages + DIS6 ex-gwf-sfr-p01.dis dis + NPF6 ex-gwf-sfr-p01.npf npf + STO6 ex-gwf-sfr-p01.sto sto + IC6 ex-gwf-sfr-p01.ic ic + GHB6 ex-gwf-sfr-p01.ghb ghb_0 + WEL6 ex-gwf-sfr-p01.wel wel_0 + RCH6 ex-gwf-sfr-p01.rcha rcha_0 + EVT6 ex-gwf-sfr-p01.evta evta_0 + SFR6 ex-gwf-sfr-p01.sfr sfr_0 + OC6 ex-gwf-sfr-p01.oc oc +END packages + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf new file mode 100755 index 0000000..a64e77f --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf @@ -0,0 +1,27 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + SAVE_SPECIFIC_DISCHARGE +END options + +BEGIN griddata + icelltype + CONSTANT 1 + k + INTERNAL FACTOR 1.0 + 0.00200000 0.00200000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + 4.00000000E-04 0.00200000 0.00200000 0.00000000 0.00000000 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 0.00000000 + 0.00000000 4.00000000E-04 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 0.00000000 + 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 + 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 + 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 + 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 0.00000000 + 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 + 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 + 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 4.00000000E-04 + 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 + 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 + 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00000000 + 0.00000000 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00000000 + 0.00000000 0.00000000 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 0.00000000 0.00000000 0.00000000 +END griddata + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc new file mode 100755 index 0000000..8ea197d --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc @@ -0,0 +1,11 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + BUDGET FILEOUT ex-gwf-sfr-p01.cbc + HEAD FILEOUT ex-gwf-sfr-p01.hds +END options + +BEGIN period 1 + SAVE HEAD LAST + SAVE BUDGET LAST +END period 1 + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha new file mode 100755 index 0000000..176fc3e --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha @@ -0,0 +1,25 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + READASARRAYS +END options + +BEGIN period 1 + recharge + INTERNAL FACTOR 1.0 + 2.50000000E-10 1.00000000E-09 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + 1.00000000E-09 2.50000000E-10 1.00000000E-09 0.00000000 0.00000000 4.00000000E-09 4.00000000E-09 4.00000000E-09 0.00000000 0.00000000 + 0.00000000 1.00000000E-09 2.50000000E-10 1.00000000E-09 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 0.00000000 0.00000000 + 4.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 4.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 + 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 + 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 4.00000000E-09 + 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 + 0.00000000 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 1.00000000E-09 2.50000000E-10 0.00000000 + 0.00000000 0.00000000 1.00000000E-09 1.00000000E-09 1.00000000E-09 1.00000000E-09 0.00000000 0.00000000 0.00000000 0.00000000 +END period 1 + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr new file mode 100755 index 0000000..ff527ca --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr @@ -0,0 +1,111 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + OBS6 FILEIN ex-gwf-sfr-p01.sfr.obs + LENGTH_CONVERSION 3.28081000 +END options + +BEGIN dimensions + NREACHES 36 +END dimensions + +BEGIN packagedata + 1 1 1 1 4500.00000000 12.00000000 8.67678960E-04 1093.04800000 3.00000000 3.00000000E-05 0.03 1 1.00000000 0 + 2 1 2 2 7000.00000000 12.00000000 8.67678960E-04 1088.05900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 3 1 3 3 6000.00000000 12.00000000 8.67678960E-04 1082.41900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 4 1 3 4 5550.00000000 12.00000000 8.67678960E-04 1077.40800000 3.00000000 3.00000000E-05 0.03 3 1.00000000 1 + 5 1 4 5 6500.00000000 12.00000000 9.43396240E-04 1071.93400000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 6 1 5 6 5000.00000000 12.00000000 9.43396240E-04 1066.50900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 7 1 6 6 5000.00000000 12.00000000 9.43396240E-04 1061.79200000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 8 1 7 6 5000.00000000 12.00000000 9.43396240E-04 1057.07500000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 9 1 8 6 5000.00000000 12.00000000 9.43396240E-04 1052.35900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 10 1 3 5 5000.00000000 10.00000000 5.45454560E-04 1073.63600000 2.00000000 3.00000000E-05 0.03 2 0.00000000 0 + 11 1 3 6 5000.00000000 10.00000000 5.45454560E-04 1070.90900000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 12 1 3 7 4500.00000000 10.00000000 5.45454560E-04 1068.31800000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 13 1 4 8 6000.00000000 10.00000000 5.45454560E-04 1065.45500000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 14 1 5 8 5000.00000000 10.00000000 5.45454560E-04 1062.45500000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 15 1 6 8 2000.00000000 10.00000000 5.45454560E-04 1060.54500000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 16 1 5 10 2500.00000000 10.00000000 0.00181818 1077.72700000 3.00000000 3.00000000E-05 0.03 1 1.00000000 0 + 17 1 5 9 5000.00000000 10.00000000 0.00181818 1070.90900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 18 1 6 8 3500.00000000 10.00000000 0.00181818 1063.18200000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 19 1 6 8 4000.00000000 15.00000000 0.00100000 1058.00000000 3.00000000 3.00000000E-05 0.03 3 1.00000000 0 + 20 1 7 7 5000.00000000 15.00000000 0.00100000 1053.50000000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 21 1 8 7 3500.00000000 15.00000000 0.00100000 1049.25000000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 22 1 8 6 2500.00000000 15.00000000 0.00100000 1046.25000000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 23 1 9 6 5000.00000000 12.00000000 9.09090920E-04 1042.72700000 3.00000000 3.00000000E-05 0.03 3 1.00000000 0 + 24 1 10 7 5000.00000000 12.00000000 9.09090920E-04 1038.18200000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 25 1 11 7 5000.00000000 12.00000000 9.09090920E-04 1033.63600000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 26 1 12 7 5000.00000000 12.00000000 9.09090920E-04 1029.09100000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 27 1 13 7 2000.00000000 12.00000000 9.09090920E-04 1025.90900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 + 28 1 14 9 5000.00000000 55.00000000 9.67741940E-04 1037.58100000 3.00000000 6.00000000E-05 0.025 1 1.00000000 0 + 29 1 13 8 5500.00000000 55.00000000 9.67741940E-04 1032.50000000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 + 30 1 13 7 5000.00000000 55.00000000 9.67741940E-04 1027.41900000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 + 31 1 13 6 5000.00000000 40.00000000 0.00125000 1021.87500000 3.00000000 6.00000000E-05 0.025 3 1.00000000 0 + 32 1 13 5 5000.00000000 40.00000000 0.00125000 1015.62500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 + 33 1 13 4 5000.00000000 40.00000000 0.00125000 1009.37500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 + 34 1 13 3 5000.00000000 40.00000000 0.00125000 1003.12500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 + 35 1 13 2 5000.00000000 40.00000000 0.00125000 996.87500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 + 36 1 13 1 3000.00000000 40.00000000 0.00125000 991.87500000 3.00000000 6.00000000E-05 0.025 1 1.00000000 0 +END packagedata + +BEGIN connectiondata + 1 -2 + 2 1 -3 + 3 2 -4 + 4 3 -5 -10 + 5 4 -6 + 6 5 -7 + 7 6 -8 + 8 7 -9 + 9 8 -23 + 10 4 -11 + 11 10 -12 + 12 11 -13 + 13 12 -14 + 14 13 -15 + 15 14 -19 + 16 -17 + 17 16 -18 + 18 17 -19 + 19 15 18 -20 + 20 19 -21 + 21 20 -22 + 22 21 -23 + 23 9 22 -24 + 24 23 -25 + 25 24 -26 + 26 25 -27 + 27 26 -31 + 28 -29 + 29 28 -30 + 30 29 -31 + 31 27 30 -32 + 32 31 -33 + 33 32 -34 + 34 33 -35 + 35 34 -36 + 36 35 +END connectiondata + +BEGIN diversions + 4 1 10 UPTO +END diversions + +BEGIN period 1 + 1 inflow 25.0 + 16 inflow 10.0 + 28 inflow 150.0 + 4 diversion 1 10.00000000 + 10 status simple + 11 status simple + 12 status simple + 13 status simple + 14 status simple + 15 status simple + 10 stage 1075.545 + 11 stage 1072.636 + 12 stage 1069.873 + 13 stage 1066.819 + 14 stage 1063.619 + 15 stage 1061.581 +END period 1 + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs new file mode 100755 index 0000000..336098b --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs @@ -0,0 +1,17 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + DIGITS 10 + PRINT_INPUT +END options + +BEGIN continuous FILEOUT ex-gwf-sfr-p01.sfr.obs.csv + r01_stage stage 4 + r02_stage stage 15 + r03_stage stage 27 + r04_stage stage 36 + r01_flow downstream-flow 4 + r02_flow downstream-flow 15 + r03_flow downstream-flow 27 + r04_flow downstream-flow 36 +END continuous FILEOUT ex-gwf-sfr-p01.sfr.obs.csv + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto new file mode 100755 index 0000000..6f44ddb --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto @@ -0,0 +1,36 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options +END options + +BEGIN griddata + iconvert + CONSTANT 1 + ss + CONSTANT 1.00000000E-06 + sy + INTERNAL FACTOR 1.0 + 0.20000000 0.20000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + 0.10000000 0.20000000 0.20000000 0.00000000 0.00000000 0.10000000 0.10000000 0.10000000 0.00000000 0.00000000 + 0.00000000 0.10000000 0.20000000 0.20000000 0.10000000 0.10000000 0.10000000 0.10000000 0.00000000 0.00000000 + 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.10000000 0.00000000 + 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 + 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 + 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.00000000 + 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 + 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 + 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.10000000 + 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 + 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 + 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.00000000 + 0.00000000 0.10000000 0.10000000 0.10000000 0.10000000 0.10000000 0.10000000 0.10000000 0.20000000 0.00000000 + 0.00000000 0.00000000 0.10000000 0.10000000 0.10000000 0.10000000 0.00000000 0.00000000 0.00000000 0.00000000 +END griddata + +BEGIN period 1 + STEADY-STATE +END period 1 + +BEGIN period 2 + TRANSIENT +END period 2 + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis new file mode 100755 index 0000000..4cdc262 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis @@ -0,0 +1,15 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options + TIME_UNITS seconds +END options + +BEGIN dimensions + NPER 3 +END dimensions + +BEGIN perioddata + 0.00000000 1 1.00000000 + 1.57788000E+09 50 1.10000000 + 1.57788000E+09 50 1.10000000 +END perioddata + diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel new file mode 100755 index 0000000..1ee2868 --- /dev/null +++ b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel @@ -0,0 +1,25 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options +END options + +BEGIN dimensions + MAXBOUND 10 +END dimensions + +BEGIN period 2 + 1 6 4 -1.00000000E+01 + 1 6 5 -1.00000000E+01 + 1 7 4 -1.00000000E+01 + 1 7 5 -1.00000000E+01 + 1 8 4 -1.00000000E+01 + 1 8 5 -1.00000000E+01 + 1 9 4 -1.00000000E+01 + 1 9 5 -1.00000000E+01 + 1 10 4 -1.00000000E+01 + 1 10 5 -1.00000000E+01 +END period 2 + +BEGIN period 3 + +END period 3 + diff --git a/docs/examples/data/sfr_model/mfsim.nam b/docs/examples/data/sfr_model/mfsim.nam new file mode 100755 index 0000000..298a7a4 --- /dev/null +++ b/docs/examples/data/sfr_model/mfsim.nam @@ -0,0 +1,19 @@ +# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. +BEGIN options +END options + +BEGIN timing + TDIS6 ex-gwf-sfr-p01.tdis +END timing + +BEGIN models + gwf6 ex-gwf-sfr-p01.nam ex-gwf-sfr-p01 +END models + +BEGIN exchanges +END exchanges + +BEGIN solutiongroup 1 + ims6 ex-gwf-sfr-p01.ims ex-gwf-sfr-p01 +END solutiongroup 1 + diff --git a/modflowapi/extensions/data.py b/modflowapi/extensions/data.py index c104da2..80aa0bb 100644 --- a/modflowapi/extensions/data.py +++ b/modflowapi/extensions/data.py @@ -110,7 +110,9 @@ def _set_data(self): else: continue - reduced = var_addr.split("/")[-1].lower() + # keep the column name of a variable read from the input context + column_names = getattr(self.parent, "_column_names", {}) + reduced = column_names.get(var_addr, var_addr.split("/")[-1].lower()) if reduced in ("maxbound", "nbound"): setattr(self, f"_{reduced}", values) if not self._spd and reduced == "maxbound": diff --git a/modflowapi/extensions/datamodel.py b/modflowapi/extensions/datamodel.py index 669a0d5..cb6daeb 100644 --- a/modflowapi/extensions/datamodel.py +++ b/modflowapi/extensions/datamodel.py @@ -275,6 +275,16 @@ "maw": {"packagedata": ["nmawwells", ("ifno:range:nmawwells", "radius", "bot", "strt", "ngwfnodes")]}, } +# advanced package variables read from the input context, keyed by column name, +# with the input context name and the first libmf6 version that uses it +adv_input_vars = { + "sfr": { + "hk": ("BEDK", (6, 8, 2)), + "rough": ("MANNING", (6, 8, 2)), + "ustrf": ("UPSTREAM_FRAC", (6, 8, 2)), + }, +} + def get_package_type(pkg_type): from .advpaks import LakPackage, MawPackage, SfrPakage, UzfPackage diff --git a/modflowapi/extensions/pakbase.py b/modflowapi/extensions/pakbase.py index 2a48c9b..73344af 100644 --- a/modflowapi/extensions/pakbase.py +++ b/modflowapi/extensions/pakbase.py @@ -1,7 +1,8 @@ import numpy as np +from ..util import libmf6_version from .data import AdvancedInput, ArrayInput, ListInput, ScalarInput -from .datamodel import adv_pkgvars, pkgvars +from .datamodel import adv_input_vars, adv_pkgvars, pkgvars class PackageBase: @@ -468,6 +469,10 @@ def __init__(self, model, pkg_type, pkg_name, sim_package=False): self._sp_var_addrs = [] self._package_vars = None self._sp_vars = None + self._input_vars = adv_input_vars.get(pkg_type, {}) + self._column_names = {} + if self._input_vars: + self._libmf6_version = libmf6_version(self.model.mf6) if pkg_type in adv_pkgvars: self._adv_var_dict = adv_pkgvars[pkg_type] @@ -550,6 +555,13 @@ def _get_advanced_variable_addr(self, var_str): ------- var_addr : str """ + var = var_str.lower() + if var in self._input_vars: + name, version = self._input_vars[var] + if self._libmf6_version >= version: + s = f"__INPUT__/{self.model.name}/{self.pkg_name}/{name}" + self._column_names[s] = var + return s s = f"{self.model.name}/{self.pkg_name}/{var_str.upper()}" return s diff --git a/modflowapi/util.py b/modflowapi/util.py index cc278ab..ac924a4 100644 --- a/modflowapi/util.py +++ b/modflowapi/util.py @@ -1,8 +1,15 @@ +import re from os import PathLike from pathlib import Path from platform import system +def libmf6_version(mf6) -> tuple[int, int, int]: + """Return the libmf6 version as a tuple of integers. Ex. (6, 8, 2)""" + match = re.match(r"(\d+)\.(\d+)\.(\d+)", mf6.get_version()) + return tuple(int(i) for i in match.groups()) + + def amend_libmf6_path(path: str | PathLike) -> str: ext = Path(path).suffix path = str(path) From 915691009d2fe66bb5a806fa057fc9994a622370 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 10:05:55 -0500 Subject: [PATCH 2/8] test(sfr): replace the copied example with a small hand-written model The SFR test used a copy of the ex-gwf-sfr-p01 example from modflow6-examples. It now uses a three-cell, three-reach model with one diversion, written by hand so the input runs on every libmf6 version tested. --- autotest/test_interface.py | 2 +- .../data/sfr_model/ex-gwf-sfr-p01.dis | 69 ----------- .../data/sfr_model/ex-gwf-sfr-p01.evta | 29 ----- .../data/sfr_model/ex-gwf-sfr-p01.ghb | 13 -- .../examples/data/sfr_model/ex-gwf-sfr-p01.ic | 9 -- .../data/sfr_model/ex-gwf-sfr-p01.ims | 17 --- .../data/sfr_model/ex-gwf-sfr-p01.nam | 19 --- .../data/sfr_model/ex-gwf-sfr-p01.npf | 27 ----- .../examples/data/sfr_model/ex-gwf-sfr-p01.oc | 11 -- .../data/sfr_model/ex-gwf-sfr-p01.rcha | 25 ---- .../data/sfr_model/ex-gwf-sfr-p01.sfr | 111 ------------------ .../data/sfr_model/ex-gwf-sfr-p01.sfr.obs | 17 --- .../data/sfr_model/ex-gwf-sfr-p01.sto | 36 ------ .../data/sfr_model/ex-gwf-sfr-p01.tdis | 15 --- .../data/sfr_model/ex-gwf-sfr-p01.wel | 25 ---- docs/examples/data/sfr_model/mfsim.nam | 10 +- docs/examples/data/sfr_model/sfr.chd | 7 ++ docs/examples/data/sfr_model/sfr.dis | 16 +++ docs/examples/data/sfr_model/sfr.ic | 4 + docs/examples/data/sfr_model/sfr.ims | 13 ++ docs/examples/data/sfr_model/sfr.nam | 10 ++ docs/examples/data/sfr_model/sfr.npf | 9 ++ docs/examples/data/sfr_model/sfr.sfr | 27 +++++ docs/examples/data/sfr_model/sfr.tdis | 8 ++ 24 files changed, 99 insertions(+), 430 deletions(-) delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis delete mode 100755 docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel mode change 100755 => 100644 docs/examples/data/sfr_model/mfsim.nam create mode 100644 docs/examples/data/sfr_model/sfr.chd create mode 100644 docs/examples/data/sfr_model/sfr.dis create mode 100644 docs/examples/data/sfr_model/sfr.ic create mode 100644 docs/examples/data/sfr_model/sfr.ims create mode 100644 docs/examples/data/sfr_model/sfr.nam create mode 100644 docs/examples/data/sfr_model/sfr.npf create mode 100644 docs/examples/data/sfr_model/sfr.sfr create mode 100644 docs/examples/data/sfr_model/sfr.tdis diff --git a/autotest/test_interface.py b/autotest/test_interface.py index 3db1951..0093dfb 100644 --- a/autotest/test_interface.py +++ b/autotest/test_interface.py @@ -372,7 +372,7 @@ def callback(sim, step): shutil.copytree(sim_pth, test_pth, dirs_exist_ok=True) # hk, rough, and ustrf columns of the packagedata block - lines = (test_pth / "ex-gwf-sfr-p01.sfr").read_text().lower().split("packagedata")[1].splitlines() + lines = (test_pth / "sfr.sfr").read_text().lower().split("packagedata")[1].splitlines() rows = [line.split() for line in lines[1:] if line.strip() and not line.strip().startswith("end")] expected = {column: [float(row[i]) for row in rows] for column, i in (("hk", 9), ("rough", 10), ("ustrf", 12))} diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis deleted file mode 100755 index 54c107c..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.dis +++ /dev/null @@ -1,69 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - LENGTH_UNITS feet -END options - -BEGIN dimensions - NLAY 1 - NROW 15 - NCOL 10 -END dimensions - -BEGIN griddata - delr - CONSTANT 5000.00000000 - delc - CONSTANT 5000.00000000 - top - INTERNAL FACTOR 1.0 - 1105.00000000 1105.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - 1105.00000000 1095.00000000 1105.00000000 0.00000000 0.00000000 1100.00000000 1100.00000000 1110.00000000 0.00000000 0.00000000 - 0.00000000 1100.00000000 1085.00000000 1080.00000000 1078.00000000 1076.00000000 1073.00000000 1090.00000000 0.00000000 0.00000000 - 1110.00000000 1100.00000000 1090.00000000 1085.00000000 1076.00000000 1080.00000000 1080.00000000 1070.00000000 1100.00000000 0.00000000 - 1110.00000000 1100.00000000 1085.00000000 1080.00000000 1078.00000000 1074.00000000 1077.00000000 1066.00000000 1075.00000000 1080.00000000 - 1105.00000000 1095.00000000 1080.00000000 1077.00000000 1073.00000000 1069.00000000 1070.00000000 1063.00000000 1085.00000000 1095.00000000 - 1105.00000000 1090.00000000 1075.00000000 1072.00000000 1070.00000000 1065.00000000 1065.00000000 1069.00000000 1090.00000000 0.00000000 - 0.00000000 1080.00000000 1070.00000000 1068.00000000 1063.00000000 1060.00000000 1063.00000000 1067.00000000 1090.00000000 0.00000000 - 0.00000000 1075.00000000 1065.00000000 1062.00000000 1058.00000000 1052.00000000 1055.00000000 1065.00000000 1090.00000000 0.00000000 - 0.00000000 1070.00000000 1060.00000000 1055.00000000 1046.00000000 1046.00000000 1044.00000000 1060.00000000 1088.00000000 1100.00000000 - 0.00000000 1055.00000000 1050.00000000 1045.00000000 1041.00000000 1042.00000000 1040.00000000 1050.00000000 1075.00000000 0.00000000 - 1027.00000000 1028.00000000 1028.00000000 1032.00000000 1032.00000000 1033.00000000 1032.00000000 1040.00000000 1060.00000000 0.00000000 - 997.00000000 1004.00000000 1008.00000000 1014.00000000 1020.00000000 1027.00000000 1032.00000000 1038.00000000 1050.00000000 0.00000000 - 0.00000000 1030.00000000 1040.00000000 1045.00000000 1050.00000000 1050.00000000 1050.00000000 1050.00000000 1044.00000000 0.00000000 - 0.00000000 0.00000000 1080.00000000 1080.00000000 1080.00000000 1080.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - botm - INTERNAL FACTOR 1.0 - 1000.00000000 1000.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - 1000.00000000 900.00000000 900.00000000 0.00000000 0.00000000 950.00000000 950.00000000 950.00000000 0.00000000 0.00000000 - 0.00000000 850.00000000 670.00000000 680.00000000 680.00000000 770.00000000 770.00000000 890.00000000 0.00000000 0.00000000 - 925.00000000 850.00000000 650.00000000 650.00000000 650.00000000 680.00000000 740.00000000 850.00000000 950.00000000 0.00000000 - 925.00000000 800.00000000 650.00000000 600.00000000 600.00000000 600.00000000 650.00000000 720.00000000 850.00000000 950.00000000 - 925.00000000 800.00000000 650.00000000 600.00000000 550.00000000 600.00000000 650.00000000 720.00000000 850.00000000 970.00000000 - 925.00000000 800.00000000 650.00000000 600.00000000 550.00000000 600.00000000 650.00000000 720.00000000 950.00000000 0.00000000 - 0.00000000 850.00000000 700.00000000 650.00000000 570.00000000 600.00000000 700.00000000 850.00000000 950.00000000 0.00000000 - 0.00000000 850.00000000 700.00000000 650.00000000 540.00000000 580.00000000 700.00000000 850.00000000 950.00000000 0.00000000 - 0.00000000 850.00000000 700.00000000 630.00000000 530.00000000 580.00000000 650.00000000 800.00000000 900.00000000 950.00000000 - 0.00000000 850.00000000 700.00000000 620.00000000 580.00000000 620.00000000 700.00000000 800.00000000 900.00000000 0.00000000 - 900.00000000 830.00000000 710.00000000 640.00000000 600.00000000 650.00000000 700.00000000 800.00000000 900.00000000 0.00000000 - 900.00000000 810.00000000 750.00000000 700.00000000 650.00000000 700.00000000 750.00000000 800.00000000 900.00000000 0.00000000 - 0.00000000 950.00000000 850.00000000 850.00000000 850.00000000 850.00000000 850.00000000 850.00000000 850.00000000 0.00000000 - 0.00000000 0.00000000 950.00000000 950.00000000 950.00000000 950.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - idomain - INTERNAL FACTOR 1 - 1 1 0 0 0 0 0 0 0 0 - 2 1 1 0 0 2 2 2 0 0 - 0 2 1 1 2 2 2 2 0 0 - 2 2 2 1 1 1 2 2 2 0 - 2 2 2 1 1 1 1 1 1 1 - 2 2 2 1 1 1 1 1 2 2 - 2 2 2 1 1 1 1 1 2 0 - 0 2 2 1 1 1 1 2 2 0 - 0 2 2 1 1 1 1 2 2 0 - 0 2 2 1 1 1 1 2 2 2 - 0 2 2 1 1 1 1 2 2 0 - 2 2 1 1 1 1 1 2 2 0 - 1 1 1 1 1 1 1 1 1 0 - 0 2 2 2 2 2 2 2 1 0 - 0 0 2 2 2 2 0 0 0 0 -END griddata - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta deleted file mode 100755 index 8f14986..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.evta +++ /dev/null @@ -1,29 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - READASARRAYS -END options - -BEGIN period 1 - surface - INTERNAL FACTOR 1.0 - 1110.00000000 1110.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - 1110.00000000 1105.00000000 1110.00000000 0.00000000 0.00000000 1100.00000000 1100.00000000 1110.00000000 0.00000000 0.00000000 - 0.00000000 1100.00000000 1095.00000000 1088.00000000 1085.00000000 1085.00000000 1085.00000000 1090.00000000 0.00000000 0.00000000 - 1105.00000000 1100.00000000 1090.00000000 1083.00000000 1078.00000000 1075.00000000 1080.00000000 1085.00000000 1100.00000000 0.00000000 - 1105.00000000 1090.00000000 1080.00000000 1077.00000000 1074.00000000 1073.00000000 1074.00000000 1078.00000000 1080.00000000 1085.00000000 - 1100.00000000 1080.00000000 1075.00000000 1072.00000000 1071.00000000 1069.00000000 1070.00000000 1075.00000000 1080.00000000 1100.00000000 - 1100.00000000 1080.00000000 1070.00000000 1065.00000000 1065.00000000 1065.00000000 1065.00000000 1070.00000000 1090.00000000 0.00000000 - 0.00000000 1075.00000000 1065.00000000 1059.00000000 1059.00000000 1058.00000000 1063.00000000 1070.00000000 1090.00000000 0.00000000 - 0.00000000 1065.00000000 1055.00000000 1053.00000000 1053.00000000 1052.00000000 1055.00000000 1065.00000000 1090.00000000 0.00000000 - 0.00000000 1060.00000000 1046.00000000 1046.00000000 1046.00000000 1046.00000000 1044.00000000 1060.00000000 1088.00000000 1100.00000000 - 0.00000000 1045.00000000 1039.00000000 1040.00000000 1041.00000000 1042.00000000 1040.00000000 1050.00000000 1075.00000000 0.00000000 - 1027.00000000 1028.00000000 1028.00000000 1032.00000000 1032.00000000 1033.00000000 1032.00000000 1040.00000000 1060.00000000 0.00000000 - 997.00000000 1004.00000000 1008.00000000 1014.00000000 1020.00000000 1027.00000000 1032.00000000 1038.00000000 1050.00000000 0.00000000 - 0.00000000 1030.00000000 1040.00000000 1045.00000000 1050.00000000 1050.00000000 1050.00000000 1050.00000000 1044.00000000 0.00000000 - 0.00000000 0.00000000 1080.00000000 1080.00000000 1080.00000000 1080.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - rate - CONSTANT 9.50000000E-08 - depth - CONSTANT 15.00000000 -END period 1 - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb deleted file mode 100755 index afabc48..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ghb +++ /dev/null @@ -1,13 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options -END options - -BEGIN dimensions - MAXBOUND 2 -END dimensions - -BEGIN period 1 - 1 13 1 9.88000000E+02 3.80000000E-02 - 1 14 9 1.04500000E+03 3.80000000E-02 -END period 1 - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic deleted file mode 100755 index c20c6c2..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ic +++ /dev/null @@ -1,9 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options -END options - -BEGIN griddata - strt - CONSTANT 1050.00000000 -END griddata - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims deleted file mode 100755 index 83ff848..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.ims +++ /dev/null @@ -1,17 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - PRINT_OPTION summary -END options - -BEGIN nonlinear - OUTER_DVCLOSE 1.00000000E-06 - OUTER_MAXIMUM 100 -END nonlinear - -BEGIN linear - INNER_MAXIMUM 50 - INNER_DVCLOSE 1.00000000E-06 - inner_rclose 1.00000000E-06 strict - LINEAR_ACCELERATION bicgstab -END linear - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam deleted file mode 100755 index 3387770..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.nam +++ /dev/null @@ -1,19 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - SAVE_FLOWS - NEWTON -END options - -BEGIN packages - DIS6 ex-gwf-sfr-p01.dis dis - NPF6 ex-gwf-sfr-p01.npf npf - STO6 ex-gwf-sfr-p01.sto sto - IC6 ex-gwf-sfr-p01.ic ic - GHB6 ex-gwf-sfr-p01.ghb ghb_0 - WEL6 ex-gwf-sfr-p01.wel wel_0 - RCH6 ex-gwf-sfr-p01.rcha rcha_0 - EVT6 ex-gwf-sfr-p01.evta evta_0 - SFR6 ex-gwf-sfr-p01.sfr sfr_0 - OC6 ex-gwf-sfr-p01.oc oc -END packages - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf deleted file mode 100755 index a64e77f..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.npf +++ /dev/null @@ -1,27 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - SAVE_SPECIFIC_DISCHARGE -END options - -BEGIN griddata - icelltype - CONSTANT 1 - k - INTERNAL FACTOR 1.0 - 0.00200000 0.00200000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - 4.00000000E-04 0.00200000 0.00200000 0.00000000 0.00000000 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 0.00000000 - 0.00000000 4.00000000E-04 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 0.00000000 - 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 - 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 - 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 - 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 0.00000000 - 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 - 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 - 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 4.00000000E-04 - 0.00000000 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 - 4.00000000E-04 4.00000000E-04 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 4.00000000E-04 4.00000000E-04 0.00000000 - 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00000000 - 0.00000000 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00200000 0.00000000 - 0.00000000 0.00000000 4.00000000E-04 4.00000000E-04 4.00000000E-04 4.00000000E-04 0.00000000 0.00000000 0.00000000 0.00000000 -END griddata - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc deleted file mode 100755 index 8ea197d..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.oc +++ /dev/null @@ -1,11 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - BUDGET FILEOUT ex-gwf-sfr-p01.cbc - HEAD FILEOUT ex-gwf-sfr-p01.hds -END options - -BEGIN period 1 - SAVE HEAD LAST - SAVE BUDGET LAST -END period 1 - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha deleted file mode 100755 index 176fc3e..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.rcha +++ /dev/null @@ -1,25 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - READASARRAYS -END options - -BEGIN period 1 - recharge - INTERNAL FACTOR 1.0 - 2.50000000E-10 1.00000000E-09 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - 1.00000000E-09 2.50000000E-10 1.00000000E-09 0.00000000 0.00000000 4.00000000E-09 4.00000000E-09 4.00000000E-09 0.00000000 0.00000000 - 0.00000000 1.00000000E-09 2.50000000E-10 1.00000000E-09 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 0.00000000 0.00000000 - 4.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 4.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 - 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 - 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 4.00000000E-09 - 0.00000000 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 1.00000000E-09 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 0.00000000 - 0.00000000 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 2.50000000E-10 1.00000000E-09 1.00000000E-09 2.50000000E-10 0.00000000 - 0.00000000 0.00000000 1.00000000E-09 1.00000000E-09 1.00000000E-09 1.00000000E-09 0.00000000 0.00000000 0.00000000 0.00000000 -END period 1 - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr deleted file mode 100755 index ff527ca..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr +++ /dev/null @@ -1,111 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - OBS6 FILEIN ex-gwf-sfr-p01.sfr.obs - LENGTH_CONVERSION 3.28081000 -END options - -BEGIN dimensions - NREACHES 36 -END dimensions - -BEGIN packagedata - 1 1 1 1 4500.00000000 12.00000000 8.67678960E-04 1093.04800000 3.00000000 3.00000000E-05 0.03 1 1.00000000 0 - 2 1 2 2 7000.00000000 12.00000000 8.67678960E-04 1088.05900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 3 1 3 3 6000.00000000 12.00000000 8.67678960E-04 1082.41900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 4 1 3 4 5550.00000000 12.00000000 8.67678960E-04 1077.40800000 3.00000000 3.00000000E-05 0.03 3 1.00000000 1 - 5 1 4 5 6500.00000000 12.00000000 9.43396240E-04 1071.93400000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 6 1 5 6 5000.00000000 12.00000000 9.43396240E-04 1066.50900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 7 1 6 6 5000.00000000 12.00000000 9.43396240E-04 1061.79200000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 8 1 7 6 5000.00000000 12.00000000 9.43396240E-04 1057.07500000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 9 1 8 6 5000.00000000 12.00000000 9.43396240E-04 1052.35900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 10 1 3 5 5000.00000000 10.00000000 5.45454560E-04 1073.63600000 2.00000000 3.00000000E-05 0.03 2 0.00000000 0 - 11 1 3 6 5000.00000000 10.00000000 5.45454560E-04 1070.90900000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 12 1 3 7 4500.00000000 10.00000000 5.45454560E-04 1068.31800000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 13 1 4 8 6000.00000000 10.00000000 5.45454560E-04 1065.45500000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 14 1 5 8 5000.00000000 10.00000000 5.45454560E-04 1062.45500000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 15 1 6 8 2000.00000000 10.00000000 5.45454560E-04 1060.54500000 2.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 16 1 5 10 2500.00000000 10.00000000 0.00181818 1077.72700000 3.00000000 3.00000000E-05 0.03 1 1.00000000 0 - 17 1 5 9 5000.00000000 10.00000000 0.00181818 1070.90900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 18 1 6 8 3500.00000000 10.00000000 0.00181818 1063.18200000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 19 1 6 8 4000.00000000 15.00000000 0.00100000 1058.00000000 3.00000000 3.00000000E-05 0.03 3 1.00000000 0 - 20 1 7 7 5000.00000000 15.00000000 0.00100000 1053.50000000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 21 1 8 7 3500.00000000 15.00000000 0.00100000 1049.25000000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 22 1 8 6 2500.00000000 15.00000000 0.00100000 1046.25000000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 23 1 9 6 5000.00000000 12.00000000 9.09090920E-04 1042.72700000 3.00000000 3.00000000E-05 0.03 3 1.00000000 0 - 24 1 10 7 5000.00000000 12.00000000 9.09090920E-04 1038.18200000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 25 1 11 7 5000.00000000 12.00000000 9.09090920E-04 1033.63600000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 26 1 12 7 5000.00000000 12.00000000 9.09090920E-04 1029.09100000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 27 1 13 7 2000.00000000 12.00000000 9.09090920E-04 1025.90900000 3.00000000 3.00000000E-05 0.03 2 1.00000000 0 - 28 1 14 9 5000.00000000 55.00000000 9.67741940E-04 1037.58100000 3.00000000 6.00000000E-05 0.025 1 1.00000000 0 - 29 1 13 8 5500.00000000 55.00000000 9.67741940E-04 1032.50000000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 - 30 1 13 7 5000.00000000 55.00000000 9.67741940E-04 1027.41900000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 - 31 1 13 6 5000.00000000 40.00000000 0.00125000 1021.87500000 3.00000000 6.00000000E-05 0.025 3 1.00000000 0 - 32 1 13 5 5000.00000000 40.00000000 0.00125000 1015.62500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 - 33 1 13 4 5000.00000000 40.00000000 0.00125000 1009.37500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 - 34 1 13 3 5000.00000000 40.00000000 0.00125000 1003.12500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 - 35 1 13 2 5000.00000000 40.00000000 0.00125000 996.87500000 3.00000000 6.00000000E-05 0.025 2 1.00000000 0 - 36 1 13 1 3000.00000000 40.00000000 0.00125000 991.87500000 3.00000000 6.00000000E-05 0.025 1 1.00000000 0 -END packagedata - -BEGIN connectiondata - 1 -2 - 2 1 -3 - 3 2 -4 - 4 3 -5 -10 - 5 4 -6 - 6 5 -7 - 7 6 -8 - 8 7 -9 - 9 8 -23 - 10 4 -11 - 11 10 -12 - 12 11 -13 - 13 12 -14 - 14 13 -15 - 15 14 -19 - 16 -17 - 17 16 -18 - 18 17 -19 - 19 15 18 -20 - 20 19 -21 - 21 20 -22 - 22 21 -23 - 23 9 22 -24 - 24 23 -25 - 25 24 -26 - 26 25 -27 - 27 26 -31 - 28 -29 - 29 28 -30 - 30 29 -31 - 31 27 30 -32 - 32 31 -33 - 33 32 -34 - 34 33 -35 - 35 34 -36 - 36 35 -END connectiondata - -BEGIN diversions - 4 1 10 UPTO -END diversions - -BEGIN period 1 - 1 inflow 25.0 - 16 inflow 10.0 - 28 inflow 150.0 - 4 diversion 1 10.00000000 - 10 status simple - 11 status simple - 12 status simple - 13 status simple - 14 status simple - 15 status simple - 10 stage 1075.545 - 11 stage 1072.636 - 12 stage 1069.873 - 13 stage 1066.819 - 14 stage 1063.619 - 15 stage 1061.581 -END period 1 - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs deleted file mode 100755 index 336098b..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sfr.obs +++ /dev/null @@ -1,17 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - DIGITS 10 - PRINT_INPUT -END options - -BEGIN continuous FILEOUT ex-gwf-sfr-p01.sfr.obs.csv - r01_stage stage 4 - r02_stage stage 15 - r03_stage stage 27 - r04_stage stage 36 - r01_flow downstream-flow 4 - r02_flow downstream-flow 15 - r03_flow downstream-flow 27 - r04_flow downstream-flow 36 -END continuous FILEOUT ex-gwf-sfr-p01.sfr.obs.csv - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto deleted file mode 100755 index 6f44ddb..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.sto +++ /dev/null @@ -1,36 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options -END options - -BEGIN griddata - iconvert - CONSTANT 1 - ss - CONSTANT 1.00000000E-06 - sy - INTERNAL FACTOR 1.0 - 0.20000000 0.20000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 - 0.10000000 0.20000000 0.20000000 0.00000000 0.00000000 0.10000000 0.10000000 0.10000000 0.00000000 0.00000000 - 0.00000000 0.10000000 0.20000000 0.20000000 0.10000000 0.10000000 0.10000000 0.10000000 0.00000000 0.00000000 - 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.10000000 0.00000000 - 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 - 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 - 0.10000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.00000000 - 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 - 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 - 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.10000000 - 0.00000000 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 - 0.10000000 0.10000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.10000000 0.10000000 0.00000000 - 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.20000000 0.00000000 - 0.00000000 0.10000000 0.10000000 0.10000000 0.10000000 0.10000000 0.10000000 0.10000000 0.20000000 0.00000000 - 0.00000000 0.00000000 0.10000000 0.10000000 0.10000000 0.10000000 0.00000000 0.00000000 0.00000000 0.00000000 -END griddata - -BEGIN period 1 - STEADY-STATE -END period 1 - -BEGIN period 2 - TRANSIENT -END period 2 - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis deleted file mode 100755 index 4cdc262..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.tdis +++ /dev/null @@ -1,15 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options - TIME_UNITS seconds -END options - -BEGIN dimensions - NPER 3 -END dimensions - -BEGIN perioddata - 0.00000000 1 1.00000000 - 1.57788000E+09 50 1.10000000 - 1.57788000E+09 50 1.10000000 -END perioddata - diff --git a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel b/docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel deleted file mode 100755 index 1ee2868..0000000 --- a/docs/examples/data/sfr_model/ex-gwf-sfr-p01.wel +++ /dev/null @@ -1,25 +0,0 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. -BEGIN options -END options - -BEGIN dimensions - MAXBOUND 10 -END dimensions - -BEGIN period 2 - 1 6 4 -1.00000000E+01 - 1 6 5 -1.00000000E+01 - 1 7 4 -1.00000000E+01 - 1 7 5 -1.00000000E+01 - 1 8 4 -1.00000000E+01 - 1 8 5 -1.00000000E+01 - 1 9 4 -1.00000000E+01 - 1 9 5 -1.00000000E+01 - 1 10 4 -1.00000000E+01 - 1 10 5 -1.00000000E+01 -END period 2 - -BEGIN period 3 - -END period 3 - diff --git a/docs/examples/data/sfr_model/mfsim.nam b/docs/examples/data/sfr_model/mfsim.nam old mode 100755 new mode 100644 index 298a7a4..a9cebe8 --- a/docs/examples/data/sfr_model/mfsim.nam +++ b/docs/examples/data/sfr_model/mfsim.nam @@ -1,19 +1,17 @@ -# File generated by Flopy version 3.8.0 on 10/07/2024 at 16:02:14. BEGIN options END options BEGIN timing - TDIS6 ex-gwf-sfr-p01.tdis + TDIS6 sfr.tdis END timing BEGIN models - gwf6 ex-gwf-sfr-p01.nam ex-gwf-sfr-p01 + gwf6 sfr.nam sfr END models BEGIN exchanges END exchanges BEGIN solutiongroup 1 - ims6 ex-gwf-sfr-p01.ims ex-gwf-sfr-p01 -END solutiongroup 1 - + ims6 sfr.ims sfr +END solutiongroup diff --git a/docs/examples/data/sfr_model/sfr.chd b/docs/examples/data/sfr_model/sfr.chd new file mode 100644 index 0000000..47096f6 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.chd @@ -0,0 +1,7 @@ +BEGIN dimensions + MAXBOUND 1 +END dimensions + +BEGIN period 1 + 1 1 1 8.0 +END period diff --git a/docs/examples/data/sfr_model/sfr.dis b/docs/examples/data/sfr_model/sfr.dis new file mode 100644 index 0000000..49234d8 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.dis @@ -0,0 +1,16 @@ +BEGIN dimensions + NLAY 1 + NROW 1 + NCOL 3 +END dimensions + +BEGIN griddata + delr + CONSTANT 100.0 + delc + CONSTANT 100.0 + top + CONSTANT 10.0 + botm + CONSTANT 0.0 +END griddata diff --git a/docs/examples/data/sfr_model/sfr.ic b/docs/examples/data/sfr_model/sfr.ic new file mode 100644 index 0000000..50e8d17 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.ic @@ -0,0 +1,4 @@ +BEGIN griddata + strt + CONSTANT 8.0 +END griddata diff --git a/docs/examples/data/sfr_model/sfr.ims b/docs/examples/data/sfr_model/sfr.ims new file mode 100644 index 0000000..7556fef --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.ims @@ -0,0 +1,13 @@ +BEGIN options +END options + +BEGIN nonlinear + OUTER_DVCLOSE 1.0e-6 + OUTER_MAXIMUM 100 +END nonlinear + +BEGIN linear + INNER_DVCLOSE 1.0e-8 + INNER_RCLOSE 1.0e-6 + INNER_MAXIMUM 100 +END linear diff --git a/docs/examples/data/sfr_model/sfr.nam b/docs/examples/data/sfr_model/sfr.nam new file mode 100644 index 0000000..0654ee3 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.nam @@ -0,0 +1,10 @@ +BEGIN options +END options + +BEGIN packages + DIS6 sfr.dis dis + NPF6 sfr.npf npf + IC6 sfr.ic ic + CHD6 sfr.chd chd_0 + SFR6 sfr.sfr sfr_0 +END packages diff --git a/docs/examples/data/sfr_model/sfr.npf b/docs/examples/data/sfr_model/sfr.npf new file mode 100644 index 0000000..b4c4863 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.npf @@ -0,0 +1,9 @@ +BEGIN options +END options + +BEGIN griddata + icelltype + CONSTANT 0 + k + CONSTANT 10.0 +END griddata diff --git a/docs/examples/data/sfr_model/sfr.sfr b/docs/examples/data/sfr_model/sfr.sfr new file mode 100644 index 0000000..50610a7 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.sfr @@ -0,0 +1,27 @@ +BEGIN options +END options + +BEGIN dimensions + NREACHES 3 +END dimensions + +BEGIN packagedata + 1 1 1 1 100.0 10.0 0.001 9.0 1.0 0.1 0.030 2 1.0 1 + 2 1 1 2 100.0 10.0 0.001 8.9 1.0 0.2 0.035 1 1.0 0 + 3 1 1 3 100.0 5.0 0.001 8.9 1.0 0.3 0.040 1 0.0 0 +END packagedata + +BEGIN connectiondata + 1 -2 -3 + 2 1 + 3 1 +END connectiondata + +BEGIN diversions + 1 1 3 UPTO +END diversions + +BEGIN period 1 + 1 INFLOW 10.0 + 1 DIVERSION 1 2.0 +END period diff --git a/docs/examples/data/sfr_model/sfr.tdis b/docs/examples/data/sfr_model/sfr.tdis new file mode 100644 index 0000000..60aca42 --- /dev/null +++ b/docs/examples/data/sfr_model/sfr.tdis @@ -0,0 +1,8 @@ +BEGIN dimensions + NPER 2 +END dimensions + +BEGIN perioddata + 1.0 1 1.0 + 1.0 1 1.0 +END perioddata From a6562892086ba5e8dc20928d92670fd2acb539d9 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 11:13:06 -0500 Subject: [PATCH 3/8] test(sfr): build the sfr test model with flopy The SFR test read a hand-written model committed to docs/examples/data. It now builds the same three-reach model with flopy in the test directory, and takes the expected hk, rough, and ustrf values from the arrays passed to flopy. flopy is added to the test dependency group. --- autotest/test_interface.py | 54 +++++++++++++++++++++----- docs/examples/data/sfr_model/mfsim.nam | 17 -------- docs/examples/data/sfr_model/sfr.chd | 7 ---- docs/examples/data/sfr_model/sfr.dis | 16 -------- docs/examples/data/sfr_model/sfr.ic | 4 -- docs/examples/data/sfr_model/sfr.ims | 13 ------- docs/examples/data/sfr_model/sfr.nam | 10 ----- docs/examples/data/sfr_model/sfr.npf | 9 ----- docs/examples/data/sfr_model/sfr.sfr | 27 ------------- docs/examples/data/sfr_model/sfr.tdis | 8 ---- pyproject.toml | 1 + 11 files changed, 46 insertions(+), 120 deletions(-) delete mode 100644 docs/examples/data/sfr_model/mfsim.nam delete mode 100644 docs/examples/data/sfr_model/sfr.chd delete mode 100644 docs/examples/data/sfr_model/sfr.dis delete mode 100644 docs/examples/data/sfr_model/sfr.ic delete mode 100644 docs/examples/data/sfr_model/sfr.ims delete mode 100644 docs/examples/data/sfr_model/sfr.nam delete mode 100644 docs/examples/data/sfr_model/sfr.npf delete mode 100644 docs/examples/data/sfr_model/sfr.sfr delete mode 100644 docs/examples/data/sfr_model/sfr.tdis diff --git a/autotest/test_interface.py b/autotest/test_interface.py index 0093dfb..e7818ab 100644 --- a/autotest/test_interface.py +++ b/autotest/test_interface.py @@ -2,6 +2,7 @@ from pathlib import Path from platform import system +import flopy import numpy as np import pytest from modflow_devtools.misc import set_dir @@ -366,15 +367,50 @@ def callback(sim, step): sfr.packagedata = pd np.testing.assert_allclose(sim.mf6.get_value(addrs[0]), pd["hk"], err_msg="hk is not being properly set") - name = "sfr_model" - sim_pth = data_pth / name - test_pth = function_tmpdir / name - shutil.copytree(sim_pth, test_pth, dirs_exist_ok=True) - - # hk, rough, and ustrf columns of the packagedata block - lines = (test_pth / "sfr.sfr").read_text().lower().split("packagedata")[1].splitlines() - rows = [line.split() for line in lines[1:] if line.strip() and not line.strip().startswith("end")] - expected = {column: [float(row[i]) for row in rows] for column, i in (("hk", 9), ("rough", 10), ("ustrf", 12))} + # three reaches in a row of three cells; reach 1 flows to reach 2 and + # diverts to reach 3 + expected = {"hk": [0.1, 0.2, 0.3], "rough": [0.03, 0.035, 0.04], "ustrf": [1.0, 1.0, 0.0]} + width = [10.0, 10.0, 5.0] + rtp = [9.0, 8.9, 8.9] + ncon = [2, 1, 1] + ndiv = [1, 0, 0] + packagedata = [ + ( + i, + (0, 0, i), + 100.0, + width[i], + 0.001, + rtp[i], + 1.0, + expected["hk"][i], + expected["rough"][i], + ncon[i], + expected["ustrf"][i], + ndiv[i], + ) + for i in range(3) + ] + + test_pth = function_tmpdir / "sfr_model" + sim = flopy.mf6.MFSimulation(sim_ws=test_pth) + flopy.mf6.ModflowTdis(sim, nper=2, perioddata=[(1.0, 1, 1.0), (1.0, 1, 1.0)]) + flopy.mf6.ModflowIms(sim) + gwf = flopy.mf6.ModflowGwf(sim, modelname="sfr") + flopy.mf6.ModflowGwfdis(gwf, nlay=1, nrow=1, ncol=3, delr=100.0, delc=100.0, top=10.0, botm=0.0) + flopy.mf6.ModflowGwfnpf(gwf, k=10.0) + flopy.mf6.ModflowGwfic(gwf, strt=8.0) + flopy.mf6.ModflowGwfchd(gwf, stress_period_data=[((0, 0, 0), 8.0)]) + flopy.mf6.ModflowGwfsfr( + gwf, + pname="sfr_0", + nreaches=3, + packagedata=packagedata, + connectiondata=[(0, -1, -2), (1, 0), (2, 0)], + diversions=[(0, 0, 2, "UPTO")], + perioddata={0: [(0, "INFLOW", 10.0), (0, "DIVERSION", 0, 2.0)]}, + ) + sim.write_simulation(silent=True) run_simulation(so, test_pth, callback) diff --git a/docs/examples/data/sfr_model/mfsim.nam b/docs/examples/data/sfr_model/mfsim.nam deleted file mode 100644 index a9cebe8..0000000 --- a/docs/examples/data/sfr_model/mfsim.nam +++ /dev/null @@ -1,17 +0,0 @@ -BEGIN options -END options - -BEGIN timing - TDIS6 sfr.tdis -END timing - -BEGIN models - gwf6 sfr.nam sfr -END models - -BEGIN exchanges -END exchanges - -BEGIN solutiongroup 1 - ims6 sfr.ims sfr -END solutiongroup diff --git a/docs/examples/data/sfr_model/sfr.chd b/docs/examples/data/sfr_model/sfr.chd deleted file mode 100644 index 47096f6..0000000 --- a/docs/examples/data/sfr_model/sfr.chd +++ /dev/null @@ -1,7 +0,0 @@ -BEGIN dimensions - MAXBOUND 1 -END dimensions - -BEGIN period 1 - 1 1 1 8.0 -END period diff --git a/docs/examples/data/sfr_model/sfr.dis b/docs/examples/data/sfr_model/sfr.dis deleted file mode 100644 index 49234d8..0000000 --- a/docs/examples/data/sfr_model/sfr.dis +++ /dev/null @@ -1,16 +0,0 @@ -BEGIN dimensions - NLAY 1 - NROW 1 - NCOL 3 -END dimensions - -BEGIN griddata - delr - CONSTANT 100.0 - delc - CONSTANT 100.0 - top - CONSTANT 10.0 - botm - CONSTANT 0.0 -END griddata diff --git a/docs/examples/data/sfr_model/sfr.ic b/docs/examples/data/sfr_model/sfr.ic deleted file mode 100644 index 50e8d17..0000000 --- a/docs/examples/data/sfr_model/sfr.ic +++ /dev/null @@ -1,4 +0,0 @@ -BEGIN griddata - strt - CONSTANT 8.0 -END griddata diff --git a/docs/examples/data/sfr_model/sfr.ims b/docs/examples/data/sfr_model/sfr.ims deleted file mode 100644 index 7556fef..0000000 --- a/docs/examples/data/sfr_model/sfr.ims +++ /dev/null @@ -1,13 +0,0 @@ -BEGIN options -END options - -BEGIN nonlinear - OUTER_DVCLOSE 1.0e-6 - OUTER_MAXIMUM 100 -END nonlinear - -BEGIN linear - INNER_DVCLOSE 1.0e-8 - INNER_RCLOSE 1.0e-6 - INNER_MAXIMUM 100 -END linear diff --git a/docs/examples/data/sfr_model/sfr.nam b/docs/examples/data/sfr_model/sfr.nam deleted file mode 100644 index 0654ee3..0000000 --- a/docs/examples/data/sfr_model/sfr.nam +++ /dev/null @@ -1,10 +0,0 @@ -BEGIN options -END options - -BEGIN packages - DIS6 sfr.dis dis - NPF6 sfr.npf npf - IC6 sfr.ic ic - CHD6 sfr.chd chd_0 - SFR6 sfr.sfr sfr_0 -END packages diff --git a/docs/examples/data/sfr_model/sfr.npf b/docs/examples/data/sfr_model/sfr.npf deleted file mode 100644 index b4c4863..0000000 --- a/docs/examples/data/sfr_model/sfr.npf +++ /dev/null @@ -1,9 +0,0 @@ -BEGIN options -END options - -BEGIN griddata - icelltype - CONSTANT 0 - k - CONSTANT 10.0 -END griddata diff --git a/docs/examples/data/sfr_model/sfr.sfr b/docs/examples/data/sfr_model/sfr.sfr deleted file mode 100644 index 50610a7..0000000 --- a/docs/examples/data/sfr_model/sfr.sfr +++ /dev/null @@ -1,27 +0,0 @@ -BEGIN options -END options - -BEGIN dimensions - NREACHES 3 -END dimensions - -BEGIN packagedata - 1 1 1 1 100.0 10.0 0.001 9.0 1.0 0.1 0.030 2 1.0 1 - 2 1 1 2 100.0 10.0 0.001 8.9 1.0 0.2 0.035 1 1.0 0 - 3 1 1 3 100.0 5.0 0.001 8.9 1.0 0.3 0.040 1 0.0 0 -END packagedata - -BEGIN connectiondata - 1 -2 -3 - 2 1 - 3 1 -END connectiondata - -BEGIN diversions - 1 1 3 UPTO -END diversions - -BEGIN period 1 - 1 INFLOW 10.0 - 1 DIVERSION 1 2.0 -END period diff --git a/docs/examples/data/sfr_model/sfr.tdis b/docs/examples/data/sfr_model/sfr.tdis deleted file mode 100644 index 60aca42..0000000 --- a/docs/examples/data/sfr_model/sfr.tdis +++ /dev/null @@ -1,8 +0,0 @@ -BEGIN dimensions - NPER 2 -END dimensions - -BEGIN perioddata - 1.0 1 1.0 - 1.0 1 1.0 -END perioddata diff --git a/pyproject.toml b/pyproject.toml index 054124b..2f942c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ dev = [ ] test = [ "filelock", + "flopy", "modflow-devtools[dfn,models]>=1.9.1,<2", "pytest!=8.1.0", "pytest-order", From ca2438bc85e0e689b0a494fb141d4f72861f839e Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 12:40:36 -0500 Subject: [PATCH 4/8] fix(util): raise a clear error for an unrecognized libmf6 version --- modflowapi/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modflowapi/util.py b/modflowapi/util.py index ac924a4..e4ca3ab 100644 --- a/modflowapi/util.py +++ b/modflowapi/util.py @@ -6,7 +6,10 @@ def libmf6_version(mf6) -> tuple[int, int, int]: """Return the libmf6 version as a tuple of integers. Ex. (6, 8, 2)""" - match = re.match(r"(\d+)\.(\d+)\.(\d+)", mf6.get_version()) + version = mf6.get_version() + match = re.match(r"(\d+)\.(\d+)\.(\d+)", version) + if match is None: + raise ValueError(f"unrecognized libmf6 version: {version!r}") return tuple(int(i) for i in match.groups()) From 7be056ae7d7153f438c20ff23d8fe6fa6737c221 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 12:40:36 -0500 Subject: [PATCH 5/8] test(sfr): check that an hk write persists into the next stress period --- autotest/test_interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autotest/test_interface.py b/autotest/test_interface.py index e7818ab..d9885f2 100644 --- a/autotest/test_interface.py +++ b/autotest/test_interface.py @@ -345,10 +345,15 @@ def callback(sim, step): def test_sfr_input_context_names(function_tmpdir): def callback(sim, step): - if step != Callbacks.timestep_start or sim.kper != 0 or sim.kstp != 0: + if step != Callbacks.timestep_start or sim.kstp != 0: return model = sim.get_model() sfr = model.get_package("sfr_0") + if sim.kper == 1: + # the write persists into the next time step + np.testing.assert_allclose(sfr.packagedata.values["hk"], written["hk"], err_msg="hk write did not persist") + written["persisted"] = True + return if libmf6_version(sim.mf6) >= (6, 8, 2): path = f"__INPUT__/{model.name}/SFR_0" names = ("BEDK", "MANNING", "UPSTREAM_FRAC") @@ -366,6 +371,9 @@ def callback(sim, step): pd["hk"] *= 10.0 sfr.packagedata = pd np.testing.assert_allclose(sim.mf6.get_value(addrs[0]), pd["hk"], err_msg="hk is not being properly set") + written["hk"] = pd["hk"].copy() + + written = {} # three reaches in a row of three cells; reach 1 flows to reach 2 and # diverts to reach 3 @@ -413,6 +421,7 @@ def callback(sim, step): sim.write_simulation(silent=True) run_simulation(so, test_pth, callback) + assert written.get("persisted"), "hk was not checked in the second stress period" def test_rhs_hcof_advanced(function_tmpdir): From 0bd8f23b5930e931916f8f633061509ac24cc2c6 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 15:49:20 -0500 Subject: [PATCH 6/8] fix(sfr): use the input context address when libmf6 has it The input context address for hk, rough, and ustrf was chosen by libmf6 version, which picks it for a pre-6.8.2 nightly (6.9.0.dev0) that does not have it. The address is now used when it is in the libmf6 input variable names, with the package address as the fallback, and libmf6_version() is removed. --- modflowapi/extensions/datamodel.py | 10 +++++----- modflowapi/extensions/pakbase.py | 8 +++----- modflowapi/util.py | 10 ---------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/modflowapi/extensions/datamodel.py b/modflowapi/extensions/datamodel.py index cb6daeb..1b1b1e7 100644 --- a/modflowapi/extensions/datamodel.py +++ b/modflowapi/extensions/datamodel.py @@ -275,13 +275,13 @@ "maw": {"packagedata": ["nmawwells", ("ifno:range:nmawwells", "radius", "bot", "strt", "ngwfnodes")]}, } -# advanced package variables read from the input context, keyed by column name, -# with the input context name and the first libmf6 version that uses it +# advanced package variables read from the input context when libmf6 has them, +# keyed by column name, with the input context name adv_input_vars = { "sfr": { - "hk": ("BEDK", (6, 8, 2)), - "rough": ("MANNING", (6, 8, 2)), - "ustrf": ("UPSTREAM_FRAC", (6, 8, 2)), + "hk": "BEDK", + "rough": "MANNING", + "ustrf": "UPSTREAM_FRAC", }, } diff --git a/modflowapi/extensions/pakbase.py b/modflowapi/extensions/pakbase.py index 73344af..29e2464 100644 --- a/modflowapi/extensions/pakbase.py +++ b/modflowapi/extensions/pakbase.py @@ -1,6 +1,5 @@ import numpy as np -from ..util import libmf6_version from .data import AdvancedInput, ArrayInput, ListInput, ScalarInput from .datamodel import adv_input_vars, adv_pkgvars, pkgvars @@ -472,7 +471,7 @@ def __init__(self, model, pkg_type, pkg_name, sim_package=False): self._input_vars = adv_input_vars.get(pkg_type, {}) self._column_names = {} if self._input_vars: - self._libmf6_version = libmf6_version(self.model.mf6) + self._input_var_names = set(self.model.mf6.get_input_var_names()) if pkg_type in adv_pkgvars: self._adv_var_dict = adv_pkgvars[pkg_type] @@ -557,9 +556,8 @@ def _get_advanced_variable_addr(self, var_str): """ var = var_str.lower() if var in self._input_vars: - name, version = self._input_vars[var] - if self._libmf6_version >= version: - s = f"__INPUT__/{self.model.name}/{self.pkg_name}/{name}" + s = f"__INPUT__/{self.model.name}/{self.pkg_name}/{self._input_vars[var]}" + if s in self._input_var_names: self._column_names[s] = var return s s = f"{self.model.name}/{self.pkg_name}/{var_str.upper()}" diff --git a/modflowapi/util.py b/modflowapi/util.py index e4ca3ab..cc278ab 100644 --- a/modflowapi/util.py +++ b/modflowapi/util.py @@ -1,18 +1,8 @@ -import re from os import PathLike from pathlib import Path from platform import system -def libmf6_version(mf6) -> tuple[int, int, int]: - """Return the libmf6 version as a tuple of integers. Ex. (6, 8, 2)""" - version = mf6.get_version() - match = re.match(r"(\d+)\.(\d+)\.(\d+)", version) - if match is None: - raise ValueError(f"unrecognized libmf6 version: {version!r}") - return tuple(int(i) for i in match.groups()) - - def amend_libmf6_path(path: str | PathLike) -> str: ext = Path(path).suffix path = str(path) From e2bbd7af7c7880a16eabe7da6b08c3f4cb48a3e0 Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 15:49:20 -0500 Subject: [PATCH 7/8] test(sfr): write the sfr test model as text instead of with flopy Drop flopy from the test group so modflowapi does not depend on it. --- autotest/test_interface.py | 153 +++++++++++++++++++++++++++---------- pyproject.toml | 2 - 2 files changed, 111 insertions(+), 44 deletions(-) diff --git a/autotest/test_interface.py b/autotest/test_interface.py index d9885f2..0c6a932 100644 --- a/autotest/test_interface.py +++ b/autotest/test_interface.py @@ -1,8 +1,8 @@ import shutil from pathlib import Path from platform import system +from textwrap import dedent -import flopy import numpy as np import pytest from modflow_devtools.misc import set_dir @@ -10,7 +10,6 @@ from modflowapi import Callbacks, ModflowApi, run_simulation from modflowapi.extensions.apiexchange import ApiExchange from modflowapi.extensions.pakbase import AdvancedPackage, ArrayPackage, ListPackage -from modflowapi.util import libmf6_version data_pth = Path("../docs/examples/data") pytestmark = pytest.mark.extensions @@ -354,7 +353,7 @@ def callback(sim, step): np.testing.assert_allclose(sfr.packagedata.values["hk"], written["hk"], err_msg="hk write did not persist") written["persisted"] = True return - if libmf6_version(sim.mf6) >= (6, 8, 2): + if f"__INPUT__/{model.name}/SFR_0/BEDK" in sim.mf6.get_input_var_names(): path = f"__INPUT__/{model.name}/SFR_0" names = ("BEDK", "MANNING", "UPSTREAM_FRAC") else: @@ -378,47 +377,117 @@ def callback(sim, step): # three reaches in a row of three cells; reach 1 flows to reach 2 and # diverts to reach 3 expected = {"hk": [0.1, 0.2, 0.3], "rough": [0.03, 0.035, 0.04], "ustrf": [1.0, 1.0, 0.0]} - width = [10.0, 10.0, 5.0] - rtp = [9.0, 8.9, 8.9] - ncon = [2, 1, 1] - ndiv = [1, 0, 0] - packagedata = [ - ( - i, - (0, 0, i), - 100.0, - width[i], - 0.001, - rtp[i], - 1.0, - expected["hk"][i], - expected["rough"][i], - ncon[i], - expected["ustrf"][i], - ndiv[i], + packagedata = "\n".join( + f" {i + 1} 1 1 {i + 1} 100.0 {width} 0.001 {rtp} 1.0 {hk} {rough} {ncon} {ustrf} {ndiv}" + for i, (width, rtp, hk, rough, ncon, ustrf, ndiv) in enumerate( + zip( + [10.0, 10.0, 5.0], + [9.0, 8.9, 8.9], + expected["hk"], + expected["rough"], + [2, 1, 1], + expected["ustrf"], + [1, 0, 0], + ) ) - for i in range(3) - ] - - test_pth = function_tmpdir / "sfr_model" - sim = flopy.mf6.MFSimulation(sim_ws=test_pth) - flopy.mf6.ModflowTdis(sim, nper=2, perioddata=[(1.0, 1, 1.0), (1.0, 1, 1.0)]) - flopy.mf6.ModflowIms(sim) - gwf = flopy.mf6.ModflowGwf(sim, modelname="sfr") - flopy.mf6.ModflowGwfdis(gwf, nlay=1, nrow=1, ncol=3, delr=100.0, delc=100.0, top=10.0, botm=0.0) - flopy.mf6.ModflowGwfnpf(gwf, k=10.0) - flopy.mf6.ModflowGwfic(gwf, strt=8.0) - flopy.mf6.ModflowGwfchd(gwf, stress_period_data=[((0, 0, 0), 8.0)]) - flopy.mf6.ModflowGwfsfr( - gwf, - pname="sfr_0", - nreaches=3, - packagedata=packagedata, - connectiondata=[(0, -1, -2), (1, 0), (2, 0)], - diversions=[(0, 0, 2, "UPTO")], - perioddata={0: [(0, "INFLOW", 10.0), (0, "DIVERSION", 0, 2.0)]}, ) - sim.write_simulation(silent=True) + files = { + "mfsim.nam": """ + BEGIN timing + TDIS6 sim.tdis + END timing + BEGIN models + gwf6 sfr.nam sfr + END models + BEGIN exchanges + END exchanges + BEGIN solutiongroup 1 + ims6 sim.ims sfr + END solutiongroup + """, + "sim.tdis": """ + BEGIN dimensions + NPER 2 + END dimensions + BEGIN perioddata + 1.0 1 1.0 + 1.0 1 1.0 + END perioddata + """, + "sim.ims": "", + "sfr.nam": """ + BEGIN packages + DIS6 sfr.dis dis + NPF6 sfr.npf npf + IC6 sfr.ic ic + CHD6 sfr.chd chd_0 + SFR6 sfr.sfr sfr_0 + END packages + """, + "sfr.dis": """ + BEGIN dimensions + NLAY 1 + NROW 1 + NCOL 3 + END dimensions + BEGIN griddata + delr + CONSTANT 100.0 + delc + CONSTANT 100.0 + top + CONSTANT 10.0 + botm + CONSTANT 0.0 + END griddata + """, + "sfr.npf": """ + BEGIN griddata + icelltype + CONSTANT 0 + k + CONSTANT 10.0 + END griddata + """, + "sfr.ic": """ + BEGIN griddata + strt + CONSTANT 8.0 + END griddata + """, + "sfr.chd": """ + BEGIN dimensions + MAXBOUND 1 + END dimensions + BEGIN period 1 + 1 1 1 8.0 + END period + """, + "sfr.sfr": """ + BEGIN dimensions + NREACHES 3 + END dimensions + BEGIN packagedata + {packagedata} + END packagedata + BEGIN connectiondata + 1 -2 -3 + 2 1 + 3 1 + END connectiondata + BEGIN diversions + 1 1 3 UPTO + END diversions + BEGIN period 1 + 1 INFLOW 10.0 + 1 DIVERSION 1 2.0 + END period + """, + } + test_pth = function_tmpdir / "sfr_model" + test_pth.mkdir() + for name, text in files.items(): + (test_pth / name).write_text(dedent(text).format(packagedata=packagedata)) run_simulation(so, test_pth, callback) assert written.get("persisted"), "hk was not checked in the second stress period" diff --git a/pyproject.toml b/pyproject.toml index 2f942c2..f393733 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,6 @@ dev = [ ] test = [ "filelock", - "flopy", "modflow-devtools[dfn,models]>=1.9.1,<2", "pytest!=8.1.0", "pytest-order", @@ -70,7 +69,6 @@ docs = [ "jupytext", "nbsphinx", "ipython", - "flopy", {include-group = "test"}, ] From aeaf58986181e0860e3b1eb255170ff805f6de6b Mon Sep 17 00:00:00 2001 From: Joseph Hughes Date: Thu, 29 Oct 2026 16:06:53 -0500 Subject: [PATCH 8/8] chore(pyproject): restore flopy in the docs group Removing flopy from the test group in e2bbd7a also removed it from the docs group. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index f393733..054124b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,6 +69,7 @@ docs = [ "jupytext", "nbsphinx", "ipython", + "flopy", {include-group = "test"}, ]