Skip to content

Commit 0820544

Browse files
authored
Merge pull request #2397 from modflowpy/v3.9.0
Release 3.9.0
2 parents 70339c3 + e4f3494 commit 0820544

File tree

300 files changed

+8389
-10551
lines changed

Some content is hidden

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

300 files changed

+8389
-10551
lines changed

.docs/Notebooks/array_output_tutorial.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@
2929
# + pycharm={"name": "#%%\n"}
3030
import os
3131
import sys
32+
from pathlib import Path
3233
from pprint import pformat
3334
from tempfile import TemporaryDirectory
3435

36+
import git
3537
import matplotlib as mpl
3638
import matplotlib.pyplot as plt
3739
import numpy as np
40+
import pooch
3841

3942
import flopy
4043

@@ -44,8 +47,40 @@
4447
exe_name = "mf2005"
4548
mfexe = exe_name
4649

50+
# Check if we are in the repository and define the data path.
51+
52+
try:
53+
root = Path(git.Repo(".", search_parent_directories=True).working_dir)
54+
except:
55+
root = None
56+
57+
data_path = root / "examples" / "data" if root else Path.cwd()
58+
59+
sim_name = "freyberg"
60+
61+
file_names = {
62+
"freyberg.bas": "63266024019fef07306b8b639c6c67d5e4b22f73e42dcaa9db18b5e0f692c097",
63+
"freyberg.dis": "62d0163bf36c7ee9f7ee3683263e08a0abcdedf267beedce6dd181600380b0a2",
64+
"freyberg.githds": "abe92497b55e6f6c73306e81399209e1cada34cf794a7867d776cfd18303673b",
65+
"freyberg.gitlist": "aef02c664344a288264d5f21e08a748150e43bb721a16b0e3f423e6e3e293056",
66+
"freyberg.lpf": "06500bff979424f58e5e4fbd07a7bdeb0c78f31bd08640196044b6ccefa7a1fe",
67+
"freyberg.nam": "e66321007bb603ef55ed2ba41f4035ba6891da704a4cbd3967f0c66ef1532c8f",
68+
"freyberg.oc": "532905839ccbfce01184980c230b6305812610b537520bf5a4abbcd3bd703ef4",
69+
"freyberg.pcg": "0d1686fac4680219fffdb56909296c5031029974171e25d4304e70fa96ebfc38",
70+
"freyberg.rch": "37a1e113a7ec16b61417d1fa9710dd111a595de738a367bd34fd4a359c480906",
71+
"freyberg.riv": "7492a1d5eb23d6812ec7c8227d0ad4d1e1b35631a765c71182b71e3bd6a6d31d",
72+
"freyberg.wel": "00aa55f59797c02f0be5318a523b36b168fc6651f238f34e8b0938c04292d3e7",
73+
}
74+
for fname, fhash in file_names.items():
75+
pooch.retrieve(
76+
url=f"https://github.com/modflowpy/flopy/raw/develop/examples/data/{sim_name}/{fname}",
77+
fname=fname,
78+
path=data_path / sim_name,
79+
known_hash=fhash,
80+
)
81+
4782
# Set the paths
48-
loadpth = os.path.join("..", "..", "examples", "data", "freyberg")
83+
loadpth = data_path / sim_name
4984
temp_dir = TemporaryDirectory()
5085
modelpth = temp_dir.name
5186

.docs/Notebooks/dis_triangle_example.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
radius = 100.0
5454
x = radius * np.cos(theta)
5555
y = radius * np.sin(theta)
56-
circle_poly = [(x, y) for x, y in zip(x, y)]
56+
circle_poly = list(zip(x, y))
5757
fig = plt.figure(figsize=(10, 10))
5858
ax = plt.subplot(1, 1, 1, aspect="equal")
5959
ax.plot(x, y, "bo-")
@@ -94,7 +94,7 @@
9494
radius = 30.0
9595
x = radius * np.cos(theta) + 25.0
9696
y = radius * np.sin(theta) + 25.0
97-
inner_circle_poly = [(x, y) for x, y in zip(x, y)]
97+
inner_circle_poly = list(zip(x, y))
9898

