Skip to content

Commit

Permalink
Merge pull request #2397 from modflowpy/v3.9.0
Browse files Browse the repository at this point in the history
Release 3.9.0
  • Loading branch information
wpbonelli authored Dec 20, 2024
2 parents 70339c3 + e4f3494 commit 0820544
Show file tree
Hide file tree
Showing 300 changed files with 8,389 additions and 10,551 deletions.
37 changes: 36 additions & 1 deletion .docs/Notebooks/array_output_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@
# + pycharm={"name": "#%%\n"}
import os
import sys
from pathlib import Path
from pprint import pformat
from tempfile import TemporaryDirectory

import git
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pooch

import flopy

Expand All @@ -44,8 +47,40 @@
exe_name = "mf2005"
mfexe = exe_name

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

try:
root = Path(git.Repo(".", search_parent_directories=True).working_dir)
except:
root = None

data_path = root / "examples" / "data" if root else Path.cwd()

sim_name = "freyberg"

file_names = {
"freyberg.bas": "63266024019fef07306b8b639c6c67d5e4b22f73e42dcaa9db18b5e0f692c097",
"freyberg.dis": "62d0163bf36c7ee9f7ee3683263e08a0abcdedf267beedce6dd181600380b0a2",
"freyberg.githds": "abe92497b55e6f6c73306e81399209e1cada34cf794a7867d776cfd18303673b",
"freyberg.gitlist": "aef02c664344a288264d5f21e08a748150e43bb721a16b0e3f423e6e3e293056",
"freyberg.lpf": "06500bff979424f58e5e4fbd07a7bdeb0c78f31bd08640196044b6ccefa7a1fe",
"freyberg.nam": "e66321007bb603ef55ed2ba41f4035ba6891da704a4cbd3967f0c66ef1532c8f",
"freyberg.oc": "532905839ccbfce01184980c230b6305812610b537520bf5a4abbcd3bd703ef4",
"freyberg.pcg": "0d1686fac4680219fffdb56909296c5031029974171e25d4304e70fa96ebfc38",
"freyberg.rch": "37a1e113a7ec16b61417d1fa9710dd111a595de738a367bd34fd4a359c480906",
"freyberg.riv": "7492a1d5eb23d6812ec7c8227d0ad4d1e1b35631a765c71182b71e3bd6a6d31d",
"freyberg.wel": "00aa55f59797c02f0be5318a523b36b168fc6651f238f34e8b0938c04292d3e7",
}
for fname, fhash in file_names.items():
pooch.retrieve(
url=f"https://github.com/modflowpy/flopy/raw/develop/examples/data/{sim_name}/{fname}",
fname=fname,
path=data_path / sim_name,
known_hash=fhash,
)

# Set the paths
loadpth = os.path.join("..", "..", "examples", "data", "freyberg")
loadpth = data_path / sim_name
temp_dir = TemporaryDirectory()
modelpth = temp_dir.name

Expand Down
12 changes: 4 additions & 8 deletions .docs/Notebooks/dis_triangle_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
radius = 100.0
x = radius * np.cos(theta)
y = radius * np.sin(theta)
circle_poly = [(x, y) for x, y in zip(x, y)]
circle_poly = list(zip(x, y))
fig = plt.figure(figsize=(10, 10))
ax = plt.subplot(1, 1, 1, aspect="equal")
ax.plot(x, y, "bo-")
Expand Down Expand Up @@ -94,7 +94,7 @@
radius = 30.0
x = radius * np.cos(theta) + 25.0
y = radius * np.sin(theta) + 25.0
inner_circle_poly = [(x, y) for x, y in zip(x, y)]
inner_circle_poly = list(zip(x, y))

# The hole is created by passing in another polygon and
# then passing a point inside the hole polygon with the
Expand Down Expand Up @@ -198,9 +198,7 @@
sim = flopy.mf6.MFSimulation(
sim_name=name, version="mf6", exe_name="mf6", sim_ws=workspace
)
tdis = flopy.mf6.ModflowTdis(
sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]]
)
tdis = flopy.mf6.ModflowTdis(sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]])
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
ims = flopy.mf6.ModflowIms(
sim,
Expand All @@ -227,9 +225,7 @@
vertices=vertices,
cell2d=cell2d,
)
npf = flopy.mf6.ModflowGwfnpf(
gwf, xt3doptions=[(True)], save_specific_discharge=None
)
npf = flopy.mf6.ModflowGwfnpf(gwf, xt3doptions=[(True)], save_specific_discharge=None)
ic = flopy.mf6.ModflowGwfic(gwf)


