From 6b45106c40aa2fec6464c1a4ee5ec4172fe21caf Mon Sep 17 00:00:00 2001 From: Wes Bonelli Date: Thu, 31 Aug 2023 17:12:07 -0400 Subject: [PATCH] docs(PRT): add PRT introductory notebooks * temporary CI workarounds to update flopy classes, remove before merging --- .docs/Notebooks/mf6_prt_tutorial01.py | 311 +++++++++++++ .../modpath7_to_prt_migration_example.py | 422 ++++++++++++++++++ .github/workflows/commit.yml | 4 +- .github/workflows/examples.yml | 13 +- .github/workflows/regression.yml | 11 +- .github/workflows/rtd.yml | 21 +- 6 files changed, 768 insertions(+), 14 deletions(-) create mode 100644 .docs/Notebooks/mf6_prt_tutorial01.py create mode 100644 .docs/Notebooks/modpath7_to_prt_migration_example.py diff --git a/.docs/Notebooks/mf6_prt_tutorial01.py b/.docs/Notebooks/mf6_prt_tutorial01.py new file mode 100644 index 0000000000..43b7e409a9 --- /dev/null +++ b/.docs/Notebooks/mf6_prt_tutorial01.py @@ -0,0 +1,311 @@ +# --- +# jupyter: +# jupytext: +# notebook_metadata_filter: metadata +# text_representation: +# extension: .py +# format_name: light +# format_version: '1.5' +# jupytext_version: 1.15.0 +# kernelspec: +# display_name: Python 3 +# language: python +# name: python3 +# metadata: +# section: mf6 +# --- + +# # MODFLOW 6 PRT (particle-tracking) tutorial + +# This tutorial runs a GWF model then a PRT model +# in separate simulations via flow model interface. +# +# The grid is a 10x10 square with a single layer, +# the same flow system shown in the FloPy readme. +# +# Particles are released from the top left cell. +# +# ## Initial setup +# +# First, import dependencies, set up a temporary workspace, and define some filenames and model parameters. + + +import os +from pathlib import Path +from tempfile import TemporaryDirectory + +import matplotlib.cm as cm +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + +import flopy +from flopy.utils import PathlineFile +from flopy.utils.binaryfile import HeadFile + +# workspace +temp_dir = TemporaryDirectory() +ws = Path(temp_dir.name) + +# model names +name = "prtfmi01" +gwfname = f"{name}_gwf" +prtname = f"{name}_prt" +mp7name = f"{name}_mp7" + +# output file names +gwf_budget_file = f"{gwfname}.bud" +gwf_head_file = f"{gwfname}.hds" +prt_track_file = f"{prtname}.trk" +prt_track_csv_file = f"{prtname}.trk.csv" +mp7_pathline_file = f"{mp7name}.mppth" + +# model info +nlay = 1 +nrow = 10 +ncol = 10 +top = 1.0 +botm = [0.0] +nper = 1 +perlen = 1.0 +nstp = 1 +tsmult = 1.0 +porosity = 0.1 + +# Define release points. We will release three particles from the top left cell of the model. + +# release points +releasepts = [ + # particle index, k, i, j, x, y, z + # (0-based indexing converted to 1-based for mf6 by flopy) + (0, 0, 0, 0, 0.25, 9.25, 0.5), + (1, 0, 0, 0, 0.5, 9.5, 0.5), + (2, 0, 0, 0, 0.75, 9.75, 0.5), +] + +# Particle-tracking models require a flow solution to solve for particle motion — PRT models may either run side-by-side with a GWF model with an exchange, or may consume the output of a previously run GWF model via flow model interface. +# +# In this tutorial we do the latter. First we define a GWF model and simulation, then a separate PRT model/simulation. +# +# Define a function to build a MODFLOW 6 GWF model. + + +def build_gwf_sim(ws, mf6): + # create simulation + sim = flopy.mf6.MFSimulation( + sim_name=name, + exe_name=mf6, + version="mf6", + sim_ws=ws, + ) + + # create tdis package + flopy.mf6.modflow.mftdis.ModflowTdis( + sim, + pname="tdis", + time_units="DAYS", + nper=nper, + perioddata=[(perlen, nstp, tsmult)], + ) + + # create gwf model + gwf = flopy.mf6.ModflowGwf(sim, modelname=gwfname, save_flows=True) + + # create gwf discretization + flopy.mf6.modflow.mfgwfdis.ModflowGwfdis( + gwf, + pname="dis", + nlay=nlay, + nrow=nrow, + ncol=ncol, + ) + + # create gwf initial conditions package + flopy.mf6.modflow.mfgwfic.ModflowGwfic(gwf, pname="ic") + + # create gwf node property flow package + flopy.mf6.modflow.mfgwfnpf.ModflowGwfnpf( + gwf, + pname="npf", + save_saturation=True, + save_specific_discharge=True, + ) + + # create gwf chd package + spd = { + 0: [[(0, 0, 0), 1.0, 1.0], [(0, 9, 9), 0.0, 0.0]], + 1: [[(0, 0, 0), 0.0, 0.0], [(0, 9, 9), 1.0, 2.0]], + } + chd = flopy.mf6.ModflowGwfchd( + gwf, + pname="CHD-1", + stress_period_data=spd, + auxiliary=["concentration"], + ) + + # create gwf output control package + oc = flopy.mf6.ModflowGwfoc( + gwf, + budget_filerecord=gwf_budget_file, + head_filerecord=gwf_head_file, + saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")], + ) + + # create iterative model solution for gwf model + ims = flopy.mf6.ModflowIms(sim) + + return sim + + +# Define the PRT simulation. + + +def build_prt_sim(ws, mf6): + # create simulation + sim = flopy.mf6.MFSimulation( + sim_name=name, + exe_name=mf6, + version="mf6", + sim_ws=ws, + ) + + # create tdis package + flopy.mf6.modflow.mftdis.ModflowTdis( + sim, + pname="tdis", + time_units="DAYS", + nper=nper, + perioddata=[(perlen, nstp, tsmult)], + ) + + # create prt model + prt = flopy.mf6.ModflowPrt(sim, modelname=prtname) + + # create prt discretization + flopy.mf6.modflow.mfgwfdis.ModflowGwfdis( + prt, + pname="dis", + nlay=nlay, + nrow=nrow, + ncol=ncol, + ) + + # create mip package + flopy.mf6.ModflowPrtmip(prt, pname="mip", porosity=porosity) + + # create prp package + flopy.mf6.ModflowPrtprp( + prt, + pname="prp1", + filename=f"{prtname}_1.prp", + nreleasepts=len(releasepts), + packagedata=releasepts, + perioddata={0: ["FIRST"]}, + ) + + # create output control package + flopy.mf6.ModflowPrtoc( + prt, + pname="oc", + track_filerecord=[prt_track_file], + trackcsv_filerecord=[prt_track_csv_file], + ) + + # create the flow model interface + flopy.mf6.ModflowPrtfmi( + prt, + packagedata=[ + ("GWFHEAD", gwf_head_file), + ("GWFBUDGET", gwf_budget_file), + ], + ) + + # add explicit model solution + ems = flopy.mf6.ModflowEms( + sim, + pname="ems", + filename=f"{prtname}.ems", + ) + sim.register_solution_package(ems, [prt.name]) + + return sim + + +# ## Running models +# +# Next, build and run the models. The flow model must run before the tracking model so the latter can consume the former's cell budget output file (configured above via flow model interface). + +# build mf6 models +gwfsim = build_gwf_sim(ws, "mf6") +prtsim = build_prt_sim(ws, "mf6") + +# run mf6 models +for sim in [gwfsim, prtsim]: + sim.write_simulation() + success, _ = sim.run_simulation() + assert success + +# Extract model and grid objects from the simulations for use with plots. + +# extract model objects +gwf = gwfsim.get_model(gwfname) +prt = prtsim.get_model(prtname) + +# extract model grid +mg = gwf.modelgrid + +# ## Inspecting results +# +# Finally we can load and plot results. First make sure the expected output files were created, then load pathlines, heads, budget, and specific discharge data. + +# check mf6 output files exist +assert (ws / gwf_budget_file).is_file() +assert (ws / gwf_head_file).is_file() +assert (ws / prt_track_file).is_file() +assert (ws / prt_track_csv_file).is_file() + +# load pathlines +pls = pd.read_csv(ws / prt_track_csv_file) + +# extract head, budget, and specific discharge results from GWF model +hds = HeadFile(ws / gwf_head_file).get_data() +bud = gwf.output.budget() +spdis = bud.get_data(text="DATA-SPDIS")[0] +qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge(spdis, gwf) + +# Path points/lines can be plotted straightforwardly. + +# plot mf6 pathlines in map view +fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(13, 13)) +ax.set_aspect("equal") +pmv = flopy.plot.PlotMapView(modelgrid=mg, ax=ax) +pmv.plot_grid() +pmv.plot_array(hds[0], alpha=0.1) +pmv.plot_vector(qx, qy, normalize=True, color="white") +pathlines = pls.groupby(["imdl", "iprp", "irpt", "trelease"]) +for ipl, ((imdl, iprp, irpt, trelease), pl) in enumerate(pathlines): + pl.plot( + title="Pathlines", + kind="line", + x="x", + y="y", + marker="o", + ax=ax, + legend=False, + color=cm.plasma(ipl / len(pathlines)), + ) + +# Alternatively, with FloPy's built-in pathline plotting utilities: + +fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(13, 13)) +ax.set_aspect("equal") +pmv = flopy.plot.PlotMapView(modelgrid=mg, ax=ax) +pmv.plot_grid() +pmv.plot_array(hds[0], alpha=0.1) +pmv.plot_vector(qx, qy, normalize=True, color="white") +colors = cm.plasma( + np.linspace( + 0, 1, pls.groupby(["imdl", "iprp", "irpt", "trelease"]).ngroups + ) +) +pmv.plot_pathline(pls, layer="all", colors=colors, linewidth=2) diff --git a/.docs/Notebooks/modpath7_to_prt_migration_example.py b/.docs/Notebooks/modpath7_to_prt_migration_example.py new file mode 100644 index 0000000000..d740156aaf --- /dev/null +++ b/.docs/Notebooks/modpath7_to_prt_migration_example.py @@ -0,0 +1,422 @@ +# --- +# jupyter: +# jupytext: +# notebook_metadata_filter: metadata +# text_representation: +# extension: .py +# format_name: light +# format_version: '1.5' +# jupytext_version: 1.15.0 +# kernelspec: +# display_name: Python 3 +# language: python +# name: python3 +# metadata: +# section: mf6 +# --- + +# # Migrating from MODPATH 7 to MODFLOW 6 PRT + +# This example runs a GWF model, then a PRT model +# in separate simulations via flow model interface, +# then an identical MODPATH 7 model for comparison. +# +# The grid is a 10x10 square with a single layer, +# the same flow system shown in the FloPy readme. +# +# Particles are released from the top left cell. + +# First, import dependencies, set up a temporary workspace, and define some filenames and model parameters. + + +import os +from pathlib import Path +from tempfile import TemporaryDirectory + +import matplotlib.cm as cm +import matplotlib.pyplot as plt +import numpy as np +import pandas as pd + +import flopy +from flopy.utils import PathlineFile +from flopy.utils.binaryfile import HeadFile + +# workspace +temp_dir = TemporaryDirectory() +ws = Path(temp_dir.name) + +# model names +name = "prtfmi01" +gwfname = f"{name}_gwf" +prtname = f"{name}_prt" +mp7name = f"{name}_mp7" + +# output file names +gwf_budget_file = f"{gwfname}.bud" +gwf_head_file = f"{gwfname}.hds" +prt_track_file = f"{prtname}.trk" +prt_track_csv_file = f"{prtname}.trk.csv" +mp7_pathline_file = f"{mp7name}.mppth" + +# model info +nlay = 1 +nrow = 10 +ncol = 10 +top = 1.0 +botm = [0.0] +nper = 1 +perlen = 1.0 +nstp = 1 +tsmult = 1.0 +porosity = 0.1 + + +# ## MODFLOW 6 GWF setup + +# Both the PRT and MP7 models depend on the same GWF model. + + +def build_gwf_sim(ws, mf6): + # create simulation + sim = flopy.mf6.MFSimulation( + sim_name=name, + exe_name=mf6, + version="mf6", + sim_ws=ws, + ) + + # create tdis package + flopy.mf6.modflow.mftdis.ModflowTdis( + sim, + pname="tdis", + time_units="DAYS", + nper=nper, + perioddata=[(perlen, nstp, tsmult)], + ) + + # create gwf model + gwf = flopy.mf6.ModflowGwf(sim, modelname=gwfname, save_flows=True) + + # create gwf discretization + flopy.mf6.modflow.mfgwfdis.ModflowGwfdis( + gwf, + pname="dis", + nlay=nlay, + nrow=nrow, + ncol=ncol, + ) + + # create gwf initial conditions package + flopy.mf6.modflow.mfgwfic.ModflowGwfic(gwf, pname="ic") + + # create gwf node property flow package + flopy.mf6.modflow.mfgwfnpf.ModflowGwfnpf( + gwf, + pname="npf", + save_saturation=True, + save_specific_discharge=True, + ) + + # create gwf chd package + spd = { + 0: [[(0, 0, 0), 1.0, 1.0], [(0, 9, 9), 0.0, 0.0]], + 1: [[(0, 0, 0), 0.0, 0.0], [(0, 9, 9), 1.0, 2.0]], + } + chd = flopy.mf6.ModflowGwfchd( + gwf, + pname="CHD-1", + stress_period_data=spd, + auxiliary=["concentration"], + ) + + # create gwf output control package + oc = flopy.mf6.ModflowGwfoc( + gwf, + budget_filerecord=gwf_budget_file, + head_filerecord=gwf_head_file, + saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")], + ) + + # create iterative model solution for gwf model + ims = flopy.mf6.ModflowIms(sim) + + return sim + + +# ## Release points + +# FloPy provides utilities to convert MODPATH 7 particle data +# to the appropriate format for MODFLOW 6 PRT PRP package input. + +# We specify release point locations in MODPATH 7 format, then +# convert from local to global coordinates for MODFLOW 6 PRT. + +# release points in mp7 format (using local coordinates) +releasepts_mp7 = [ + # node number, localx, localy, localz + # (0-based indexing converted to 1-based for mp7 by flopy) + (0, float(f"0.{i + 1}"), float(f"0.{i + 1}"), 0.5) + for i in range(9) +] + + +def get_partdata(grid): + return flopy.modpath.ParticleData( + partlocs=[grid.get_lrc(p[0])[0] for p in releasepts_mp7], + structured=True, + localx=[p[1] for p in releasepts_mp7], + localy=[p[2] for p in releasepts_mp7], + localz=[p[3] for p in releasepts_mp7], + timeoffset=0, + drape=0, + ) + + +# ## MODFLOW 6 PRT setup + +# We can now build the PRT simulation, using FloPy's `ParticleData.to_coords()` method to ease +# the conversion from MODPATH 7 to MODFLOW 6 PRT release points. + + +def build_prt_sim(ws, mf6): + # create simulation + sim = flopy.mf6.MFSimulation( + sim_name=name, + exe_name=mf6, + version="mf6", + sim_ws=ws, + ) + + # create tdis package + flopy.mf6.modflow.mftdis.ModflowTdis( + sim, + pname="tdis", + time_units="DAYS", + nper=nper, + perioddata=[(perlen, nstp, tsmult)], + ) + + # create prt model + prt = flopy.mf6.ModflowPrt(sim, modelname=prtname) + + # create prt discretization + flopy.mf6.modflow.mfgwfdis.ModflowGwfdis( + prt, + pname="dis", + nlay=nlay, + nrow=nrow, + ncol=ncol, + ) + + # create mip package + flopy.mf6.ModflowPrtmip(prt, pname="mip", porosity=porosity) + + # convert mp7 particledata to prt release points + partdata = get_partdata(prt.modelgrid) + coords = partdata.to_coords(prt.modelgrid) + releasepts = [(i, 0, 0, 0, c[0], c[1], c[2]) for i, c in enumerate(coords)] + + # create prp package + flopy.mf6.ModflowPrtprp( + prt, + pname="prp1", + filename=f"{prtname}_1.prp", + nreleasepts=len(releasepts), + packagedata=releasepts, + perioddata={0: ["FIRST"]}, + ) + + # create output control package + flopy.mf6.ModflowPrtoc( + prt, + pname="oc", + track_filerecord=[prt_track_file], + trackcsv_filerecord=[prt_track_csv_file], + ) + + # create the flow model interface + flopy.mf6.ModflowPrtfmi( + prt, + packagedata=[ + ("GWFHEAD", gwf_head_file), + ("GWFBUDGET", gwf_budget_file), + ], + ) + + # add explicit model solution + ems = flopy.mf6.ModflowEms( + sim, + pname="ems", + filename=f"{prtname}.ems", + ) + sim.register_solution_package(ems, [prt.name]) + + return sim + + +# ## MODPATH 7 setup + +# Finally we can build the MODPATH 7 model and simulation. + + +def build_mp7_sim(ws, mp7, gwf): + # convert mp7 particledata to prt release points + partdata = get_partdata(gwf.modelgrid) + + # create modpath 7 simulation + pg = flopy.modpath.ParticleGroup( + particlegroupname="G1", + particledata=partdata, + filename=f"{mp7name}.sloc", + ) + mp = flopy.modpath.Modpath7( + modelname=mp7name, + flowmodel=gwf, + exe_name=mp7, + model_ws=ws, + ) + mpbas = flopy.modpath.Modpath7Bas( + mp, + porosity=porosity, + ) + mpsim = flopy.modpath.Modpath7Sim( + mp, + simulationtype="pathline", + trackingdirection="forward", + budgetoutputoption="summary", + stoptimeoption="extend", + particlegroups=[pg], + ) + + return mp + + +# ## Running the models + +# Construct and run the models. + +# build mf6 simulations +gwfsim = build_gwf_sim(ws, "mf6") +prtsim = build_prt_sim(ws, "mf6") + +# extract models and grid (useful for plotting etc) +gwf = gwfsim.get_model(gwfname) +prt = prtsim.get_model(prtname) +mg = gwf.modelgrid + +# build mp7 model +mp7sim = build_mp7_sim(ws, "mp7", gwf) + +# run mf6 models +for sim in [gwfsim, prtsim]: + sim.write_simulation() + success, _ = sim.run_simulation() + assert success + +# run mp7 model +mp7sim.write_input() +success, _ = mp7sim.run_model() +assert success + +# ## Inspecting the results + +# Make sure the expected output files exist. + +# check mf6 output files exist +assert (ws / gwf_budget_file).is_file() +assert (ws / gwf_head_file).is_file() +assert (ws / prt_track_file).is_file() +assert (ws / prt_track_csv_file).is_file() + +# check mp7 output files exist +assert (ws / mp7_pathline_file).is_file() + +# Load results from MODPATH 7 and MODFLOW 6 output files. + +# load mf6 pathlines +pls = pd.read_csv(ws / prt_track_csv_file) + +# load mp7 pathlines +plf = PathlineFile(ws / mp7_pathline_file) +mp7_pldata = pd.DataFrame( + plf.get_destination_pathline_data(range(mg.nnodes), to_recarray=True) +) + +# convert mp7 pathline fields from 0- to 1-based indexing +mp7_pldata["particleid"] = mp7_pldata["particleid"] + 1 +mp7_pldata["particlegroup"] = mp7_pldata["particlegroup"] + 1 +mp7_pldata["node"] = mp7_pldata["node"] + 1 +mp7_pldata["k"] = mp7_pldata["k"] + 1 + +# load head, budget, and specific discharge from gwf model +hds = HeadFile(ws / gwf_head_file).get_data() +bud = gwf.output.budget() +spdis = bud.get_data(text="DATA-SPDIS")[0] +qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge(spdis, gwf) + +# Finally, plot the MODPATH 7 and MODFLOW 6 pathlines side-by-side in map view. + +# + +# plot mf6 and mp7 pathlines in map view +fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(13, 13)) +for a in ax: + a.set_aspect("equal") + +pmv = flopy.plot.PlotMapView(modelgrid=mg, ax=ax[0]) +pmv.plot_grid() +pmv.plot_array(hds[0], alpha=0.1) +pmv.plot_vector(qx, qy, normalize=True, color="white") +pathlines = pls.groupby(["imdl", "iprp", "irpt", "trelease"]) +for ipl, ((imdl, iprp, irpt, trelease), pl) in enumerate(pathlines): + pl.plot( + title="MF6 pathlines", + kind="line", + x="x", + y="y", + marker="o", + ax=ax[0], + legend=False, + color=cm.plasma(ipl / len(pathlines)), + ) + +pmv = flopy.plot.PlotMapView(modelgrid=mg, ax=ax[1]) +pmv.plot_grid() +pmv.plot_array(hds[0], alpha=0.1) +pmv.plot_vector(qx, qy, normalize=True, color="white") +mp7_plines = mp7_pldata.groupby(["particleid"]) +for ipl, (pid, pl) in enumerate(mp7_plines): + pl.plot( + title="MP7 pathlines", + kind="line", + x="x", + y="y", + marker="o", + ax=ax[1], + legend=False, + color=cm.plasma(ipl / len(mp7_plines)), + ) +# - + +# Alternatively, FloPy built-in plotting functions can be used to plot pathlines. + +# + +fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(13, 13)) +for a in ax: + a.set_aspect("equal") + +colors = cm.plasma(np.linspace(0, 1, len(mp7_pldata.particleid.unique()))) + +pmv = flopy.plot.PlotMapView(modelgrid=mg, ax=ax[0]) +pmv.plot_grid() +pmv.plot_array(hds[0], alpha=0.1) +pmv.plot_vector(qx, qy, normalize=True, color="white") +pmv.plot_pathline(pls, layer="all", colors=colors) +ax[0].set_title("MP7 pathlines") + +pmv = flopy.plot.PlotMapView(modelgrid=mg, ax=ax[1]) +pmv.plot_grid() +pmv.plot_array(hds[0], alpha=0.1) +pmv.plot_vector(qx, qy, normalize=True, color="white") +pmv.plot_pathline(mp7_pldata, layer="all", colors=colors) +ax[1].set_title("MP7 pathlines") diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 79decdc901..1c76d99992 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -215,12 +215,12 @@ jobs: - name: Update FloPy packages if: runner.os != 'Windows' - run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup + run: python -m flopy.mf6.utils.generate_classes --owner aprovost-usgs --ref PRT --no-backup - name: Update FloPy packages if: runner.os == 'Windows' shell: bash -l {0} - run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup + run: python -m flopy.mf6.utils.generate_classes --owner aprovost-usgs --ref PRT --no-backup - name: Run tests if: runner.os != 'Windows' diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 62df8cf843..5b0f27c22d 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -37,8 +37,8 @@ jobs: if: runner.os != 'Windows' run: | pip install --upgrade pip - pip install . - pip install ".[test, optional]" + pip install https://github.com/w-bonelli/flopy/archive/prt-utils.zip + pip install "flopy[test, optional]" - name: Setup Micromamba if: runner.os == 'Windows' @@ -53,12 +53,13 @@ jobs: bash powershell - - name: Install extra Python dependencies + - name: Install Python dependencies if: runner.os == 'Windows' shell: bash -l {0} run: | pip install xmipy - pip install . + pip install https://github.com/w-bonelli/flopy/archive/prt-utils.zip + pip install "flopy[test, optional]" - name: Workaround OpenGL issue on Linux if: runner.os == 'Linux' @@ -86,12 +87,12 @@ jobs: - name: Update FloPy packages if: runner.os != 'Windows' - run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup + run: python -m flopy.mf6.utils.generate_classes --owner aprovost-usgs --ref PRT --no-backup - name: Update FloPy packages if: runner.os == 'Windows' shell: bash -l {0} - run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup + run: python -m flopy.mf6.utils.generate_classes --owner aprovost-usgs --ref PRT --no-backup - name: Run example tests if: runner.os != 'Windows' diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 706966521a..6a59a9d30a 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -37,8 +37,8 @@ jobs: if: runner.os != 'Windows' run: | pip install --upgrade pip - pip install . - pip install ".[test, optional]" + pip install https://github.com/w-bonelli/flopy/archive/prt-utils.zip + pip install "flopy[test, optional]" - name: Setup Micromamba if: runner.os == 'Windows' @@ -58,7 +58,8 @@ jobs: shell: bash -l {0} run: | pip install xmipy - pip install . + pip install https://github.com/w-bonelli/flopy/archive/prt-utils.zip + pip install "flopy[test, optional]" - name: Install Modflow-related executables uses: modflowpy/install-modflow-action@v1 @@ -70,12 +71,12 @@ jobs: - name: Update FloPy packages if: runner.os != 'Windows' - run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup + run: python -m flopy.mf6.utils.generate_classes --owner aprovost-usgs --ref PRT --no-backup - name: Update FloPy packages if: runner.os == 'Windows' shell: bash -l {0} - run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup + run: python -m flopy.mf6.utils.generate_classes --owner aprovost-usgs --ref PRT --no-backup - name: Run regression tests if: runner.os != 'Windows' diff --git a/.github/workflows/rtd.yml b/.github/workflows/rtd.yml index 5df817f687..f80a75dce1 100644 --- a/.github/workflows/rtd.yml +++ b/.github/workflows/rtd.yml @@ -30,6 +30,11 @@ jobs: steps: - name: Checkout flopy repo uses: actions/checkout@v3 + with: + repository: w-bonelli/flopy + ref: prt-utils + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 - name: Output repo information run: | @@ -49,7 +54,9 @@ jobs: run: python -m pip install --upgrade pip - name: Install flopy and dependencies - run: pip install ".[test, doc, optional]" + run: | + pip install . + pip install ".[test, optional]" - name: Workaround OpenGL issue on Linux if: runner.os == 'Linux' @@ -77,6 +84,18 @@ jobs: - name: Install MODFLOW executables uses: modflowpy/install-modflow-action@v1 + - name: Update FloPy classes + run: | + import flopy + flopy.mf6.utils.generate_classes(owner="aprovost-usgs", ref="PRT", backup=False) + shell: python + + # todo remove before merging + - name: Reinstall flopy and checkout notebooks + run: | + pip install . + git checkout origin/prt-notebooks -- .docs/Notebooks + - name: Run tutorial and example notebooks working-directory: autotest run: pytest -v -n auto test_notebooks.py