Skip to content

Commit

Permalink
Merge pull request #2099 from modflowpy/v3.6.0
Browse files Browse the repository at this point in the history
Release 3.6.0
  • Loading branch information
wpbonelli committed Feb 8, 2024
2 parents 879c153 + 10bde39 commit 3ad1f7d
Show file tree
Hide file tree
Showing 308 changed files with 4,992 additions and 17,464 deletions.
7 changes: 2 additions & 5 deletions .docs/Notebooks/array_output_tutorial.py
Expand Up @@ -29,6 +29,7 @@
# + pycharm={"name": "#%%\n"}
import os
import sys
from pprint import pformat
from tempfile import TemporaryDirectory

import matplotlib as mpl
Expand Down Expand Up @@ -64,11 +65,7 @@
ml.model_ws = modelpth
ml.write_input()
success, buff = ml.run_model(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

files = ["freyberg.hds", "freyberg.cbc"]
for f in files:
Expand Down
2 changes: 1 addition & 1 deletion .docs/Notebooks/dis_triangle_example.py
Expand Up @@ -22,7 +22,6 @@
# First set the path and import the required packages. The flopy path doesn't have to be set if you install flopy from a binary installer. If you want to run this notebook, you have to set the path to your own flopy path.

# +
import os
import sys
from pathlib import Path
from tempfile import TemporaryDirectory
Expand Down Expand Up @@ -254,6 +253,7 @@ def chdhead(x):
)
sim.write_simulation()
success, buff = sim.run_simulation(report=True)
assert success

# +
fname = workspace / f"{name}.hds"
Expand Down
3 changes: 3 additions & 0 deletions .docs/Notebooks/dis_voronoi_example.py
Expand Up @@ -25,6 +25,7 @@
import os
import sys
from pathlib import Path
from pprint import pformat
from tempfile import TemporaryDirectory

import matplotlib as mpl
Expand Down Expand Up @@ -171,6 +172,7 @@
)
sim.write_simulation()
success, buff = sim.run_simulation(report=True, silent=True)
assert success, pformat(buff)

head = gwf.output.head().get_data()
bdobj = gwf.output.budget()
Expand Down Expand Up @@ -236,6 +238,7 @@

sim.write_simulation()
success, buff = sim.run_simulation(report=True, silent=True)
assert success, pformat(buff)

conc = gwt.output.concentration().get_data()

Expand Down
13 changes: 3 additions & 10 deletions .docs/Notebooks/drain_return_example.py
Expand Up @@ -20,6 +20,7 @@

# +
import sys
from pprint import pformat
from tempfile import TemporaryDirectory