9999
# The hole is created by passing in another polygon and
100100
# then passing a point inside the hole polygon with the
@@ -198,9 +198,7 @@
198198
sim = flopy.mf6.MFSimulation(
199199
sim_name=name, version="mf6", exe_name="mf6", sim_ws=workspace
200200
)
201-
tdis = flopy.mf6.ModflowTdis(
202-
sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]]
203-
)
201+
tdis = flopy.mf6.ModflowTdis(sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]])
204202
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
205203
ims = flopy.mf6.ModflowIms(
206204
sim,
@@ -227,9 +225,7 @@
227225
vertices=vertices,
228226
cell2d=cell2d,
229227
)
230-
npf = flopy.mf6.ModflowGwfnpf(
231-
gwf, xt3doptions=[(True)], save_specific_discharge=None
232-
)
228+
npf = flopy.mf6.ModflowGwfnpf(gwf, xt3doptions=[(True)], save_specific_discharge=None)
233229
ic = flopy.mf6.ModflowGwfic(gwf)
234230

235231

.docs/Notebooks/dis_voronoi_example.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@
130130
sim = flopy.mf6.MFSimulation(
131131
sim_name=name, version="mf6", exe_name="mf6", sim_ws=sim_ws
132132
)
133-
tdis = flopy.mf6.ModflowTdis(
134-
sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]]
135-
)
133+
tdis = flopy.mf6.ModflowTdis(sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]])
136134
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
137135
ims = flopy.mf6.ModflowIms(
138136
sim,
@@ -145,9 +143,7 @@
145143
nlay = 1
146144
top = 1.0
147145
botm = [0.0]
148-
disv = flopy.mf6.ModflowGwfdisv(
149-
gwf, nlay=nlay, **disv_gridprops, top=top, botm=botm
150-
)
146+
disv = flopy.mf6.ModflowGwfdisv(gwf, nlay=nlay, **disv_gridprops, top=top, botm=botm)
151147
npf = flopy.mf6.ModflowGwfnpf(
152148
gwf,
153149
xt3doptions=[(True)],
@@ -209,9 +205,7 @@
209205
nlay = 1
210206
top = 1.0
211207
botm = [0.0]
212-
disv = flopy.mf6.ModflowGwtdisv(
213-
gwt, nlay=nlay, **disv_gridprops, top=top, botm=botm
214-
)
208+
disv = flopy.mf6.ModflowGwtdisv(gwt, nlay=nlay, **disv_gridprops, top=top, botm=botm)
215209
ic = flopy.mf6.ModflowGwtic(gwt, strt=0.0)
216210
sto = flopy.mf6.ModflowGwtmst(gwt, porosity=0.2)
217211
adv = flopy.mf6.ModflowGwtadv(gwt, scheme="TVD")
@@ -320,7 +314,7 @@
320314
radius = 100.0
321315
x = radius * np.cos(theta)
322316
y = radius * np.sin(theta)
323-
circle_poly = [(x, y) for x, y in zip(x, y)]
317+
circle_poly = list(zip(x, y))
324318
tri = Triangle(maximum_area=5, angle=30, model_ws=workspace)
325319
tri.add_polygon(circle_poly)
326320
tri.build(verbose=False)
@@ -342,7 +336,7 @@
342336
radius = 30.0
343337
x = radius * np.cos(theta) + 25.0
344338
y = radius * np.sin(theta) + 25.0
345-
inner_circle_poly = [(x, y) for x, y in zip(x, y)]
339+
inner_circle_poly = list(zip(x, y))
346340

347341
tri = Triangle(maximum_area=10, angle=30, model_ws=workspace)
348342
tri.add_polygon(circle_poly)
@@ -402,7 +396,7 @@
402396
radius = 10.0
403397
x = radius * np.cos(theta) + 50.0
404398
y = radius * np.sin(theta) + 70.0
405-
circle_poly0 = [(x, y) for x, y in zip(x, y)]
399+
circle_poly0 = list(zip(x, y))
406400
tri.add_polygon(circle_poly0)
407401
tri.add_hole((50, 70))
408402

@@ -411,7 +405,7 @@
411405
radius = 10.0
412406
x = radius * np.cos(theta) + 70.0
413407
y = radius * np.sin(theta) + 20.0
414-
circle_poly1 = [(x, y) for x, y in zip(x, y)]
408+
circle_poly1 = list(zip(x, y))
415409
tri.add_polygon(circle_poly1)
416410
# tri.add_hole((70, 20))
417411

.docs/Notebooks/export_tutorial.py

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@
2020
# +
2121
import os
2222
import sys
23+
from pathlib import Path
2324
from tempfile import TemporaryDirectory
2425

26+
import git
27+
import pooch
28+
2529
import flopy
2630

2731
print(sys.version)
@@ -30,10 +34,42 @@
3034

3135
# Load our old friend...the Freyberg model
3236

37+
sim_name = "freyberg_multilayer_transient"
38+
39+
# Check if we are in the repository and define the data path.
40+
41+
try:
42+
root = Path(git.Repo(".", search_parent_directories=True).working_dir)
43+
except:
44+
root = None
45+
46+
data_path = root / "examples" / "data" if root else Path.cwd()
47+
48+
file_names = {
49+
"freyberg.bas": None,
50+
"freyberg.cbc": None,
51+
"freyberg.ddn": None,
52+
"freyberg.dis": None,
53+
"freyberg.drn": None,
54+
"freyberg.hds": None,
55+
"freyberg.list": None,
56+
"freyberg.nam": None,
57+
"freyberg.nwt": None,
58+
"freyberg.oc": None,
59+
"freyberg.rch": None,
60+
"freyberg.upw": None,
61+
"freyberg.wel": None,
62+
}
63+
for fname, fhash in file_names.items():
64+
pooch.retrieve(
65+
url=f"https://github.com/modflowpy/flopy/raw/develop/examples/data/{sim_name}/{fname}",
66+
fname=fname,
67+
path=data_path / sim_name,
68+
known_hash=fhash,
69+
)
70+
3371
nam_file = "freyberg.nam"
34-
model_ws = os.path.join(
35-
"..", "..", "examples", "data", "freyberg_multilayer_transient"
36-
)
72+
model_ws = data_path / sim_name
3773
ml = flopy.modflow.Modflow.load(nam_file, model_ws=model_ws, check=False)
3874

3975
# We can see the ``Modelgrid`` instance has generic entries, as does ``start_datetime``
@@ -44,9 +80,7 @@
4480

4581
# Setting the attributes of the ``ml.modelgrid`` is easy:
4682

47-
ml.modelgrid.set_coord_info(
48-
xoff=123456.7, yoff=765432.1, angrot=15.0, crs=3070
49-
)
83+
ml.modelgrid.set_coord_info(xoff=123456.7, yoff=765432.1, angrot=15.0, crs=3070)
5084
ml.dis.start_datetime = "7/4/1776"
5185

5286
ml.modeltime.start_datetime
@@ -125,9 +159,7 @@
125159
export_dict = {"hds": hds, "cbc": cbc}
126160

127161
# export head and cell budget outputs to netcdf
128-
fnc = flopy.export.utils.output_helper(
129-
os.path.join(pth, "output.nc"), ml, export_dict
130-
)
162+
fnc = flopy.export.utils.output_helper(os.path.join(pth, "output.nc"), ml, export_dict)
131163
# -
132164

133165
try:

0 commit comments

Comments
 (0)