Skip to content

Commit af463ac

Browse files
authored
Merge pull request #2509 from modflowpy/v3.9.3
Release 3.9.3
2 parents cfc5a94 + 8fab8af commit af463ac

File tree

292 files changed

+38617
-13965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+38617
-13965
lines changed

.docs/Notebooks/mf6_complex_model_example.py

-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@
267267
0.5,
268268
0.3,
269269
0.1,
270-
None,
271270
)
272271
evt = flopy.mf6.ModflowGwfevt(
273272
gwf,

.docs/Notebooks/mf6_parallel_model_splitting_example.py

+66
Original file line numberDiff line numberDiff line change
@@ -768,3 +768,69 @@ def string2geom(geostring, conversion=None):
768768
sa = np.array(seg)
769769
ax.plot(sa[:, 0], sa[:, 1], "b-")
770770
# -
771+
772+
# ### Save node mapping data
773+
#
774+
# The `save_node_mapping()` method allows users to save a HDF5 representation of model splitter information that can be reloaded and used to reconstruct arrays at a later time
775+
776+
# +
777+
filename = workspace / "node_mapping.hdf5"
778+
mfsplit.save_node_mapping(filename)
779+
# -
780+
781+
# ### reloading node mapping data
782+
#
783+
# The `load_node_mapping()` method allows the user to instantiate a Mf6Splitter object from a hdf5 node mapping file for reconstructing output arrays
784+
785+
# +
786+
mfs = Mf6Splitter.load_node_mapping(filename)
787+
# -
788+
789+
# Reconstruct heads using the `Mf6Splitter` object we just created
790+
791+
# +
792+
model_names = list(new_sim.model_names)
793+
head_dict = {}
794+
for modelname in model_names:
795+
mnum = int(modelname.split("_")[-1])
796+
head = new_sim.get_model(modelname).output.head().get_alldata()[-1]
797+
head_dict[mnum] = head
798+
799+
ra_heads = mfs.reconstruct_array(head_dict)
800+
ra_watertable = flopy.utils.postprocessing.get_water_table(ra_heads)
801+
# -
802+
803+
# +
804+
with styles.USGSMap():
805+
fig, axs = plt.subplots(nrows=3, figsize=(8, 12))
806+
diff = ra_heads - heads
807+
hv = [ra_heads, heads, diff]
808+
titles = ["Multiple models", "Single model", "Multiple - single"]
809+
for idx, ax in enumerate(axs):
810+
ax.set_aspect("equal")
811+
ax.set_title(titles[idx])
812+
813+
if idx < 2:
814+
levels = contours
815+
vmin = hmin
816+
vmax = hmax
817+
else:
818+
levels = None
819+
vmin = None
820+
vmax = None
821+
822+
pmv = flopy.plot.PlotMapView(modelgrid=gwf.modelgrid, ax=ax, layer=0)
823+
h = pmv.plot_array(hv[idx], vmin=vmin, vmax=vmax)
824+
if levels is not None:
825+
c = pmv.contour_array(
826+
hv[idx], levels=levels, colors="white", linewidths=0.75, linestyles=":"
827+
)
828+
plt.clabel(c, fontsize=8)
829+
pmv.plot_inactive()
830+
plt.colorbar(h, ax=ax, shrink=0.5)
831+
832+
ax.plot(bp[:, 0], bp[:, 1], "r-")
833+
for seg in segs:
834+
sa = np.array(seg)
835+
ax.plot(sa[:, 0], sa[:, 1], "b-")
836+
# -

.docs/Notebooks/plot_map_view_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
sim_name = "freyberg"
5757

5858
# Set the paths
59-
tempdir = TemporaryDirectory(delete=False)
59+
tempdir = TemporaryDirectory()
6060
modelpth = Path(tempdir.name)
6161

6262
# Check if we are in the repository and define the data path.

.docs/md/generate_classes.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
MODFLOW 6 input continues to evolve as new models, packages, and options are developed, updated, and supported. All MODFLOW 6 input is described by DFN (definition) files, which are simple text files that describe the blocks and keywords in each input file. These definition files are used to build the input and output guide for MODFLOW 6. These definition files are also used to automatically generate FloPy classes for creating, reading and writing MODFLOW 6 models, packages, and options. FloPy and MODFLOW 6 are kept in sync by these DFN (definition) files, and therefore, it may be necessary for a user to update FloPy using a custom set of definition files, or a set of definition files from a previous release.
1212

13-
The FloPy classes for MODFLOW 6 are largely generated by a utility which converts DFN files in a modflow6 repository on GitHub or on the local machine into Python source files in your local FloPy install. For instance (output much abbreviated):
13+
The FloPy classes for MODFLOW 6 are largely generated by a utility which converts DFN files in a modflow6 repository on GitHub or on the local machine into Python source files in your local FloPy install.
14+
15+
**Note**: to use this functionality, the `codegen` optional dependency group must be installed.
1416

1517
```bash
1618
$ python -m flopy.mf6.utils.generate_classes
@@ -19,9 +21,9 @@ $ python -m flopy.mf6.utils.generate_classes
1921

2022
************************************************************************
2123
Updating the flopy MODFLOW 6 classes
22-
Updating the MODFLOW 6 classes using MODFLOW-USGS/modflow6/master
23-
Downloading MODFLOW 6 repository from https://github.com/MODFLOW-USGS/modflow6/archive/master.zip
24-
Downloading https://github.com/MODFLOW-USGS/modflow6/archive/master.zip
24+
Updating the MODFLOW 6 classes using MODFLOW-ORG/modflow6/master
25+
Downloading MODFLOW 6 repository from https://github.com/MODFLOW-ORG/modflow6/archive/master.zip
26+
Downloading https://github.com/MODFLOW-ORG/modflow6/archive/master.zip
2527
file size: 15,821,180 bytes
2628

2729
total download time: 0.88 seconds
@@ -65,7 +67,7 @@ user.
6567

6668
options:
6769
-h, --help show this help message and exit
68-
--owner OWNER GitHub repository owner; default is 'MODFLOW-USGS'.
70+
--owner OWNER GitHub repository owner; default is 'MODFLOW-ORG'.
6971
--repo REPO Name of GitHub repository; default is 'modflow6'.
7072
--ref REF Branch name, tag, or commit hash to use to update the
7173
definition; default is 'master'.

.docs/md/get_modflow.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Other auto-select options are only available if the current user can write files
7575

7676
## Selecting a distribution
7777

78-
By default the distribution from the [`MODFLOW-USGS/executables` repository](https://github.com/MODFLOW-USGS/executables) is installed. This includes the MODFLOW 6 binary `mf6` and over 20 other related programs. The utility can also install from the main [MODFLOW 6 repo](https://github.com/MODFLOW-USGS/modflow6) or the [nightly build](https://github.com/MODFLOW-USGS/modflow6-nightly-build) distributions, which contain only:
78+
By default the distribution from the [`MODFLOW-ORG/executables` repository](https://github.com/MODFLOW-ORG/executables) is installed. This includes the MODFLOW 6 binary `mf6` and over 20 other related programs. The utility can also install from the main [MODFLOW 6 repo](https://github.com/MODFLOW-ORG/modflow6) or the [nightly build](https://github.com/MODFLOW-ORG/modflow6-nightly-build) distributions, which contain only:
7979

8080
- `mf6`
8181
- `mf5to6`

.docs/md/optional_dependencies.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Dependencies for optional features are listed below. These may be installed with
1313
| `.resample_to_grid()` in `flopy.utils.rasters` | **scipy.interpolate** |
1414
| `.interpolate()` in `flopy.mf6.utils.reference` `StructuredSpatialReference` class | **scipy.interpolate** |
1515
| `.get_authority_crs()` in `flopy.utils.crs` | **pyproj** >= 2.2.0 |
16-
| `.generate_classes()` in `flopy.mf6.utils` | [**modflow-devtools**](https://github.com/MODFLOW-USGS/modflow-devtools) |
16+
| `.generate_classes()` in `flopy.mf6.utils` | [**modflow-devtools**](https://github.com/MODFLOW-ORG/modflow-devtools) |
1717
| `GridIntersect()` in `flopy.utils.gridintersect` | **shapely** |
1818
| `GridIntersect().plot_polygon()` in `flopy.utils.gridintersect` | **shapely** and **descartes** |
1919
| `Raster()` in `flopy.utils.Raster` | **rasterio**, **rasterstats**, **affine**, and **scipy** |

.docs/md/version_changes.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11
# Changelog
2+
### Version 3.9.3
3+
4+
#### New features
5+
6+
* [feat(modeltime)](https://github.com/modflowpy/flopy/commit/932bdcc8c07a10148cf733c02ba9190167239066): Add from_headers and reverse methods (#2481). Committed by wpbonelli on 2025-03-29.
7+
* [feat](https://github.com/modflowpy/flopy/commit/d8048a868b51d75039f0c3c097429144c6d44714): Add the angldegx to the kw dictionary produced by the get_disu_kwargs method (#2484). Committed by Sunny Titus on 2025-04-14.
8+
9+
#### Bug fixes
10+
11+
* [fix(resolve_exe)](https://github.com/modflowpy/flopy/commit/ca3adb34031285bc795b58fa42c4965d67278adc): Typecast exe name to string before passing to _resolve (#2457). Committed by martclanor on 2025-02-20.
12+
* [fix(HeadFile,CellBudgetFile)](https://github.com/modflowpy/flopy/commit/39d8d32625151979d78b82e709fa46ca4f5f7d9f): Fix tdis reversal (#2460). Committed by wpbonelli on 2025-02-25.
13+
* [fix(output_util.py)](https://github.com/modflowpy/flopy/commit/61e52f03ff69ec50b03a17c863738ad4a3c1dc4b): Trap grb in MF6Output (#2468). Committed by wpbonelli on 2025-03-07.
14+
* [fix(binaryfile)](https://github.com/modflowpy/flopy/commit/02ab7f1ff18a5c03f06d98fe1b35d6d6f7ad12df): Tdis in head/budget reversal methods (#2475). Committed by wpbonelli on 2025-03-18.
15+
* [fix(binaryfile)](https://github.com/modflowpy/flopy/commit/0eba4babad994a7cd73a3853714b9ff3bb326c90): Fix head/budget file reversal (#2483). Committed by wpbonelli on 2025-04-01.
16+
* [fix(flopy/utils/sfroutputfile.py::SfrFile.get_results)](https://github.com/modflowpy/flopy/commit/bf02be00ded034d2765948c7d7b075bf9d6ed4f1): Refactor deprecated DataFrame.append() call to pandas.concat() (#2491). Committed by aleaf on 2025-04-21.
17+
* [fix(model_splitter.py)](https://github.com/modflowpy/flopy/commit/838b37cc999c713aa7e71c4215f7535c5c9df27b): Add trap for obs packages in bc packages (#2493). Committed by Joshua Larsen on 2025-04-22.
18+
* [fix(evt)](https://github.com/modflowpy/flopy/commit/dcba9cf5ca1d8b946b568748f713a6dcf21e2bc3): Optional field mishandling (#2490). Committed by mjreno on 2025-04-23.
19+
* [fix](https://github.com/modflowpy/flopy/commit/0d9c91489a6a9df2c2c51c962e59cb5e9dd4ff2b): Update numpy array comparisons to use isin (#2504). Committed by Emmanuel Ferdman on 2025-05-06.
20+
* [fix(column lengths)](https://github.com/modflowpy/flopy/commit/351c5b72401b5de52d230ef9f0897f58e4edf475): Autoscale array write to ncol for structured multi-model simulations (#2507). Committed by Joshua Larsen on 2025-05-12.
21+
22+
#### Refactoring
23+
24+
* [refactor(resolve_exe)](https://github.com/modflowpy/flopy/commit/c61643fd8d61e6e4866527104324a6c468eb0e41): Also fix tests (#2464). Committed by Mike Taves on 2025-03-03.
25+
* [refactor(createpackages)](https://github.com/modflowpy/flopy/commit/c5b5a41f626ad24d8f0e564a83ab8dc673cc9b7b): Use jinja for mf6 module code generation (#2333). Committed by wpbonelli on 2025-03-07.
26+
* [refactor(Mf6Splitter)](https://github.com/modflowpy/flopy/commit/20829b704b20be5175119fcd685fe808c55d51b6): Change how node mapping is stored and loaded (#2465). Committed by Joshua Larsen on 2025-03-14.
27+
* [refactor(gridutil)](https://github.com/modflowpy/flopy/commit/48f46fb87a1a23bc13a41be881f3852fdab7d682): Improve arg handling in get_disu_kwargs (#2480). Committed by wpbonelli on 2025-04-01.
28+
* [refactor(model_splitter.py)](https://github.com/modflowpy/flopy/commit/14640530dd46598d8d76417b6b640db0850cbf80): Support for SSM and ATS (#2505). Committed by Joshua Larsen on 2025-05-08.
29+
* [refactor(codegen)](https://github.com/modflowpy/flopy/commit/69f6e09a8bea004454e9a83b76e5b37f8c0a7810): Move dfn utils from devtools (#2508). Committed by wpbonelli on 2025-05-13.
30+
231
### Version 3.9.2
332

433
#### New features

.github/workflows/benchmark.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ ubuntu-latest, macos-latest, windows-latest ]
15-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
15+
python-version: [ "3.10", "3.11", "3.12" ]
1616
defaults:
1717
run:
1818
shell: bash -l {0}
@@ -23,7 +23,7 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Setup Python ${{ matrix.python-version }}
26-
uses: astral-sh/setup-uv@v5
26+
uses: astral-sh/setup-uv@v6
2727
with:
2828
cache-dependency-glob: "**/pyproject.toml"
2929
python-version: ${{ matrix.python-version }}
@@ -80,13 +80,16 @@ jobs:
8080
uses: actions/checkout@v4
8181

8282
- name: Setup Python
83-
uses: astral-sh/setup-uv@v5
83+
uses: astral-sh/setup-uv@v6
8484
with:
8585
cache-dependency-glob: "**/pyproject.toml"
8686

8787
- name: Install FloPy
8888
run: uv sync
8989

90+
- name: Install seaborn
91+
run: uv pip install seaborn
92+
9093
- name: Download all artifacts
9194
uses: actions/download-artifact@v4
9295
with:

.github/workflows/codegen.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ ubuntu-latest, macos-latest, windows-latest ]
16-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
16+
python-version: [ "3.10", "3.11", "3.12" ]
1717
ref: ["develop", "master", "6.4.1", "4458f9f", "4458f9f7a6244182e6acc2430a6996f9ca2df367"]
1818
defaults:
1919
run:
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/checkout@v4
2525

2626
- name: Setup Python ${{ matrix.python-version }}
27-
uses: astral-sh/setup-uv@v5
27+
uses: astral-sh/setup-uv@v6
2828
with:
2929
cache-dependency-glob: "**/pyproject.toml"
3030
python-version: ${{ matrix.python-version }}

.github/workflows/commit.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/checkout@v4
2222

2323
- name: Setup Python
24-
uses: astral-sh/setup-uv@v5
24+
uses: astral-sh/setup-uv@v6
2525
with:
2626
enable-cache: false
2727

@@ -44,7 +44,7 @@ jobs:
4444
uses: actions/checkout@v4
4545

4646
- name: Setup Python
47-
uses: astral-sh/setup-uv@v5
47+
uses: astral-sh/setup-uv@v6
4848
with:
4949
enable-cache: false
5050

@@ -71,14 +71,14 @@ jobs:
7171
shell: bash
7272
timeout-minutes: 10
7373
env:
74-
PYTHON_VERSION: 3.9
74+
PYTHON_VERSION: '3.10'
7575

7676
steps:
7777
- name: Checkout repo
7878
uses: actions/checkout@v4
7979

8080
- name: Setup Python
81-
uses: astral-sh/setup-uv@v5
81+
uses: astral-sh/setup-uv@v6
8282
with:
8383
cache-dependency-glob: "**/pyproject.toml"
8484

@@ -116,7 +116,7 @@ jobs:
116116
fail-fast: false
117117
matrix:
118118
os: [ ubuntu-latest, macos-latest, windows-latest ]
119-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
119+
python-version: [ "3.10", "3.11", "3.12" ]
120120
defaults:
121121
run:
122122
shell: bash -l {0}
@@ -127,7 +127,7 @@ jobs:
127127
uses: actions/checkout@v4
128128

129129
- name: Setup Python ${{ matrix.python-version }}
130-
uses: astral-sh/setup-uv@v5
130+
uses: astral-sh/setup-uv@v6
131131
with:
132132
cache-dependency-glob: "**/pyproject.toml"
133133
python-version: ${{ matrix.python-version }}

.github/workflows/examples.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ ubuntu-latest, macos-latest, windows-latest ]
15-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
15+
python-version: [ "3.10", "3.11", "3.12" ]
1616
defaults:
1717
run:
1818
shell: bash -l {0}
@@ -34,7 +34,9 @@ jobs:
3434
powershell
3535
3636
- name: Install FloPy
37-
run: pip install .
37+
run: |
38+
pip install .
39+
pip install ".[codegen]"
3840
3941
- name: OpenGL workaround on Linux
4042
if: runner.os == 'Linux'

0 commit comments

Comments
 (0)