import matplotlib as mpl
Expand Down Expand Up @@ -71,11 +72,7 @@
# run the drt model
m.write_input()
success, buff = m.run_model(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

# plot heads for the drt model
hds = flopy.utils.HeadFile(os.path.join(m.model_ws, f"{m.name}.hds"))
Expand All @@ -91,11 +88,7 @@
# run the drain model
m.write_input()
success, buff = m.run_model(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

# plot the heads for the model with the drain
hds = flopy.utils.HeadFile(os.path.join(m.model_ws, f"{m.name}.hds"))
Expand Down
2 changes: 0 additions & 2 deletions .docs/Notebooks/export_tutorial.py
Expand Up @@ -17,8 +17,6 @@

# # Exporting to netCDF and shapefile

import datetime

# +
import os
import sys
Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/external_file_handling_tutorial.py
Expand Up @@ -22,7 +22,6 @@

# +
import os
import shutil
import sys
from tempfile import TemporaryDirectory

Expand Down
10 changes: 4 additions & 6 deletions .docs/Notebooks/feat_working_stack_examples.py
Expand Up @@ -20,6 +20,7 @@

import sys
from pathlib import Path
from pprint import pformat
from tempfile import TemporaryDirectory

import matplotlib as mpl
Expand All @@ -33,11 +34,7 @@
proj_root = Path.cwd().parent.parent

# run installed version of flopy or add local path
try:
import flopy
except:
sys.path.append(proj_root)
import flopy
import flopy

print(sys.version)
print(f"numpy version: {np.__version__}")
Expand Down Expand Up @@ -92,7 +89,8 @@

# Now run the model.

ml.run_model(silent=True)
success, buff = ml.run_model(silent=True)
assert success, pformat(buff)

# ### Inspecting outputs
#
Expand Down
1 change: 0 additions & 1 deletion .docs/Notebooks/get_transmissivities_example.py
Expand Up @@ -28,7 +28,6 @@
# * any other analysis where a distribution of transmissivity by layer is needed for a specified vertical interval of the model.

# +
import os
import sys
from tempfile import TemporaryDirectory

Expand Down
2 changes: 0 additions & 2 deletions .docs/Notebooks/grid_intersection_example.py
Expand Up @@ -38,7 +38,6 @@
# Import packages

# +
import os
import sys

import matplotlib as mpl
Expand All @@ -49,7 +48,6 @@
LineString,
MultiLineString,
MultiPoint,
MultiPolygon,
Point,
Polygon,
)
Expand Down
22 changes: 7 additions & 15 deletions .docs/Notebooks/gridgen_example.py
Expand Up @@ -25,22 +25,16 @@

# +
import os
import shutil
import sys
from pprint import pformat
from tempfile import TemporaryDirectory

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

# run installed version of flopy or add local path
try:
import flopy
except:
fpth = os.path.abspath(os.path.join("..", ".."))
sys.path.append(fpth)
import flopy

import flopy
from flopy.utils import flopy_io
from flopy.utils.gridgen import Gridgen

Expand Down Expand Up @@ -283,7 +277,8 @@
saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")],
)
sim.write_simulation()
sim.run_simulation(silent=True)
success, buff = sim.run_simulation(silent=True)
assert success, pformat(buff)
head = gwf.output.head().get_data()
bud = gwf.output.budget()
spdis = bud.get_data(text="DATA-SPDIS")[0]
Expand Down Expand Up @@ -385,7 +380,8 @@
saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")],
)
sim.write_simulation()
sim.run_simulation(silent=True)
success, buff = sim.run_simulation(silent=True)
assert success, pformat(buff)
head = gwf.output.head().get_data()
bud = gwf.output.budget()
spdis = bud.get_data(text="DATA-SPDIS")[0]
Expand Down Expand Up @@ -443,11 +439,7 @@
oc = flopy.modflow.ModflowOc(m)
m.write_input()
success, buff = m.run_model(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

# head is returned as a list of head arrays for each layer
head_file = os.path.join(ws, f"{name}.hds")
Expand Down
15 changes: 3 additions & 12 deletions .docs/Notebooks/groundwater_paper_example_1.py
Expand Up @@ -24,18 +24,13 @@
# +
import os
import sys
from pprint import pformat

import matplotlib as mpl
import numpy as np

# run installed version of flopy or add local path
try:
import flopy
except:
fpth = os.path.abspath(os.path.join("..", "..", ".."))
sys.path.append(fpth)
import flopy

import flopy
import flopy.modflow as fpm
import flopy.utils as fpu

Expand Down Expand Up @@ -86,11 +81,7 @@

model.write_input()
success, buff = model.run_model(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

# After MODFLOW has responded with the positive {\tt Normal termination of simulation}, the calculated heads can be read from the binary output file. First a file object is created. As the modelname used for all MODFLOW files was specified as {\tt gwexample} in step 1, the file with the heads is called {\tt gwexample.hds}. FloPy includes functions to read data from the file object, including heads for specified layers or time steps, or head time series at individual cells. For this simple mode, all computed heads are read.

Expand Down
11 changes: 4 additions & 7 deletions .docs/Notebooks/groundwater_paper_uspb_example.py
Expand Up @@ -22,18 +22,14 @@
# +
import os
import sys
from pprint import pformat

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy.ndimage

try:
import flopy
except:
fpth = os.path.abspath(os.path.join("..", "..", ".."))
sys.path.append(fpth)
import flopy
import flopy

print(sys.version)
print(f"numpy version: {np.__version__}")
Expand Down Expand Up @@ -107,7 +103,8 @@
ml.change_model_ws(ws)
ml.exe_name = "mf2005dbl"
ml.write_input()
ml.run_model(silent=True)
success, buff = ml.run_model(silent=True)
assert success, pformat(buff)

# +
hedObj = flopy.utils.HeadFile(os.path.join(ws, "DG.hds"), precision="double")
Expand Down
15 changes: 3 additions & 12 deletions .docs/Notebooks/lake_example.py
Expand Up @@ -21,19 +21,14 @@
# +
import os
import sys
from pprint import pformat
from tempfile import TemporaryDirectory

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

# run installed version of flopy or add local path
try:
import flopy
except:
fpth = os.path.abspath(os.path.join("..", ".."))
sys.path.append(fpth)
import flopy
import flopy

# temporary directory
temp_dir = TemporaryDirectory()
Expand Down Expand Up @@ -101,11 +96,7 @@
oc = flopy.modflow.ModflowOc(ml)
ml.write_input()
success, buff = ml.run_model(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

# Once the model has terminated normally, we can read the heads file. First, a link to the heads file is created with `HeadFile`. The link can then be accessed with the `get_data` function, by specifying, in this case, the step number and period number for which we want to retrieve data. A three-dimensional array is returned of size `nlay, nrow, ncol`. Matplotlib contouring functions are used to make contours of the layers or a cross-section.

Expand Down
7 changes: 2 additions & 5 deletions .docs/Notebooks/lgr_tutorial01.py
Expand Up @@ -25,6 +25,7 @@
# +
import os
import sys
from pprint import pformat
from tempfile import TemporaryDirectory

import matplotlib as mpl
Expand Down Expand Up @@ -277,11 +278,7 @@

sim.write_simulation()
success, buff = sim.run_simulation(silent=True, report=True)
if success:
for line in buff:
print(line)
else:
raise ValueError("Failed to run.")
assert success, pformat(buff)

# +
# load and store the head arrays from the parent and child models
Expand Down
8 changes: 1 addition & 7 deletions .docs/Notebooks/load_swr_binary_data_example.py
Expand Up @@ -28,13 +28,7 @@
# +
from IPython.display import Image

# run installed version of flopy or add local path
try:
import flopy
except:
fpth = os.path.abspath(os.path.join("..", ".."))
sys.path.append(fpth)
import flopy
import flopy

print(sys.version)
print(f"numpy version: {np.__version__}")
Expand Down

0 comments on commit 3ad1f7d

Please sign in to comment.