Expand Down
20 changes: 7 additions & 13 deletions .docs/Notebooks/dis_voronoi_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@
sim = flopy.mf6.MFSimulation(
sim_name=name, version="mf6", exe_name="mf6", sim_ws=sim_ws
)
tdis = flopy.mf6.ModflowTdis(
sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]]
)
tdis = flopy.mf6.ModflowTdis(sim, time_units="DAYS", perioddata=[[1.0, 1, 1.0]])
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
ims = flopy.mf6.ModflowIms(
sim,
Expand All @@ -145,9 +143,7 @@
nlay = 1
top = 1.0
botm = [0.0]
disv = flopy.mf6.ModflowGwfdisv(
gwf, nlay=nlay, **disv_gridprops, top=top, botm=botm
)
disv = flopy.mf6.ModflowGwfdisv(gwf, nlay=nlay, **disv_gridprops, top=top, botm=botm)
npf = flopy.mf6.ModflowGwfnpf(
gwf,
xt3doptions=[(True)],
Expand Down Expand Up @@ -209,9 +205,7 @@
nlay = 1
top = 1.0
botm = [0.0]
disv = flopy.mf6.ModflowGwtdisv(
gwt, nlay=nlay, **disv_gridprops, top=top, botm=botm
)
disv = flopy.mf6.ModflowGwtdisv(gwt, nlay=nlay, **disv_gridprops, top=top, botm=botm)
ic = flopy.mf6.ModflowGwtic(gwt, strt=0.0)
sto = flopy.mf6.ModflowGwtmst(gwt, porosity=0.2)
adv = flopy.mf6.ModflowGwtadv(gwt, scheme="TVD")
Expand Down Expand Up @@ -320,7 +314,7 @@
radius = 100.0
x = radius * np.cos(theta)
y = radius * np.sin(theta)
circle_poly = [(x, y) for x, y in zip(x, y)]
circle_poly = list(zip(x, y))
tri = Triangle(maximum_area=5, angle=30, model_ws=workspace)
tri.add_polygon(circle_poly)
tri.build(verbose=False)
Expand All @@ -342,7 +336,7 @@
radius = 30.0
x = radius * np.cos(theta) + 25.0
y = radius * np.sin(theta) + 25.0
inner_circle_poly = [(x, y) for x, y in zip(x, y)]
inner_circle_poly = list(zip(x, y))

tri = Triangle(maximum_area=10, angle=30, model_ws=workspace)
tri.add_polygon(circle_poly)
Expand Down Expand Up @@ -402,7 +396,7 @@
radius = 10.0
x = radius * np.cos(theta) + 50.0
y = radius * np.sin(theta) + 70.0
circle_poly0 = [(x, y) for x, y in zip(x, y)]
circle_poly0 = list(zip(x, y))
tri.add_polygon(circle_poly0)
tri.add_hole((50, 70))

Expand All @@ -411,7 +405,7 @@
radius = 10.0
x = radius * np.cos(theta) + 70.0
y = radius * np.sin(theta) + 20.0
circle_poly1 = [(x, y) for x, y in zip(x, y)]
circle_poly1 = list(zip(x, y))
tri.add_polygon(circle_poly1)
# tri.add_hole((70, 20))

Expand Down
50 changes: 41 additions & 9 deletions .docs/Notebooks/export_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
# +
import os
import sys
from pathlib import Path
from tempfile import TemporaryDirectory

import git
import pooch

import flopy

print(sys.version)
Expand All @@ -30,10 +34,42 @@

# Load our old friend...the Freyberg model

sim_name = "freyberg_multilayer_transient"

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

try:
root = Path(git.Repo(".", search_parent_directories=True).working_dir)
except:
root = None

data_path = root / "examples" / "data" if root else Path.cwd()

file_names = {
"freyberg.bas": None,
"freyberg.cbc": None,
"freyberg.ddn": None,
"freyberg.dis": None,
"freyberg.drn": None,
"freyberg.hds": None,
"freyberg.list": None,
"freyberg.nam": None,
"freyberg.nwt": None,
"freyberg.oc": None,
"freyberg.rch": None,
"freyberg.upw": None,
"freyberg.wel": None,
}
for fname, fhash in file_names.items():
pooch.retrieve(
url=f"https://github.com/modflowpy/flopy/raw/develop/examples/data/{sim_name}/{fname}",
fname=fname,
path=data_path / sim_name,
known_hash=fhash,
)

nam_file = "freyberg.nam"
model_ws = os.path.join(
"..", "..", "examples", "data", "freyberg_multilayer_transient"
)
model_ws = data_path / sim_name
ml = flopy.modflow.Modflow.load(nam_file, model_ws=model_ws, check=False)

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

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

ml.modelgrid.set_coord_info(
xoff=123456.7, yoff=765432.1, angrot=15.0, crs=3070
)
ml.modelgrid.set_coord_info(xoff=123456.7, yoff=765432.1, angrot=15.0, crs=3070)
ml.dis.start_datetime = "7/4/1776"

ml.modeltime.start_datetime
Expand Down Expand Up @@ -125,9 +159,7 @@
export_dict = {"hds": hds, "cbc": cbc}

# export head and cell budget outputs to netcdf
fnc = flopy.export.utils.output_helper(
os.path.join(pth, "output.nc"), ml, export_dict
)
fnc = flopy.export.utils.output_helper(os.path.join(pth, "output.nc"), ml, export_dict)
# -

try:
Expand Down
Loading

0 comments on commit 0820544

Please sign in to comment.