From 333da66520b59313abdf5d0a7176404f5471f85e Mon Sep 17 00:00:00 2001 From: Mike Taves Date: Tue, 26 Nov 2024 15:19:30 +1300 Subject: [PATCH] chore: reformat multi-line statements (#234) Refactor some multi-line statements. This was mostly automated by temporarily toggling skip-magic-trailing-comma = true in ruff.toml, then selecting some commits that condense multi-line statements to single, while rejecting other statements that are better represented over multiple lines. There was no exact rule-of-thumb for the process, except to try and maintain the same style in surrounding code blocks. Note that while there are fewer lines, there are no functional changes. --- scripts/ex-gwe-ates.py | 5 +- scripts/ex-gwe-barends.py | 10 +- scripts/ex-gwe-geotherm.py | 24 +- scripts/ex-gwe-prt.py | 47 +-- scripts/ex-gwe-radial.py | 33 +- scripts/ex-gwe-vsc.py | 6 +- scripts/ex-gwf-advtidal.py | 41 +- scripts/ex-gwf-bcf2ss.py | 74 +--- scripts/ex-gwf-bump.py | 34 +- scripts/ex-gwf-capture.py | 34 +- scripts/ex-gwf-csub-p01.py | 18 +- scripts/ex-gwf-csub-p02.py | 35 +- scripts/ex-gwf-csub-p03.py | 173 +------- scripts/ex-gwf-csub-p04.py | 39 +- scripts/ex-gwf-curvilinear-90.py | 10 +- scripts/ex-gwf-curvilinear.py | 16 +- scripts/ex-gwf-disvmesh.py | 17 +- scripts/ex-gwf-drn-p01.py | 649 ++--------------------------- scripts/ex-gwf-lak-p01.py | 38 +- scripts/ex-gwf-lak-p02.py | 420 ++----------------- scripts/ex-gwf-lgr.py | 10 +- scripts/ex-gwf-lgrv.py | 18 +- scripts/ex-gwf-maw-p01.py | 44 +- scripts/ex-gwf-maw-p02.py | 46 +- scripts/ex-gwf-maw-p03.py | 72 +--- scripts/ex-gwf-nwt-p02.py | 23 +- scripts/ex-gwf-nwt-p03.py | 66 +-- scripts/ex-gwf-radial.py | 11 +- scripts/ex-gwf-sagehen.py | 15 +- scripts/ex-gwf-sfr-p01.py | 649 ++--------------------------- scripts/ex-gwf-sfr-p01b.py | 58 +-- scripts/ex-gwf-sfr-pindersauer.py | 12 +- scripts/ex-gwf-spbc.py | 3 +- scripts/ex-gwf-twri.py | 39 +- scripts/ex-gwf-u1disv.py | 10 +- scripts/ex-gwf-u1gwfgwf.py | 31 +- scripts/ex-gwf-whirl.py | 3 +- scripts/ex-gwt-gwtgwt-p10.py | 17 +- scripts/ex-gwt-hecht-mendez.py | 38 +- scripts/ex-gwt-keating.py | 22 +- scripts/ex-gwt-moc3d-p01.py | 6 +- scripts/ex-gwt-mt3dms-p02.py | 12 +- scripts/ex-gwt-mt3dms-p03.py | 5 +- scripts/ex-gwt-mt3dms-p06.py | 8 +- scripts/ex-gwt-mt3dms-p07.py | 19 +- scripts/ex-gwt-mt3dms-p08.py | 9 +- scripts/ex-gwt-mt3dms-p09.py | 5 +- scripts/ex-gwt-mt3dms-p10.py | 5 +- scripts/ex-gwt-mt3dsupp82.py | 21 +- scripts/ex-gwt-prudic2004t2.py | 24 +- scripts/ex-gwt-rotate.py | 5 +- scripts/ex-gwt-stallman.py | 16 +- scripts/ex-gwt-synthetic-valley.py | 174 ++------ scripts/ex-gwt-uzt-2d.py | 18 +- scripts/ex-prt-mp7-p01.py | 16 +- scripts/ex-prt-mp7-p02.py | 30 +- scripts/ex-prt-mp7-p03.py | 26 +- scripts/ex-prt-mp7-p04.py | 16 +- scripts/process-scripts.py | 40 +- 59 files changed, 399 insertions(+), 2966 deletions(-) diff --git a/scripts/ex-gwe-ates.py b/scripts/ex-gwe-ates.py index d00b6a17..90c35b2c 100644 --- a/scripts/ex-gwe-ates.py +++ b/scripts/ex-gwe-ates.py @@ -947,9 +947,8 @@ def update(i): tempmesh.set_array(temps[i].flatten()) ax.set_title(f"Time = {times[i]} days") - ani = FuncAnimation( - fig, update, range(1, len(times)), init_func=init - ) # interval=25, + ani = FuncAnimation(fig, update, range(1, len(times)), init_func=init) + # interval=25, writer = PillowWriter(fps=10) fpth = figs_path / "{}{}".format(sim_name, ".gif") ani.save(fpth, writer=writer) diff --git a/scripts/ex-gwe-barends.py b/scripts/ex-gwe-barends.py index f0d1971c..f15c03f3 100644 --- a/scripts/ex-gwe-barends.py +++ b/scripts/ex-gwe-barends.py @@ -217,9 +217,8 @@ Qcell = Q_well * thick_interval / res_thickness id_left = (100 + ly, 0, 0) id_right = (100 + ly, 0, ncol - 1) - wel_spd_left.append( - [id_left, Qcell, T1] - ) # 30.0 is inflow temperature (auxiliary var) + # 30.0 is inflow temperature (auxiliary var) + wel_spd_left.append([id_left, Qcell, T1]) wel_spd_right.append([id_right, -Qcell]) ctp_left.append([id_left, T1]) @@ -458,7 +457,10 @@ def build_mf6_heat_model(): temperature_filerecord="{}.ucn".format(gwename), temperatureprintrecord=[("COLUMNS", 10, "WIDTH", 15, "DIGITS", 6, "GENERAL")], saverecord={ - 0: [("TEMPERATURE", "LAST"), ("BUDGET", "LAST")], + 0: [ + ("TEMPERATURE", "LAST"), + ("BUDGET", "LAST"), + ] }, printrecord={0: [("BUDGET", "LAST")]}, ) diff --git a/scripts/ex-gwe-geotherm.py b/scripts/ex-gwe-geotherm.py index f10e2fb9..3d0a47ba 100644 --- a/scripts/ex-gwe-geotherm.py +++ b/scripts/ex-gwe-geotherm.py @@ -777,13 +777,7 @@ def plot_grid(sim): # Create a Rectangle patch rect = patches.Rectangle( - (28, -0.5), - 9, - 6, - linewidth=1, - edgecolor="r", - facecolor="none", - zorder=3, + (28, -0.5), 9, 6, linewidth=1, edgecolor="r", facecolor="none", zorder=3 ) # Add the location of the inset plot to current plot @@ -909,9 +903,8 @@ def plot_temperature(sim, scen, time_): fig = plt.figure(figsize=figure_size) fig.tight_layout() - temp = ( - gwe.output.temperature().get_alldata() - ) # eventually restore to: .temperature(). + # eventually restore to: .temperature(). + temp = gwe.output.temperature().get_alldata() if time_ == 50: # first of two output times saved was at 50 days ct = 0 elif time_ == 100: # second of two output times saved was at 100 days @@ -931,12 +924,7 @@ def plot_temperature(sim, scen, time_): cs1 = pmv.contour_array(tempXXd, levels=levels, colors=cmaplist, linewidths=0.5) labels = ax.clabel( - cs1, - cs1.levels, - inline=False, - inline_spacing=0.0, - fmt="%1d", - fontsize=8, + cs1, cs1.levels, inline=False, inline_spacing=0.0, fmt="%1d", fontsize=8 ) cs2 = ax.contour( Xnew, @@ -956,9 +944,7 @@ def plot_temperature(sim, scen, time_): ax.set_xlim([29, 50]) ax.set_ylim([-8, 8]) styles.heading( - ax, - heading=" Simulated Temperature at " + str(time_) + " days", - idx=3, + ax, heading=" Simulated Temperature at " + str(time_) + " days", idx=3 ) # save figure diff --git a/scripts/ex-gwe-prt.py b/scripts/ex-gwe-prt.py index aa422230..dcc2a887 100644 --- a/scripts/ex-gwe-prt.py +++ b/scripts/ex-gwe-prt.py @@ -327,23 +327,13 @@ def build_gwe_sim(name): budget_filerecord="{}.cbc".format(gwe_name), temperature_filerecord="{}.ucn".format(gwe_name), temperatureprintrecord=[("COLUMNS", 10, "WIDTH", 15, "DIGITS", 6, "GENERAL")], - saverecord={ - 0: [("TEMPERATURE", "ALL"), ("BUDGET", "ALL")], - }, + saverecord={0: [("TEMPERATURE", "ALL"), ("BUDGET", "ALL")]}, printrecord=[("TEMPERATURE", "LAST"), ("BUDGET", "LAST")], ) pd = [ - ( - "GWFHEAD", - pl.Path(f"../{gwf_ws.name}/{gwf_name}.hds"), - None, - ), - ( - "GWFBUDGET", - pl.Path(f"../{gwf_ws.name}/{gwf_name}.cbc"), - None, - ), + ("GWFHEAD", pl.Path(f"../{gwf_ws.name}/{gwf_name}.hds"), None), + ("GWFBUDGET", pl.Path(f"../{gwf_ws.name}/{gwf_name}.cbc"), None), ] flopy.mf6.ModflowGwefmi(gwe, packagedata=pd) @@ -396,22 +386,11 @@ def build_prt_sim(name): ) pd = [ - ( - "GWFHEAD", - pl.Path(f"../{gwf_ws.name}/{gwf_name}.hds"), - None, - ), - ( - "GWFBUDGET", - pl.Path(f"../{gwf_ws.name}/{gwf_name}.cbc"), - None, - ), + ("GWFHEAD", pl.Path(f"../{gwf_ws.name}/{gwf_name}.hds"), None), + ("GWFBUDGET", pl.Path(f"../{gwf_ws.name}/{gwf_name}.cbc"), None), ] - flopy.mf6.ModflowPrtfmi( - prt, - packagedata=pd, - ) + flopy.mf6.ModflowPrtfmi(prt, packagedata=pd) ems = flopy.mf6.ModflowEms( sim, pname="ems", @@ -535,18 +514,10 @@ def plot_results(gwf_sim, gwe_sim, prt_sim, silent=True): handles.append( mpl.lines.Line2D( - [0], - [0], - marker="o", - linestyle="", - label="Well", - markerfacecolor="red", - ), - ) - ax.legend( - handles=handles, - loc="lower right", + [0], [0], marker="o", linestyle="", label="Well", markerfacecolor="red" + ) ) + ax.legend(handles=handles, loc="lower right") pmv.plot_vector(qx, qy, normalize=True, alpha=0.25) pmv.plot_bc(ftype="WEL") mf6_plines = pls.groupby(["iprp", "irpt", "trelease"]) diff --git a/scripts/ex-gwe-radial.py b/scripts/ex-gwe-radial.py index 4c74a643..512c4757 100644 --- a/scripts/ex-gwe-radial.py +++ b/scripts/ex-gwe-radial.py @@ -414,12 +414,9 @@ def generate_control_volumes(basedata, verts, flat_list, idx, silent=True): Lx = abs(right_x - left_x) # Work up the outer-most control volumes (iverts) - ( - left_chd_spd_slow, - right_chd_spd_slow, - ivt, - idx, - ) = create_outer_ring_of_ctrl_vols(next_rad, verts, iverts, xc, yc, ivt, idx) + (left_chd_spd_slow, right_chd_spd_slow, ivt, idx) = create_outer_ring_of_ctrl_vols( + next_rad, verts, iverts, xc, yc, ivt, idx + ) return ( ivt, @@ -947,24 +944,17 @@ def plot_temperature(sim, idx, scen_txt, vel_txt): # Get analytical solution simname = sim.name[:13] - adat = pd.read_csv( - fpath, - delimiter=",", - header=None, - names=["x", "y", "temp"], - ) + adat = pd.read_csv(fpath, delimiter=",", header=None, names=["x", "y", "temp"]) gwe = sim.get_model("gwe-" + simname.split("-")[2]) with styles.USGSPlot(): fig = plt.figure(figsize=figure_size) fig.tight_layout() - temp = ( - gwe.output.temperature().get_alldata() - ) # eventually restore to: .temperature(). - temp48h = temp[ - -1 - ] # Plot the temperature at 48 hours, same as analytical solution provided + # eventually restore to: .temperature(). + temp = gwe.output.temperature().get_alldata() + # Plot the temperature at 48 hours, same as analytical solution provided + temp48h = temp[-1] ax = fig.add_subplot(1, 1, 1, aspect="equal") pmv = flopy.plot.PlotMapView(model=gwe, ax=ax, layer=0) @@ -976,12 +966,7 @@ def plot_temperature(sim, idx, scen_txt, vel_txt): cs1 = pmv.contour_array(temp48h, levels=levels, colors=cmaplist, linewidths=0.5) labels = ax.clabel( - cs1, - cs1.levels, - inline=False, - inline_spacing=0.0, - fontsize=8, - fmt="%1d", + cs1, cs1.levels, inline=False, inline_spacing=0.0, fontsize=8, fmt="%1d" ) cs2 = ax.tricontour( adat["x"], diff --git a/scripts/ex-gwe-vsc.py b/scripts/ex-gwe-vsc.py index 3e3ac57c..14c05cba 100644 --- a/scripts/ex-gwe-vsc.py +++ b/scripts/ex-gwe-vsc.py @@ -712,11 +712,7 @@ def plot_results(sim, idx, temp_upper=4.0, temp_lower=4.0): # Make a difference plot, as in: actually make a difference fig, ax = plt.subplots( - ncols=1, - nrows=1, - figsize=figure_size_2, - constrained_layout=False, - dpi=600, + ncols=1, nrows=1, figsize=figure_size_2, constrained_layout=False, dpi=600 ) mm = flopy.plot.PlotMapView(model=gwt1, ax=ax) diff --git a/scripts/ex-gwf-advtidal.py b/scripts/ex-gwf-advtidal.py index a340b9ca..25391e29 100644 --- a/scripts/ex-gwf-advtidal.py +++ b/scripts/ex-gwf-advtidal.py @@ -87,31 +87,13 @@ # Recharge zones (constructed with shapely) recharge_zone_1 = Polygon( - shell=[ - (0, 0), - (3000, 0), - (3000, 5500), - (1000, 7500), - (0, 7500), - (0, 0), - ], + shell=[(0, 0), (3000, 0), (3000, 5500), (1000, 7500), (0, 7500), (0, 0)] ) recharge_zone_2 = Polygon( - shell=[ - (1000, 7500), - (3000, 5500), - (5000, 7500), - (1000, 7500), - ], + shell=[(1000, 7500), (3000, 5500), (5000, 7500), (1000, 7500)] ) recharge_zone_3 = Polygon( - shell=[ - (3000, 0), - (5000, 0), - (5000, 7500), - (3000, 5500), - (3000, 0), - ], + shell=[(3000, 0), (5000, 0), (5000, 7500), (3000, 5500), (3000, 0)] ) # Solver parameters @@ -243,9 +225,7 @@ def build_models(): known_hash="md5:6ca7366be279d679b14e8338a195422f", ) tsdict = get_timeseries( - fpath, - ["well_1_rate", "well_2_rate", "well_6_rate"], - 3 * ["stepwise"], + fpath, ["well_1_rate", "well_2_rate", "well_6_rate"], 3 * ["stepwise"] ) flopy.mf6.ModflowGwfwel( gwf, @@ -430,20 +410,11 @@ def plot_grid(sim): pmv = flopy.plot.PlotMapView(model=gwf, ax=ax) pmv.plot_grid(linewidth=0) for ip, (p, fc) in enumerate( - [ - (recharge_zone_1, "r"), - (recharge_zone_2, "b"), - (recharge_zone_3, "g"), - ] + [(recharge_zone_1, "r"), (recharge_zone_2, "b"), (recharge_zone_3, "g")] ): xs, ys = p.exterior.xy ax.fill( - xs, - ys, - alpha=0.25, - fc=fc, - ec="none", - label=f"Recharge Zone {ip + 1}", + xs, ys, alpha=0.25, fc=fc, ec="none", label=f"Recharge Zone {ip + 1}" ) ax.set_xlabel("x position (m)") ax.set_ylabel("y position (m)") diff --git a/scripts/ex-gwf-bcf2ss.py b/scripts/ex-gwf-bcf2ss.py index d83a5b16..993938a6 100644 --- a/scripts/ex-gwf-bcf2ss.py +++ b/scripts/ex-gwf-bcf2ss.py @@ -165,14 +165,7 @@ def build_models(name, rewet, wetfct, iwetit, ihdwet, linear_acceleration, newto botm=botm, ) if rewet: - rewet_record = [ - "wetfct", - wetfct, - "iwetit", - iwetit, - "ihdwet", - ihdwet, - ] + rewet_record = ["wetfct", wetfct, "iwetit", iwetit, "ihdwet", ihdwet] wetdry = [wetdry_layer0, 0] else: rewet_record = None @@ -244,22 +237,13 @@ def plot_simulated_results(num, gwf, ho, co, silent=True): cond = ("natural conditions", "pumping conditions") vmin, vmax = -10, 140 masked_values = [1e30, -1e30] - levels = [ - np.arange(0, 130, 10), - (10, 20, 30, 40, 50, 55, 60), - ] + levels = [np.arange(0, 130, 10), (10, 20, 30, 40, 50, 55, 60)] plot_number = 0 - for idx, totim in enumerate( - ( - 1, - 2, - ) - ): + for idx, totim in enumerate((1, 2)): head = ho.get_data(totim=totim) head[head < botm_arr] = -1e30 qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - co.get_data(text="DATA-SPDIS", kstpkper=(0, totim - 1))[0], - gwf, + co.get_data(text="DATA-SPDIS", kstpkper=(0, totim - 1))[0], gwf ) for k in range(nlay): @@ -307,24 +291,10 @@ def plot_simulated_results(num, gwf, ho, co, silent=True): # items for legend ax.plot( - -1000, - -1000, - "s", - ms=5, - color="green", - mec="black", - mew=0.5, - label="River", + -1000, -1000, "s", ms=5, color="green", mec="black", mew=0.5, label="River" ) ax.plot( - -1000, - -1000, - "s", - ms=5, - color="red", - mec="black", - mew=0.5, - label="Well", + -1000, -1000, "s", ms=5, color="red", mec="black", mew=0.5, label="Well" ) ax.plot( -1000, @@ -353,12 +323,7 @@ def plot_simulated_results(num, gwf, ho, co, silent=True): # color="black", # label="Head, in feet", # ) - styles.graph_legend( - ax, - ncol=5, - frameon=False, - loc="upper center", - ) + styles.graph_legend(ax, ncol=5, frameon=False, loc="upper center") cbar = plt.colorbar( cm, ax=ax, shrink=0.5, orientation="horizontal", location="bottom" @@ -436,24 +401,10 @@ def plot_results(silent=True): ax.spines["right"].set_color("none") ax.patch.set_alpha(0.0) ax.plot( - -1100, - -1100, - "s", - ms=5, - color="green", - mec="black", - mew=0.5, - label="River", + -1100, -1100, "s", ms=5, color="green", mec="black", mew=0.5, label="River" ) ax.plot( - -1100, - -1100, - "s", - ms=5, - color="red", - mec="black", - mew=0.5, - label="Well", + -1100, -1100, "s", ms=5, color="red", mec="black", mew=0.5, label="Well" ) ax.plot( -1100, @@ -465,12 +416,7 @@ def plot_results(silent=True): mew=0.5, label="Steady-state water table", ) - styles.graph_legend( - ax, - ncol=3, - frameon=False, - loc="upper center", - ) + styles.graph_legend(ax, ncol=3, frameon=False, loc="upper center") if plot_show: plt.show() diff --git a/scripts/ex-gwf-bump.py b/scripts/ex-gwf-bump.py index 85ab99fb..9bc41a52 100644 --- a/scripts/ex-gwf-bump.py +++ b/scripts/ex-gwf-bump.py @@ -171,14 +171,7 @@ def build_models( botm=bot, ) if rewet: - rewet_record = [ - "wetfct", - wetfct, - "iwetit", - iwetit, - "ihdwet", - ihdwet, - ] + rewet_record = ["wetfct", wetfct, "iwetit", iwetit, "ihdwet", ihdwet] else: rewet_record = None flopy.mf6.ModflowGwfnpf( @@ -274,11 +267,7 @@ def plot_grid(gwf, silent=True): bot_coll = mm.plot_array(bot, vmin=bmin, vmax=bmax) mm.plot_bc("CHD", color="cyan") cv = mm.contour_array( - bot, - levels=blevels, - linewidths=0.5, - linestyles=":", - colors=bcolor, + bot, levels=blevels, linewidths=0.5, linestyles=":", colors=bcolor ) plt.clabel(cv, fmt="%1.0f") ax.set_xlabel("x-coordinate, in meters") @@ -308,12 +297,7 @@ def plot_grid(gwf, silent=True): styles.graph_legend(ax, loc="center", ncol=2) cax = plt.axes([0.275, 0.125, 0.45, 0.025]) - cbar = plt.colorbar( - bot_coll, - shrink=0.8, - orientation="horizontal", - cax=cax, - ) + cbar = plt.colorbar(bot_coll, shrink=0.8, orientation="horizontal", cax=cax) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Bottom Elevation, $m$") @@ -343,8 +327,7 @@ def plot_results(idx, sim, silent=True): imask = (head > -1e30) & (head <= bot) head[imask] = -1e30 # botm[imask] qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + cobj.get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) # Create figure for simulation @@ -412,14 +395,7 @@ def plot_results(idx, sim, silent=True): color=bcolor, label="Bottom elevation contour, m", ) - ax.plot( - -10000, - -10000, - lw=0.5, - ls="-", - color=vcolor, - label="Head contour, m", - ) + ax.plot(-10000, -10000, lw=0.5, ls="-", color=vcolor, label="Head contour, m") styles.graph_legend(ax, loc="center", ncol=2) cax = plt.axes([0.275, 0.125, 0.45, 0.025]) diff --git a/scripts/ex-gwf-capture.py b/scripts/ex-gwf-capture.py index 312a9bf3..7bba4cbf 100644 --- a/scripts/ex-gwf-capture.py +++ b/scripts/ex-gwf-capture.py @@ -208,9 +208,7 @@ def build_models(): ) flopy.mf6.ModflowGwfoc( gwf, - printrecord=[ - ("BUDGET", "ALL"), - ], + printrecord=[("BUDGET", "ALL")], ) return sim @@ -329,11 +327,7 @@ def plot_results(silent=True): # plot grid fig = plt.figure(figsize=(4, 3.75), constrained_layout=True) gs = mpl.gridspec.GridSpec( - 2, - 2, - figure=fig, - width_ratios=(4, 1), - height_ratios=(1, 6), + 2, 2, figure=fig, width_ratios=(4, 1), height_ratios=(1, 6) ) ax = fig.add_subplot(gs[:, 0]) @@ -372,22 +366,9 @@ def plot_results(silent=True): mew=0.5, label="Constant head", ) + ax.plot(-1000, -1000, color="cyan", lw=1.25, label="River") ax.plot( - -1000, - -1000, - color="cyan", - lw=1.25, - label="River", - ) - ax.plot( - -1000, - -1000, - "s", - ms=5, - color="red", - mec="black", - mew=0.5, - label="Well", + -1000, -1000, "s", ms=5, color="red", mec="black", mew=0.5, label="Well" ) ax.plot( -1000, @@ -399,12 +380,7 @@ def plot_results(silent=True): mew=0.5, label="Inactive cell", ) - styles.graph_legend( - ax, - ncol=1, - frameon=False, - loc="upper center", - ) + styles.graph_legend(ax, ncol=1, frameon=False, loc="upper center") if plot_show: plt.show() diff --git a/scripts/ex-gwf-csub-p01.py b/scripts/ex-gwf-csub-p01.py index a68fefb9..3777ad37 100644 --- a/scripts/ex-gwf-csub-p01.py +++ b/scripts/ex-gwf-csub-p01.py @@ -206,10 +206,7 @@ def build_models(): sfacrecord=["1.05"], ) - flopy.mf6.ModflowGwfoc( - gwf, - printrecord=[("BUDGET", "ALL")], - ) + flopy.mf6.ModflowGwfoc(gwf, printrecord=[("BUDGET", "ALL")]) return sim @@ -289,12 +286,7 @@ def plot_results(sim, silent=True): ls="dashed", ) ax.text( - delr.sum() / 2, - -10, - "static water-level", - va="bottom", - ha="center", - size=9, + delr.sum() / 2, -10, "static water-level", va="bottom", ha="center", size=9 ) ax.set_ylabel("Elevation, in meters") ax.set_xlabel("x-coordinate, in meters") @@ -355,11 +347,7 @@ def plot_results(sim, silent=True): ax = axe ax.plot( - sim_date, - sim_obs["W3_1_1"], - color="black", - lw=0.75, - label="Simulated", + sim_date, sim_obs["W3_1_1"], color="black", lw=0.75, label="Simulated" ) ax.plot( obs_date, diff --git a/scripts/ex-gwf-csub-p02.py b/scripts/ex-gwf-csub-p02.py index 57766b6f..22aaa59e 100644 --- a/scripts/ex-gwf-csub-p02.py +++ b/scripts/ex-gwf-csub-p02.py @@ -179,22 +179,7 @@ def build_models( tsgm = sgm tsgs = sgs sub6 = [ - [ - 0, - 0, - 0, - 1, - "delay", - pc0, - bed_thickness, - 1.0, - skv, - ske, - theta, - kv, - h0, - "ib1", - ] + [0, 0, 0, 1, "delay", pc0, bed_thickness, 1.0, skv, ske, theta, kv, h0, "ib1"] ] csub = flopy.mf6.ModflowGwfcsub( gwf, @@ -239,10 +224,7 @@ def build_models( flopy.mf6.ModflowGwfchd(gwf, stress_period_data={0: c6}) - flopy.mf6.ModflowGwfoc( - gwf, - printrecord=[("BUDGET", "ALL")], - ) + flopy.mf6.ModflowGwfoc(gwf, printrecord=[("BUDGET", "ALL")]) return sim @@ -659,13 +641,7 @@ def plot_head_comparison(sim, silent=True): scalarMap = mpl.cm.ScalarMappable(norm=cNorm, cmap=cmap) # percentages to evaluate - pct_vals = ( - 1, - 5, - 10, - 50, - 100, - ) + pct_vals = (1, 5, 10, 50, 100) axes = [] for idx in range(6): @@ -809,10 +785,7 @@ def scenarios(idx, silent=True): run_models(sim, silent=silent) else: for b, kv in zip(interbed_thickness, interbed_kv): - for head_based in ( - True, - False, - ): + for head_based in (True, False): if head_based: subdir_name = "hb-" else: diff --git a/scripts/ex-gwf-csub-p03.py b/scripts/ex-gwf-csub-p03.py index 5f1f7ec1..18672f5d 100644 --- a/scripts/ex-gwf-csub-p03.py +++ b/scripts/ex-gwf-csub-p03.py @@ -272,22 +272,7 @@ 9.14e-3, 9.14e-3, ) -iconvert = ( - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -) +iconvert = (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) sgm = 1.7 sgs = 2.0 cg_theta = 0.3 @@ -336,21 +321,7 @@ 3.0480, 2.7432, ) -ib_rnb = ( - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.92, - 1.66, - 2.85, -) +ib_rnb = (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.92, 1.66, 2.85) ib_theta = 0.30 ib_kv = ( 999.0, @@ -407,15 +378,7 @@ # Constant head cells c6 = [] -for k, tag in zip( - ( - 0, - 5, - 10, - 12, - ), - ("upper", "middle", "middle", "lower"), -): +for k, tag in zip((0, 5, 10, 12), ("upper", "middle", "middle", "lower")): c6.append([k, 0, 0, tag]) # Solver parameters @@ -479,13 +442,7 @@ def build_models( cpth = opth + ".csv" obs_array = [] for k in range(nlay): - obs_array.append( - [ - f"HD{k + 1:02d}", - "HEAD", - (k, 0, 0), - ] - ) + obs_array.append([f"HD{k + 1:02d}", "HEAD", (k, 0, 0)]) flopy.mf6.ModflowUtlobs( gwf, digits=10, @@ -558,21 +515,9 @@ def build_models( ] for k in (1, 2, 3, 4, 6, 7, 8, 9, 11, 13): tag = f"tc{k + 1:02d}" - obs.append( - ( - tag, - "compaction-cell", - (k, 0, 0), - ) - ) + obs.append((tag, "compaction-cell", (k, 0, 0))) tag = f"skc{k + 1:02d}" - obs.append( - ( - tag, - "coarse-compaction", - (k, 0, 0), - ) - ) + obs.append((tag, "coarse-compaction", (k, 0, 0))) orecarray = {csub_csv: obs} csub.obs.initialize( filename=opth, digits=10, print_input=True, continuous=orecarray @@ -585,27 +530,12 @@ def build_models( chd.ts.initialize( filename=csubnam, timeseries=chd_ts, - time_series_namerecord=[ - "upper", - "middle", - "lower", - ], - interpolation_methodrecord=[ - "linear", - "linear", - "linear", - ], - sfacrecord=[ - "1.0", - "1.0", - "1.0", - ], + time_series_namerecord=["upper", "middle", "lower"], + interpolation_methodrecord=["linear", "linear", "linear"], + sfacrecord=["1.0", "1.0", "1.0"], ) - flopy.mf6.ModflowGwfoc( - gwf, - printrecord=[("BUDGET", "ALL")], - ) + flopy.mf6.ModflowGwfoc(gwf, printrecord=[("BUDGET", "ALL")]) return sim @@ -954,13 +884,7 @@ def constant_heads(ax, annotate=False, fontsize=6, xrange=(0, 1)): if k == 0: y = 0.5 * (edges[k][0] + edges[k + 1][0]) ax.text( - x, - y, - text, - fontsize=fontsize, - ha="center", - va="center", - zorder=203, + x, y, text, fontsize=fontsize, ha="center", va="center", zorder=203 ) else: y = edges[k + 1][0] @@ -1002,12 +926,7 @@ def plot_grid(silent=True): ax = axes[0] ax.fill_between( - xrange, - edges[0], - y2=edges[1], - color="green", - lw=0, - label="Upper aquifer", + xrange, edges[0], y2=edges[1], color="green", lw=0, label="Upper aquifer" ) label = "" @@ -1034,12 +953,7 @@ def plot_grid(silent=True): # lower aquifer ax.fill_between( - xrange, - midz[-1], - y2=edges[-1], - color="blue", - lw=0, - label="Lower aquifer", + xrange, midz[-1], y2=edges[-1], color="blue", lw=0, label="Lower aquifer" ) styles.graph_legend(ax, loc="lower right", frameon=True, framealpha=1) @@ -1068,12 +982,7 @@ def plot_grid(silent=True): for k in chds: ax.fill_between( - xrange, - edges[k], - y2=edges[k + 1], - color="white", - lw=0.75, - zorder=100, + xrange, edges[k], y2=edges[k + 1], color="white", lw=0.75, zorder=100 ) leg = styles.graph_legend(ax, loc="lower right", frameon=True, framealpha=1) @@ -1188,12 +1097,7 @@ def plot_head_es_comparison(silent=True): mtext = f"mean error = {me[key]:7.4f} {length_units}" ax.plot(hb["totim"], hb[key], color="#238A8DFF", lw=1.25, label=otext) ax.plot( - es["totim"], - es[key], - color="black", - lw=0.75, - label=stext, - zorder=101, + es["totim"], es[key], color="black", lw=0.75, label=stext, zorder=101 ) ltext = chr(ord("A") + idx) htext = f"{label}" @@ -1204,13 +1108,7 @@ def plot_head_es_comparison(silent=True): va = "top" ym = 0.85 ax.text( - 0.99, - ym, - mtext, - ha="right", - va=va, - transform=ax.transAxes, - fontsize=7, + 0.99, ym, mtext, ha="right", va=va, transform=ax.transAxes, fontsize=7 ) styles.remove_edge_ticks(ax=ax) if idx == 0: @@ -1348,12 +1246,8 @@ def plot_calibration(silent=True): ax.set_xlim(xf0, xf1) ax.plot([xf0, xf1], [0, 0], lw=0.5, color="0.5") ax.plot( - [ - xf0, - ], - [ - -10, - ], + [xf0], + [-10], marker=".", ms=1, lw=0, @@ -1391,12 +1285,7 @@ def plot_calibration(silent=True): ax.set_xlim(xf0s, xf1s) ax.set_ylim(1.45, 1.15) ax.plot( - df.index.values, - df["observed"].values, - marker=".", - ms=1, - lw=0, - color="red", + df.index.values, df["observed"].values, marker=".", ms=1, lw=0, color="red" ) ax.plot( df_sim.index.values, @@ -1583,13 +1472,7 @@ def build_head_data(df, year=1908): ) ypos = -0.5 * (zelevs[2] + zelevs[3]) ax.text( - 40, - ypos, - "Confining unit", - ha="left", - va="center", - size=8, - color="white", + 40, ypos, "Confining unit", ha="left", va="center", size=8, color="white" ) label = "" @@ -1600,13 +1483,7 @@ def build_head_data(df, year=1908): ) ypos = -0.5 * (zelevs[8] + zelevs[9]) ax.text( - 40, - ypos, - "Thick aquitard", - ha="left", - va="center", - size=8, - color="white", + 40, ypos, "Thick aquitard", ha="left", va="center", size=8, color="white" ) zo = 105 @@ -1618,13 +1495,7 @@ def build_head_data(df, year=1908): ) ax.plot(x, y, lw=0.5, color="black", zorder=201) ax.text( - xlabel, - 24, - f"{iyear}", - ha="center", - va="bottom", - rotation=90, - size=7, + xlabel, 24, f"{iyear}", ha="center", va="bottom", rotation=90, size=7 ) if iyear == 1996: ax.plot(x1, y1, lw=0.5, color="black", zorder=zo) diff --git a/scripts/ex-gwf-csub-p04.py b/scripts/ex-gwf-csub-p04.py index 75e2d76a..8ad5bad8 100644 --- a/scripts/ex-gwf-csub-p04.py +++ b/scripts/ex-gwf-csub-p04.py @@ -392,11 +392,7 @@ def calc_compaction_at_surface(sim): """Calculate the compaction at the surface""" csub_obs = get_csub_observations(sim) for tag in plot_tags: - for k in ( - 3, - 2, - 1, - ): + for k in (3, 2, 1): tag0 = f"{tag}{k}" tag1 = f"{tag}{k + 1}" csub_obs[tag0] += csub_obs[tag1] @@ -508,14 +504,7 @@ def plot_grid(sim, silent=True): label="Recharge", ) mm.ax.plot( - -1000, - -1000, - "s", - ms=5, - color="red", - mec="black", - mew=0.5, - label="Well", + -1000, -1000, "s", ms=5, color="red", mec="black", mew=0.5, label="Well" ) mm.ax.plot( -1000, @@ -683,11 +672,7 @@ def plot_stresses(sim, silent=True): tmax = cd["totim"][-1] fig, axes = plt.subplots( - ncols=1, - nrows=4, - figsize=figure_size, - sharex=True, - constrained_layout=True, + ncols=1, nrows=4, figsize=figure_size, sharex=True, constrained_layout=True ) idx = 0 @@ -695,11 +680,7 @@ def plot_stresses(sim, silent=True): ax.set_xlim(0, tmax) ax.set_ylim(110, 150) ax.plot( - cd["totim"], - cd["PC1"], - color="blue", - lw=1, - label="Preconsolidation stress", + cd["totim"], cd["PC1"], color="blue", lw=1, label="Preconsolidation stress" ) ax.plot(cd["totim"], cd["ES1"], color="red", lw=1, label="Effective stress") styles.heading(ax, letter="A", heading="Model layer 1, row 9, column 10") @@ -732,11 +713,7 @@ def plot_stresses(sim, silent=True): ) ax.plot([-100, -50], [-100, -100], color="red", lw=1, label="Effective stress") ax.plot(cd["totim"], cd["GS2"], color="black", lw=1, label="Geostatic stress") - styles.graph_legend( - ax, - ncol=3, - bbox_to_anchor=(0.9, -0.6), - ) + styles.graph_legend(ax, ncol=3, bbox_to_anchor=(0.9, -0.6)) styles.heading(ax, letter="D", heading="Model layer 2, row 9, column 10") styles.remove_edge_ticks(ax) ax.set_xlabel("Simulation time, in years") @@ -759,11 +736,7 @@ def plot_compaction(sim, silent=True): name = sim.name fig, axes = plt.subplots( - ncols=2, - nrows=3, - figsize=figure_size, - sharex=True, - constrained_layout=True, + ncols=2, nrows=3, figsize=figure_size, sharex=True, constrained_layout=True ) axes = axes.flatten() diff --git a/scripts/ex-gwf-curvilinear-90.py b/scripts/ex-gwf-curvilinear-90.py index 4d47fb5c..79c13dcf 100644 --- a/scripts/ex-gwf-curvilinear-90.py +++ b/scripts/ex-gwf-curvilinear-90.py @@ -2411,19 +2411,13 @@ def plot_head(sim): # create MODFLOW 6 cell-by-cell budget object qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) ax = fig.add_subplot(1, 1, 1, aspect="equal") pmv = flopy.plot.PlotMapView(model=gwf, ax=ax, layer=0) cb = pmv.plot_array(head, cmap="jet", vmin=0.0, vmax=head.max()) - pmv.plot_vector( - qx, - qy, - normalize=False, - color="0.75", - ) + pmv.plot_vector(qx, qy, normalize=False, color="0.75") cbar = plt.colorbar(cb, shrink=0.25) cbar.ax.set_xlabel(r"Head, ($ft$)") ax.set_xlabel("x position (ft)") diff --git a/scripts/ex-gwf-curvilinear.py b/scripts/ex-gwf-curvilinear.py index bda94d38..f09a856d 100644 --- a/scripts/ex-gwf-curvilinear.py +++ b/scripts/ex-gwf-curvilinear.py @@ -2478,11 +2478,7 @@ def plot_grid(sim, verbose=False): fig.tight_layout() # Save components that made up the main grid - fig2, ax2 = plt.subplots( - 1, - 3, - figsize=figure_size_grid_com, - ) + fig2, ax2 = plt.subplots(1, 3, figsize=figure_size_grid_com) curvlin1.plot_grid( "Left Curvilinear Grid", @@ -2581,19 +2577,13 @@ def plot_head(sim): # create MODFLOW 6 cell-by-cell budget object qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) ax = fig.add_subplot(1, 1, 1, aspect="equal") pmv = flopy.plot.PlotMapView(model=gwf, ax=ax, layer=0) cb = pmv.plot_array(head, cmap="jet", vmin=0.0, vmax=head.max()) - pmv.plot_vector( - qx, - qy, - normalize=False, - color="0.75", - ) + pmv.plot_vector(qx, qy, normalize=False, color="0.75") cbar = plt.colorbar(cb, shrink=0.25) cbar.ax.set_xlabel(r"Head, ($ft$)") ax.set_xlabel("x position (ft)") diff --git a/scripts/ex-gwf-disvmesh.py b/scripts/ex-gwf-disvmesh.py index 4c12d7c9..d350b6a6 100644 --- a/scripts/ex-gwf-disvmesh.py +++ b/scripts/ex-gwf-disvmesh.py @@ -273,19 +273,13 @@ def plot_head(idx, sim): # create MODFLOW 6 cell-by-cell budget object qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) ax = fig.add_subplot(1, 2, 1, aspect="equal") pmv = flopy.plot.PlotMapView(model=gwf, ax=ax, layer=0) cb = pmv.plot_array(head, cmap="jet", vmin=0.0, vmax=head.max()) - pmv.plot_vector( - qx, - qy, - normalize=False, - color="0.75", - ) + pmv.plot_vector(qx, qy, normalize=False, color="0.75") cbar = plt.colorbar(cb, shrink=0.25) cbar.ax.set_xlabel(r"Head, ($m$)") ax.set_xlabel("x position (m)") @@ -295,12 +289,7 @@ def plot_head(idx, sim): ax = fig.add_subplot(1, 2, 2, aspect="equal") pmv = flopy.plot.PlotMapView(model=gwf, ax=ax, layer=1) cb = pmv.plot_array(head, cmap="jet", vmin=0.0, vmax=head.max()) - pmv.plot_vector( - qx, - qy, - normalize=False, - color="0.75", - ) + pmv.plot_vector(qx, qy, normalize=False, color="0.75") cbar = plt.colorbar(cb, shrink=0.25) cbar.ax.set_xlabel(r"Head, ($m$)") ax.set_xlabel("x position (m)") diff --git a/scripts/ex-gwf-drn-p01.py b/scripts/ex-gwf-drn-p01.py index 24a38d17..4c8d66f1 100644 --- a/scripts/ex-gwf-drn-p01.py +++ b/scripts/ex-gwf-drn-p01.py @@ -230,15 +230,7 @@ for j in range(ncol): if idomain[i, j] == 0: continue - drncell = [ - 0, - i, - j, - top[i, j] - 0.5 * surf_dep, - 25.0, - 1.0, - "surfrate", - ] + drncell = [0, i, j, top[i, j] - 0.5 * surf_dep, 25.0, 1.0, "surfrate"] drn_spd.append(drncell) # UZF package @@ -290,582 +282,42 @@ # SFR Package sfr_pakdata = [ - [ - 0, - 0, - 0, - 0, - 4500.0, - 12, - 8.6767896e-04, - 1093.048, - 3.0, - 0.00003, - 0.030, - 1, - 1.0, - 0, - ], - [ - 1, - 0, - 1, - 1, - 7000.0, - 12, - 8.6767896e-04, - 1088.059, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 2, - 0, - 2, - 2, - 6000.0, - 12, - 8.6767896e-04, - 1082.419, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 3, - 0, - 2, - 3, - 5550.0, - 12, - 8.6767896e-04, - 1077.408, - 3.0, - 0.00003, - 0.030, - 3, - 1.0, - 1, - ], - [ - 4, - 0, - 3, - 4, - 6500.0, - 12, - 9.4339624e-04, - 1071.934, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 5, - 0, - 4, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1066.509, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 6, - 0, - 5, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1061.792, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 7, - 0, - 6, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1057.075, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 8, - 0, - 7, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1052.359, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 9, - 0, - 2, - 4, - 5000.0, - 10, - 5.4545456e-04, - 1073.636, - 2.0, - 0.00003, - 0.030, - 2, - 0.0, - 0, - ], - [ - 10, - 0, - 2, - 5, - 5000.0, - 10, - 5.4545456e-04, - 1070.909, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 11, - 0, - 2, - 6, - 4500.0, - 10, - 5.4545456e-04, - 1068.318, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 12, - 0, - 3, - 7, - 6000.0, - 10, - 5.4545456e-04, - 1065.455, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 13, - 0, - 4, - 7, - 5000.0, - 10, - 5.4545456e-04, - 1062.455, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 14, - 0, - 5, - 7, - 2000.0, - 10, - 5.4545456e-04, - 1060.545, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 15, - 0, - 4, - 9, - 2500.0, - 10, - 1.8181818e-03, - 1077.727, - 3.0, - 0.00003, - 0.030, - 1, - 1.0, - 0, - ], - [ - 16, - 0, - 4, - 8, - 5000.0, - 10, - 1.8181818e-03, - 1070.909, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 17, - 0, - 5, - 7, - 3500.0, - 10, - 1.8181818e-03, - 1063.182, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 18, - 0, - 5, - 7, - 4000.0, - 15, - 1.0000000e-03, - 1058.000, - 3.0, - 0.00003, - 0.030, - 3, - 1.0, - 0, - ], - [ - 19, - 0, - 6, - 6, - 5000.0, - 15, - 1.0000000e-03, - 1053.500, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 20, - 0, - 7, - 6, - 3500.0, - 15, - 1.0000000e-03, - 1049.250, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 21, - 0, - 7, - 5, - 2500.0, - 15, - 1.0000000e-03, - 1046.250, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 22, - 0, - 8, - 5, - 5000.0, - 12, - 9.0909092e-04, - 1042.727, - 3.0, - 0.00003, - 0.030, - 3, - 1.0, - 0, - ], - [ - 23, - 0, - 9, - 6, - 5000.0, - 12, - 9.0909092e-04, - 1038.182, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 24, - 0, - 10, - 6, - 5000.0, - 12, - 9.0909092e-04, - 1033.636, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 25, - 0, - 11, - 6, - 5000.0, - 12, - 9.0909092e-04, - 1029.091, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 26, - 0, - 12, - 6, - 2000.0, - 12, - 9.0909092e-04, - 1025.909, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 27, - 0, - 13, - 8, - 5000.0, - 55, - 9.6774194e-04, - 1037.581, - 3.0, - 0.00006, - 0.025, - 1, - 1.0, - 0, - ], - [ - 28, - 0, - 12, - 7, - 5500.0, - 55, - 9.6774194e-04, - 1032.500, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 29, - 0, - 12, - 6, - 5000.0, - 55, - 9.6774194e-04, - 1027.419, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 30, - 0, - 12, - 5, - 5000.0, - 40, - 1.2500000e-03, - 1021.875, - 3.0, - 0.00006, - 0.025, - 3, - 1.0, - 0, - ], - [ - 31, - 0, - 12, - 4, - 5000.0, - 40, - 1.2500000e-03, - 1015.625, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 32, - 0, - 12, - 3, - 5000.0, - 40, - 1.2500000e-03, - 1009.375, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 33, - 0, - 12, - 2, - 5000.0, - 40, - 1.2500000e-03, - 1003.125, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 34, - 0, - 12, - 1, - 5000.0, - 40, - 1.2500000e-03, - 996.8750, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 35, - 0, - 12, - 0, - 3000.0, - 40, - 1.2500000e-03, - 991.8750, - 3.0, - 0.00006, - 0.025, - 1, - 1.0, - 0, - ], + [0, 0, 0, 0, 4500.0, 12, 8.6767896e-04, 1093.048, 3.0, 0.00003, 0.030, 1, 1.0, 0], + [1, 0, 1, 1, 7000.0, 12, 8.6767896e-04, 1088.059, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [2, 0, 2, 2, 6000.0, 12, 8.6767896e-04, 1082.419, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [3, 0, 2, 3, 5550.0, 12, 8.6767896e-04, 1077.408, 3.0, 0.00003, 0.030, 3, 1.0, 1], + [4, 0, 3, 4, 6500.0, 12, 9.4339624e-04, 1071.934, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [5, 0, 4, 5, 5000.0, 12, 9.4339624e-04, 1066.509, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [6, 0, 5, 5, 5000.0, 12, 9.4339624e-04, 1061.792, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [7, 0, 6, 5, 5000.0, 12, 9.4339624e-04, 1057.075, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [8, 0, 7, 5, 5000.0, 12, 9.4339624e-04, 1052.359, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [9, 0, 2, 4, 5000.0, 10, 5.4545456e-04, 1073.636, 2.0, 0.00003, 0.030, 2, 0.0, 0], + [10, 0, 2, 5, 5000.0, 10, 5.4545456e-04, 1070.909, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [11, 0, 2, 6, 4500.0, 10, 5.4545456e-04, 1068.318, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [12, 0, 3, 7, 6000.0, 10, 5.4545456e-04, 1065.455, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [13, 0, 4, 7, 5000.0, 10, 5.4545456e-04, 1062.455, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [14, 0, 5, 7, 2000.0, 10, 5.4545456e-04, 1060.545, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [15, 0, 4, 9, 2500.0, 10, 1.8181818e-03, 1077.727, 3.0, 0.00003, 0.030, 1, 1.0, 0], + [16, 0, 4, 8, 5000.0, 10, 1.8181818e-03, 1070.909, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [17, 0, 5, 7, 3500.0, 10, 1.8181818e-03, 1063.182, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [18, 0, 5, 7, 4000.0, 15, 1.0000000e-03, 1058.000, 3.0, 0.00003, 0.030, 3, 1.0, 0], + [19, 0, 6, 6, 5000.0, 15, 1.0000000e-03, 1053.500, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [20, 0, 7, 6, 3500.0, 15, 1.0000000e-03, 1049.250, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [21, 0, 7, 5, 2500.0, 15, 1.0000000e-03, 1046.250, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [22, 0, 8, 5, 5000.0, 12, 9.0909092e-04, 1042.727, 3.0, 0.00003, 0.030, 3, 1.0, 0], + [23, 0, 9, 6, 5000.0, 12, 9.0909092e-04, 1038.182, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [24, 0, 10, 6, 5000.0, 12, 9.0909092e-04, 1033.636, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [25, 0, 11, 6, 5000.0, 12, 9.0909092e-04, 1029.091, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [26, 0, 12, 6, 2000.0, 12, 9.0909092e-04, 1025.909, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [27, 0, 13, 8, 5000.0, 55, 9.6774194e-04, 1037.581, 3.0, 0.00006, 0.025, 1, 1.0, 0], + [28, 0, 12, 7, 5500.0, 55, 9.6774194e-04, 1032.500, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [29, 0, 12, 6, 5000.0, 55, 9.6774194e-04, 1027.419, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [30, 0, 12, 5, 5000.0, 40, 1.2500000e-03, 1021.875, 3.0, 0.00006, 0.025, 3, 1.0, 0], + [31, 0, 12, 4, 5000.0, 40, 1.2500000e-03, 1015.625, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [32, 0, 12, 3, 5000.0, 40, 1.2500000e-03, 1009.375, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [33, 0, 12, 2, 5000.0, 40, 1.2500000e-03, 1003.125, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [34, 0, 12, 1, 5000.0, 40, 1.2500000e-03, 996.8750, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [35, 0, 12, 0, 3000.0, 40, 1.2500000e-03, 991.8750, 3.0, 0.00006, 0.025, 1, 1.0, 0], ] sfr_conn = [ @@ -940,16 +392,7 @@ for j in range(ncol): if idomain[i, j] == 0: continue - uzf_mvr_spd.append( - [ - "UZF-1", - iuzf, - "SFR-1", - routing_map[i, j], - "FACTOR", - 1.0, - ] - ) + uzf_mvr_spd.append(["UZF-1", iuzf, "SFR-1", routing_map[i, j], "FACTOR", 1.0]) iuzf += 1 drn_mvr_spd = [] @@ -958,16 +401,7 @@ for j in range(ncol): if idomain[i, j] == 0: continue - drn_mvr_spd.append( - [ - "DRN-1", - idrn, - "SFR-1", - routing_map[i, j], - "FACTOR", - 1.0, - ] - ) + drn_mvr_spd.append(["DRN-1", idrn, "SFR-1", routing_map[i, j], "FACTOR", 1.0]) idrn += 1 @@ -1102,10 +536,7 @@ def build_models(name, uzf_gwseep=None): perioddata=mvr_spd, ) - flopy.mf6.ModflowGwfoc( - gwf, - printrecord=[("BUDGET", "LAST")], - ) + flopy.mf6.ModflowGwfoc(gwf, printrecord=[("BUDGET", "LAST")]) return sim diff --git a/scripts/ex-gwf-lak-p01.py b/scripts/ex-gwf-lak-p01.py index af8e5c3d..7e2d3314 100644 --- a/scripts/ex-gwf-lak-p01.py +++ b/scripts/ex-gwf-lak-p01.py @@ -223,14 +223,8 @@ def build_models(): flopy.mf6.ModflowGwfchd(gwf, stress_period_data=chd_spd) flopy.mf6.ModflowGwfrcha(gwf, recharge=recharge) flopy.mf6.ModflowGwfevta(gwf, surface=surf, rate=etvrate, depth=etvdepth) - ( - idomain_wlakes, - pakdata_dict, - lak_conn, - ) = flopy.mf6.utils.get_lak_connections( - gwf.modelgrid, - lake_map, - bedleak=lak_bedleak, + (idomain_wlakes, pakdata_dict, lak_conn) = flopy.mf6.utils.get_lak_connections( + gwf.modelgrid, lake_map, bedleak=lak_bedleak ) lak_packagedata = [[0, lak_strt, pakdata_dict[0]]] lak = flopy.mf6.ModflowGwflak( @@ -301,8 +295,7 @@ def plot_grid(gwf, silent=True): head = hobj.get_data(kstpkper=kstpkper[0]) qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], gwf ) # add lake stage to heads @@ -314,10 +307,7 @@ def plot_grid(gwf, silent=True): p2 = (xcenters[13], ycenters[13]) with styles.USGSMap(): - fig = plt.figure( - figsize=(4, 6.9), - tight_layout=True, - ) + fig = plt.figure(figsize=(4, 6.9), tight_layout=True) plt.axis("off") nrows, ncols = 10, 1 @@ -451,12 +441,7 @@ def plot_grid(gwf, silent=True): label="Observation well", ) ax.plot( - -10000, - -10000, - lw=0.75, - ls="-", - color="blue", - label=r"Head contour, $ft$", + -10000, -10000, lw=0.75, ls="-", color="blue", label=r"Head contour, $ft$" ) ax.plot( -10000, @@ -501,11 +486,7 @@ def plot_lak_results(gwf, silent=True): # create the figure fig, ax = plt.subplots( - ncols=1, - nrows=1, - sharex=True, - figsize=(6.3, 3.15), - constrained_layout=True, + ncols=1, nrows=1, sharex=True, figsize=(6.3, 3.15), constrained_layout=True ) ax.set_xlim(0, 3000) @@ -519,12 +500,7 @@ def plot_lak_results(gwf, silent=True): label="Lake stage", ) ax.plot( - results["time"], - results["A"], - lw=0.75, - ls="-", - color="0.5", - label="Point A", + results["time"], results["A"], lw=0.75, ls="-", color="0.5", label="Point A" ) ax.plot( results["time"], diff --git a/scripts/ex-gwf-lak-p02.py b/scripts/ex-gwf-lak-p02.py index 235f6e07..7f7cc9ff 100644 --- a/scripts/ex-gwf-lak-p02.py +++ b/scripts/ex-gwf-lak-p02.py @@ -192,358 +192,28 @@ # SFR package sfr_pakdata = [ - [ - 0, - 0, - 1, - 4, - 1000, - 5, - 0.001103448, - 123.94827, - 0.5, - 0.5, - 0.050000001, - 1, - 1, - 0, - ], - [ - 1, - 0, - 2, - 4, - 1000, - 5, - 0.001103448, - 122.84483, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 2, - 0, - 3, - 4, - 1000, - 5, - 0.001103448, - 121.74138, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 3, - 0, - 3, - 5, - 1000, - 5, - 0.001103448, - 120.63793, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 4, - 0, - 3, - 6, - 500, - 5, - 0.001103448, - 119.81035, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 5, - 0, - 3, - 7, - 750, - 5, - 0.001103448, - 119.12069, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 6, - 0, - 4, - 7, - 1000, - 5, - 0.001103448, - 118.15517, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 7, - 0, - 5, - 7, - 1000, - 5, - 0.001103448, - 117.05173, - 0.5, - 0.5, - 0.050000001, - 1, - 1, - 0, - ], - [ - 8, - 0, - 11, - 8, - 1000, - 5, - 0.000820632, - 114.43968, - 0.5, - 0.5, - 0.050000001, - 1, - 1, - 0, - ], - [ - 9, - 0, - 12, - 8, - 1000, - 5, - 0.000820632, - 113.61905, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 10, - 0, - 13, - 9, - 559, - 5, - 0.000820632, - 112.97937, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 11, - 0, - 13, - 9, - 559, - 5, - 0.000820632, - 112.52063, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 12, - 0, - 14, - 9, - 1000, - 5, - 0.000820632, - 111.88095, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 13, - 0, - 15, - 9, - 1000, - 5, - 0.000820632, - 111.06032, - 0.5, - 0.5, - 0.050000001, - 1, - 1, - 0, - ], - [ - 14, - 0, - 21, - 9, - 1000, - 5, - 0.00094582, - 108.95569, - 0.5, - 0.5, - 0.050000001, - 1, - 1, - 0, - ], - [ - 15, - 0, - 22, - 9, - 750, - 5, - 0.00094582, - 108.1281, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 16, - 0, - 22, - 10, - 500, - 5, - 0.00094582, - 107.53696, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 17, - 0, - 22, - 11, - 1000, - 5, - 0.00094582, - 106.82759, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 18, - 0, - 22, - 12, - 1000, - 5, - 0.00094582, - 105.88177, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 19, - 0, - 22, - 13, - 1000, - 5, - 0.00094582, - 104.93595, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 20, - 0, - 22, - 14, - 1000, - 5, - 0.00094582, - 103.99014, - 0.5, - 0.5, - 0.050000001, - 2, - 1, - 0, - ], - [ - 21, - 0, - 22, - 15, - 1000, - 5, - 0.00094582, - 103.04431, - 0.5, - 0.5, - 0.050000001, - 1, - 1, - 0, - ], + [0, 0, 1, 4, 1000, 5, 0.001103448, 123.94827, 0.5, 0.5, 0.050000001, 1, 1, 0], + [1, 0, 2, 4, 1000, 5, 0.001103448, 122.84483, 0.5, 0.5, 0.050000001, 2, 1, 0], + [2, 0, 3, 4, 1000, 5, 0.001103448, 121.74138, 0.5, 0.5, 0.050000001, 2, 1, 0], + [3, 0, 3, 5, 1000, 5, 0.001103448, 120.63793, 0.5, 0.5, 0.050000001, 2, 1, 0], + [4, 0, 3, 6, 500, 5, 0.001103448, 119.81035, 0.5, 0.5, 0.050000001, 2, 1, 0], + [5, 0, 3, 7, 750, 5, 0.001103448, 119.12069, 0.5, 0.5, 0.050000001, 2, 1, 0], + [6, 0, 4, 7, 1000, 5, 0.001103448, 118.15517, 0.5, 0.5, 0.050000001, 2, 1, 0], + [7, 0, 5, 7, 1000, 5, 0.001103448, 117.05173, 0.5, 0.5, 0.050000001, 1, 1, 0], + [8, 0, 11, 8, 1000, 5, 0.000820632, 114.43968, 0.5, 0.5, 0.050000001, 1, 1, 0], + [9, 0, 12, 8, 1000, 5, 0.000820632, 113.61905, 0.5, 0.5, 0.050000001, 2, 1, 0], + [10, 0, 13, 9, 559, 5, 0.000820632, 112.97937, 0.5, 0.5, 0.050000001, 2, 1, 0], + [11, 0, 13, 9, 559, 5, 0.000820632, 112.52063, 0.5, 0.5, 0.050000001, 2, 1, 0], + [12, 0, 14, 9, 1000, 5, 0.000820632, 111.88095, 0.5, 0.5, 0.050000001, 2, 1, 0], + [13, 0, 15, 9, 1000, 5, 0.000820632, 111.06032, 0.5, 0.5, 0.050000001, 1, 1, 0], + [14, 0, 21, 9, 1000, 5, 0.00094582, 108.95569, 0.5, 0.5, 0.050000001, 1, 1, 0], + [15, 0, 22, 9, 750, 5, 0.00094582, 108.1281, 0.5, 0.5, 0.050000001, 2, 1, 0], + [16, 0, 22, 10, 500, 5, 0.00094582, 107.53696, 0.5, 0.5, 0.050000001, 2, 1, 0], + [17, 0, 22, 11, 1000, 5, 0.00094582, 106.82759, 0.5, 0.5, 0.050000001, 2, 1, 0], + [18, 0, 22, 12, 1000, 5, 0.00094582, 105.88177, 0.5, 0.5, 0.050000001, 2, 1, 0], + [19, 0, 22, 13, 1000, 5, 0.00094582, 104.93595, 0.5, 0.5, 0.050000001, 2, 1, 0], + [20, 0, 22, 14, 1000, 5, 0.00094582, 103.99014, 0.5, 0.5, 0.050000001, 2, 1, 0], + [21, 0, 22, 15, 1000, 5, 0.00094582, 103.04431, 0.5, 0.5, 0.050000001, 1, 1, 0], ] sfr_conn = [ @@ -656,14 +326,8 @@ def build_models(): flopy.mf6.ModflowGwfchd(gwf, stress_period_data=chd_spd) flopy.mf6.ModflowGwfrcha(gwf, recharge=recharge) flopy.mf6.ModflowGwfevta(gwf, surface=surf, rate=etvrate, depth=etvdepth) - ( - idomain_wlakes, - pakdata_dict, - lak_conn, - ) = flopy.mf6.utils.get_lak_connections( - gwf.modelgrid, - lake_map, - bedleak=lak_bedleak, + (idomain_wlakes, pakdata_dict, lak_conn) = flopy.mf6.utils.get_lak_connections( + gwf.modelgrid, lake_map, bedleak=lak_bedleak ) lak_packagedata = [] for key in pakdata_dict.keys(): @@ -809,8 +473,7 @@ def plot_grid(gwf, silent=True): head = hobj.get_data(kstpkper=kstpkper[0]) qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], gwf ) # add lake stage to heads @@ -827,10 +490,7 @@ def plot_grid(gwf, silent=True): pl2 = (xcenters[8], ycenters[18]) with styles.USGSMap(): - fig = plt.figure( - figsize=(4, 6.9), - tight_layout=True, - ) + fig = plt.figure(figsize=(4, 6.9), tight_layout=True) plt.axis("off") nrows, ncols = 10, 1 @@ -964,13 +624,7 @@ def plot_grid(gwf, silent=True): markeredgewidth=0.5, label="Constant-head boundary", ) - ax.plot( - -10000, - -10000, - lw=1.5, - color="#3BB3D0", - label="Stream network", - ) + ax.plot(-10000, -10000, lw=1.5, color="#3BB3D0", label="Stream network") ax.plot( -10000, -10000, @@ -983,12 +637,7 @@ def plot_grid(gwf, silent=True): label="Observation well", ) ax.plot( - -10000, - -10000, - lw=0.75, - ls="-", - color="blue", - label=r"Head contour, $ft$", + -10000, -10000, lw=0.75, ls="-", color="blue", label=r"Head contour, $ft$" ) ax.plot( -10000, @@ -1039,11 +688,7 @@ def plot_lak_results(gwf, silent=True): # create the figure fig, axes = plt.subplots( - ncols=1, - nrows=2, - sharex=True, - figsize=(6.3, 4.3), - constrained_layout=True, + ncols=1, nrows=2, sharex=True, figsize=(6.3, 4.3), constrained_layout=True ) ax = axes[0] @@ -1075,12 +720,7 @@ def plot_lak_results(gwf, silent=True): ax.set_xlim(0, 1500) ax.set_ylim(110, 160) ax.plot( - results["time"], - results["A"], - lw=0.75, - ls="-", - color="0.5", - label="Point A", + results["time"], results["A"], lw=0.75, ls="-", color="0.5", label="Point A" ) ax.plot( results["time"], diff --git a/scripts/ex-gwf-lgr.py b/scripts/ex-gwf-lgr.py index 6b63822f..a744b9f4 100644 --- a/scripts/ex-gwf-lgr.py +++ b/scripts/ex-gwf-lgr.py @@ -1032,16 +1032,10 @@ def plot_results(mf6, idx): ax1.set_xlabel("Distance Along River ($m$)") ax1.set_ylabel(r"Stream Flow ($\frac{m^3}{s}$)") ax1.vlines( - x=(rch_lengths[7] + rch_lengths[8]) / 2, - ymin=-60, - ymax=235, - linewidth=2, + x=(rch_lengths[7] + rch_lengths[8]) / 2, ymin=-60, ymax=235, linewidth=2 ) ax1.vlines( - x=(rch_lengths[96] + rch_lengths[97]) / 2, - ymin=-65, - ymax=235, - linewidth=2, + x=(rch_lengths[96] + rch_lengths[97]) / 2, ymin=-65, ymax=235, linewidth=2 ) ax2 = ax1.twinx() diff --git a/scripts/ex-gwf-lgrv.py b/scripts/ex-gwf-lgrv.py index 1bad0f61..56419f21 100644 --- a/scripts/ex-gwf-lgrv.py +++ b/scripts/ex-gwf-lgrv.py @@ -247,12 +247,7 @@ def riv_resample(icoarsen, nrow, ncol, rivdat, idomain, rowcolspan): k = 0 if idomain[k, i, j] == 1: rivdatc.append( - [ - (k, i, j), - stagec_grid[i, j], - condc_grid[i, j], - rbotc_grid[i, j], - ] + [(k, i, j), stagec_grid[i, j], condc_grid[i, j], rbotc_grid[i, j]] ) return rivdatc @@ -522,20 +517,13 @@ def plot_grid(sim): if gwfc is not None: pmv = flopy.plot.PlotMapView(model=gwfc, ax=ax, layer=0) _ = pmv.plot_array( - tpc, - cmap="jet", - alpha=0.25, - masked_values=[1e30], - vmin=vmin, - vmax=vmax, + tpc, cmap="jet", alpha=0.25, masked_values=[1e30], vmin=vmin, vmax=vmax ) pmv.plot_bc(name="RIV") if gwfc is not None: xmin, xmax, ymin, ymax = child_domain ax.plot( - [xmin, xmax, xmax, xmin, xmin], - [ymin, ymin, ymax, ymax, ymin], - "k--", + [xmin, xmax, xmax, xmin, xmin], [ymin, ymin, ymax, ymax, ymin], "k--" ) xmin, xmax, ymin, ymax = model_domain ax.set_xlim(xmin, xmax) diff --git a/scripts/ex-gwf-maw-p01.py b/scripts/ex-gwf-maw-p01.py index 93a082a0..42596950 100644 --- a/scripts/ex-gwf-maw-p01.py +++ b/scripts/ex-gwf-maw-p01.py @@ -181,10 +181,7 @@ def build_models(name, rate=0.0): filename=obs_file, digits=10, print_input=True, continuous=obs_dict ) - flopy.mf6.ModflowGwfoc( - gwf, - printrecord=[("BUDGET", "LAST")], - ) + flopy.mf6.ModflowGwfoc(gwf, printrecord=[("BUDGET", "LAST")]) return sim @@ -227,31 +224,17 @@ def plot_maw_results(silent=True): # create the figure fig, axes = plt.subplots( - ncols=1, - nrows=2, - sharex=True, - figsize=figure_size, - constrained_layout=True, + ncols=1, nrows=2, sharex=True, figsize=figure_size, constrained_layout=True ) ax = axes[0] ax.set_xlim(tmin, tmax) ax.set_ylim(-1000, 1000) ax.semilogx( - time, - maw0["Q1"], - lw=0.75, - ls="-", - color="blue", - label="Upper aquifer", + time, maw0["Q1"], lw=0.75, ls="-", color="blue", label="Upper aquifer" ) ax.semilogx( - time, - maw0["Q2"], - lw=0.75, - ls="-", - color="red", - label="Lower aquifer", + time, maw0["Q2"], lw=0.75, ls="-", color="red", label="Lower aquifer" ) ax.axhline(0, lw=0.5, color="0.5") ax.set_ylabel(" ") @@ -262,20 +245,10 @@ def plot_maw_results(silent=True): ax.set_xlim(tmin, tmax) ax.set_ylim(-500, 2500) ax.semilogx( - time, - maw1["Q1"], - lw=0.75, - ls="-", - color="blue", - label="Upper aquifer", + time, maw1["Q1"], lw=0.75, ls="-", color="blue", label="Upper aquifer" ) ax.semilogx( - time, - maw1["Q2"], - lw=0.75, - ls="-", - color="red", - label="Lower aquifer", + time, maw1["Q2"], lw=0.75, ls="-", color="red", label="Lower aquifer" ) ax.axhline(0, lw=0.5, color="0.5") ax.set_xlabel(" ") @@ -321,10 +294,7 @@ def plot_grid(silent=True): ) gwf = sim.get_model(sim_name) with styles.USGSMap() as fs: - fig = plt.figure( - figsize=(4, 4.3), - tight_layout=True, - ) + fig = plt.figure(figsize=(4, 4.3), tight_layout=True) plt.axis("off") nrows, ncols = 10, 1 diff --git a/scripts/ex-gwf-maw-p02.py b/scripts/ex-gwf-maw-p02.py index 34a9b85f..097b8ba6 100644 --- a/scripts/ex-gwf-maw-p02.py +++ b/scripts/ex-gwf-maw-p02.py @@ -173,10 +173,7 @@ def build_models(): filename=obs_file, digits=10, print_input=True, continuous=obs_dict ) - flopy.mf6.ModflowGwfoc( - gwf, - printrecord=[("BUDGET", "LAST")], - ) + flopy.mf6.ModflowGwfoc(gwf, printrecord=[("BUDGET", "LAST")]) return sim @@ -215,31 +212,17 @@ def plot_maw_results(silent=True): # create the figure fig, axes = plt.subplots( - ncols=1, - nrows=2, - sharex=True, - figsize=figure_size, - constrained_layout=True, + ncols=1, nrows=2, sharex=True, figsize=figure_size, constrained_layout=True ) ax = axes[0] ax.set_xlim(tmin, tmax) ax.set_ylim(0, 4500) ax.semilogx( - time, - maw["Q1"], - lw=0.75, - ls="-", - color="blue", - label="Upper aquifer", + time, maw["Q1"], lw=0.75, ls="-", color="blue", label="Upper aquifer" ) ax.semilogx( - time, - maw["Q2"], - lw=0.75, - ls="-", - color="red", - label="Lower aquifer", + time, maw["Q2"], lw=0.75, ls="-", color="red", label="Lower aquifer" ) ax.axhline(0, lw=0.5, color="0.5") ax.set_ylabel(" ") @@ -249,20 +232,8 @@ def plot_maw_results(silent=True): ax = axes[1] ax.set_xlim(tmin, tmax) ax.set_ylim(-4500, 0) - ax.axhline( - 10.0, - lw=0.75, - ls="-", - color="blue", - label="Upper aquifer", - ) - ax.axhline( - 10.0, - lw=0.75, - ls="-", - color="red", - label="Lower aquifer", - ) + ax.axhline(10.0, lw=0.75, ls="-", color="blue", label="Upper aquifer") + ax.axhline(10.0, lw=0.75, ls="-", color="red", label="Lower aquifer") ax.semilogx( time, maw["FW"], @@ -306,10 +277,7 @@ def plot_maw_results(silent=True): def plot_grid(sim, silent=True): gwf = sim.get_model(sim_name) with styles.USGSMap(): - fig = plt.figure( - figsize=(4, 4.3), - tight_layout=True, - ) + fig = plt.figure(figsize=(4, 4.3), tight_layout=True) plt.axis("off") nrows, ncols = 10, 1 diff --git a/scripts/ex-gwf-maw-p03.py b/scripts/ex-gwf-maw-p03.py index 3d0638a2..4e303a7b 100644 --- a/scripts/ex-gwf-maw-p03.py +++ b/scripts/ex-gwf-maw-p03.py @@ -119,24 +119,7 @@ def calc_cond(area, l1, l2, k1, k2): 10.0, 10.0, ] -delc = [ - 10, - 9.38, - 9, - 6, - 4, - 3, - 2, - 1.33, - 1.25, - 1, - 1, - 0.75, - 0.5, - 0.3735, - 0.25, - 0.1665, -] +delc = [10, 9.38, 9, 6, 4, 3, 2, 1.33, 1.25, 1, 1, 0.75, 0.5, 0.3735, 0.25, 0.1665] # Time discretization tdis_ds = ((1.0, 1, 1.0),) @@ -461,10 +444,7 @@ def plot_maw_results(silent=True): zelev = sorted(list(set(list(obs_elev.values()))), reverse=True) - results = { - "maw": {}, - "gwf": {}, - } + results = {"maw": {}, "gwf": {}} for z in zelev: results["maw"][z] = 0.0 results["gwf"][z] = 0.0 @@ -490,11 +470,7 @@ def plot_maw_results(silent=True): # create the figure fig, ax = plt.subplots( - ncols=1, - nrows=1, - sharex=True, - figsize=(4, 4), - constrained_layout=True, + ncols=1, nrows=1, sharex=True, figsize=(4, 4), constrained_layout=True ) ax.set_xlim(-3.5, 3.5) @@ -523,14 +499,7 @@ def plot_maw_results(silent=True): color="red", label="High K well", ) - ax.plot( - -1000, - -1000, - lw=0.5, - ls="-", - color="0.5", - label="Grid cell", - ) + ax.plot(-1000, -1000, lw=0.5, ls="-", color="0.5", label="Grid cell") styles.graph_legend(ax, loc="upper left", ncol=1, frameon=True) styles.add_text( @@ -571,9 +540,7 @@ def plot_regional_grid(silent=True): h = gwf.output.head().get_data() with styles.USGSMap() as fs: - fig = plt.figure( - figsize=(6.3, 3.5), - ) + fig = plt.figure(figsize=(6.3, 3.5)) plt.axis("off") nrows, ncols = 10, 1 @@ -656,13 +623,7 @@ def plot_regional_grid(silent=True): markeredgewidth=1.25, label="Local model domain", ) - ax.plot( - -10000, - -10000, - lw=0.5, - color="black", - label="Head contour, $ft$", - ) + ax.plot(-10000, -10000, lw=0.5, color="black", label="Head contour, $ft$") cbar = plt.colorbar(ca, shrink=0.5, orientation="horizontal", ax=ax) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Head, $ft$", fontsize=9) @@ -689,23 +650,14 @@ def plot_local_grid(silent=True): i, j = maw_loc dx, dy = delr[j], delc[i] - px = ( - 50.0 - 0.5 * dx, - 50.0 + 0.5 * dx, - ) - py = ( - 0.0 + dy, - 0.0 + dy, - ) + px = (50.0 - 0.5 * dx, 50.0 + 0.5 * dx) + py = (0.0 + dy, 0.0 + dy) # get regional heads for constant head boundaries h = gwf.output.head().get_data() with styles.USGSMap() as fs: - fig = plt.figure( - figsize=(6.3, 4.1), - tight_layout=True, - ) + fig = plt.figure(figsize=(6.3, 4.1), tight_layout=True) plt.axis("off") nrows, ncols = 10, 1 @@ -792,11 +744,7 @@ def plot_local_grid(silent=True): label="Multi-aquifer well", ) ax.plot( - -10000, - -10000, - lw=0.5, - color="black", - label="Water-table contour, $ft$", + -10000, -10000, lw=0.5, color="black", label="Water-table contour, $ft$" ) styles.graph_legend(ax, loc="lower center", ncol=3) diff --git a/scripts/ex-gwf-nwt-p02.py b/scripts/ex-gwf-nwt-p02.py index 7829a233..7354f4bf 100644 --- a/scripts/ex-gwf-nwt-p02.py +++ b/scripts/ex-gwf-nwt-p02.py @@ -171,14 +171,7 @@ def build_models( botm=botm, ) if rewet: - rewet_record = [ - "wetfct", - wetfct, - "iwetit", - iwetit, - "ihdwet", - ihdwet, - ] + rewet_record = ["wetfct", wetfct, "iwetit", iwetit, "ihdwet", ihdwet] wetdry = 9 * [wetdry] + 5 * [0] else: rewet_record = None @@ -278,11 +271,7 @@ def plot_results(silent=True): # Create figure for simulation fig, axes = plt.subplots( - ncols=1, - nrows=4, - sharex=True, - figsize=figure_size, - constrained_layout=False, + ncols=1, nrows=4, sharex=True, figsize=figure_size, constrained_layout=False ) # plot the results @@ -308,13 +297,7 @@ def plot_results(silent=True): ) mm.plot_bc("CHD", color="cyan") mm.plot_grid(lw=0.5) - ax.plot( - xnode, - head[0, :], - lw=0.75, - color="black", - label="Newton-Raphson", - ) + ax.plot(xnode, head[0, :], lw=0.75, color="black", label="Newton-Raphson") ax.plot( xnode, head1[0, :], diff --git a/scripts/ex-gwf-nwt-p03.py b/scripts/ex-gwf-nwt-p03.py index 05c817b0..8bf3ffb4 100644 --- a/scripts/ex-gwf-nwt-p03.py +++ b/scripts/ex-gwf-nwt-p03.py @@ -120,14 +120,7 @@ rch_low = rch_high.copy() * 1e-3 # Constant head boundary conditions -chd_spd = [ - [0, i, ncol - 1, H1] - for i in ( - 45, - 46, - 47, - ) -] +chd_spd = [[0, i, ncol - 1, H1] for i in (45, 46, 47)] # Solver parameters nouter = 500 @@ -142,10 +135,7 @@ # + -def build_models( - name, - recharge="high", -): +def build_models(name, recharge="high"): sim_ws = os.path.join(workspace, name) sim = flopy.mf6.MFSimulation(sim_name=sim_name, sim_ws=sim_ws, exe_name="mf6") flopy.mf6.ModflowTdis(sim, nper=nper, perioddata=tdis_ds, time_units=time_units) @@ -271,11 +261,7 @@ def plot_grid(gwf, silent=True): bot_coll = mm.plot_array(bot, vmin=bmin, vmax=bmax) mm.plot_bc("CHD", color="cyan") cv = mm.contour_array( - bot, - levels=blevels, - linewidths=0.5, - linestyles="-", - colors=bcolor, + bot, levels=blevels, linewidths=0.5, linestyles="-", colors=bcolor ) plt.clabel(cv, fmt="%1.0f") ax.set_xlabel("x-coordinate, in meters") @@ -305,12 +291,7 @@ def plot_grid(gwf, silent=True): styles.graph_legend(ax, loc="center", ncol=2) cax = plt.axes([0.275, 0.125, 0.45, 0.025]) - cbar = plt.colorbar( - bot_coll, - shrink=0.8, - orientation="horizontal", - cax=cax, - ) + cbar = plt.colorbar(bot_coll, shrink=0.8, orientation="horizontal", cax=cax) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Bottom Elevation, $m$") @@ -337,11 +318,7 @@ def plot_recharge(gwf, silent=True): ) plt.clabel(cv, fmt="%1.0e") cbar = plt.colorbar( - rch_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0e", + rch_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0e" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Recharge rate, $m/day$") @@ -363,11 +340,7 @@ def plot_recharge(gwf, silent=True): ) plt.clabel(cv, fmt="%1.0e") cbar = plt.colorbar( - rch_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0e", + rch_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0e" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Recharge rate, $m/day$") @@ -447,11 +420,7 @@ def plot_results(idx, sim, silent=True): plt.clabel(cv, fmt="%1.0f", zorder=10) mm.plot_bc("CHD", color="cyan", zorder=11) cbar = plt.colorbar( - h_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + h_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Water level, $m$") @@ -463,11 +432,7 @@ def plot_results(idx, sim, silent=True): ax = axes[1] mm = flopy.plot.PlotMapView(gwf, ax=ax, extent=extents) s_coll = mm.plot_array( - sat_thick, - vmin=smin, - vmax=smax, - masked_values=masked_values, - zorder=10, + sat_thick, vmin=smin, vmax=smax, masked_values=masked_values, zorder=10 ) cv = mm.contour_array( sat_thick, @@ -481,11 +446,7 @@ def plot_results(idx, sim, silent=True): plt.clabel(cv, fmt="%1.0f", zorder=10) mm.plot_bc("CHD", color="cyan", zorder=11) cbar = plt.colorbar( - s_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + s_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Saturated thickness, $m$") @@ -506,14 +467,7 @@ def plot_results(idx, sim, silent=True): mec="cyan", label="Constant Head", ) - ax.plot( - -10000, - -10000, - lw=0.5, - ls="-", - color=vcolor, - label="Head contour, m", - ) + ax.plot(-10000, -10000, lw=0.5, ls="-", color=vcolor, label="Head contour, m") ax.plot( -10000, -10000, diff --git a/scripts/ex-gwf-radial.py b/scripts/ex-gwf-radial.py index 40235839..8f9e3b3c 100644 --- a/scripts/ex-gwf-radial.py +++ b/scripts/ex-gwf-radial.py @@ -185,9 +185,7 @@ def get_rad_array(var, rep): # Build rectangular equivalent of radial coordinates (unwrap radial bands) if get_vertex: perimeter_outer = np.fromiter( - (2.0 * pi * rad for rad in radius_outer), - dtype=float, - count=nradial, + (2.0 * pi * rad for rad in radius_outer), dtype=float, count=nradial ) xc = 0.5 * radius_outer[0] yc = 0.5 * perimeter_outer[-1] @@ -1185,12 +1183,7 @@ def build_models(name): gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True) disukwargs = get_disu_radial_kwargs( - nlay, - nradial, - radius_outer, - surface_elevation, - layer_thickness, - get_vertex=True, + nlay, nradial, radius_outer, surface_elevation, layer_thickness, get_vertex=True ) disu = flopy.mf6.ModflowGwfdisu(gwf, length_units=length_units, **disukwargs) diff --git a/scripts/ex-gwf-sagehen.py b/scripts/ex-gwf-sagehen.py index 47b2f463..472ffa55 100644 --- a/scripts/ex-gwf-sagehen.py +++ b/scripts/ex-gwf-sagehen.py @@ -2346,25 +2346,16 @@ def plot_results(mf6): fig = plt.figure(figsize=figure_size_ts, dpi=300, tight_layout=True) ax = fig.add_subplot(1, 1, 1) vals2.outflow.plot( - style="-", - linewidth=0.5, - color="royalblue", - label="Streamflow at Outlet", + style="-", linewidth=0.5, color="royalblue", label="Streamflow at Outlet" ) vals2.GroundwaterDischarge.plot( style="k-", linewidth=0.7, label="Groundwater Discharge" ) vals2.RejectedInfiltration.plot( - style="-", - linewidth=0.7, - color="brown", - label="Rejected Infiltration", + style="-", linewidth=0.7, color="brown", label="Rejected Infiltration" ) vals2.gwswExchange.plot( - style="-", - color="darkgreen", - linewidth=0.7, - label="GW Discharge to Streams", + style="-", color="darkgreen", linewidth=0.7, label="GW Discharge to Streams" ) ax.set_ylim(0, 350000) plt.tick_params( diff --git a/scripts/ex-gwf-sfr-p01.py b/scripts/ex-gwf-sfr-p01.py index 0da2f851..e1c3e372 100644 --- a/scripts/ex-gwf-sfr-p01.py +++ b/scripts/ex-gwf-sfr-p01.py @@ -155,582 +155,42 @@ # SFR Package sfr_pakdata = [ - [ - 0, - 0, - 0, - 0, - 4500.0, - 12, - 8.6767896e-04, - 1093.048, - 3.0, - 0.00003, - 0.030, - 1, - 1.0, - 0, - ], - [ - 1, - 0, - 1, - 1, - 7000.0, - 12, - 8.6767896e-04, - 1088.059, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 2, - 0, - 2, - 2, - 6000.0, - 12, - 8.6767896e-04, - 1082.419, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 3, - 0, - 2, - 3, - 5550.0, - 12, - 8.6767896e-04, - 1077.408, - 3.0, - 0.00003, - 0.030, - 3, - 1.0, - 1, - ], - [ - 4, - 0, - 3, - 4, - 6500.0, - 12, - 9.4339624e-04, - 1071.934, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 5, - 0, - 4, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1066.509, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 6, - 0, - 5, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1061.792, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 7, - 0, - 6, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1057.075, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 8, - 0, - 7, - 5, - 5000.0, - 12, - 9.4339624e-04, - 1052.359, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 9, - 0, - 2, - 4, - 5000.0, - 10, - 5.4545456e-04, - 1073.636, - 2.0, - 0.00003, - 0.030, - 2, - 0.0, - 0, - ], - [ - 10, - 0, - 2, - 5, - 5000.0, - 10, - 5.4545456e-04, - 1070.909, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 11, - 0, - 2, - 6, - 4500.0, - 10, - 5.4545456e-04, - 1068.318, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 12, - 0, - 3, - 7, - 6000.0, - 10, - 5.4545456e-04, - 1065.455, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 13, - 0, - 4, - 7, - 5000.0, - 10, - 5.4545456e-04, - 1062.455, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 14, - 0, - 5, - 7, - 2000.0, - 10, - 5.4545456e-04, - 1060.545, - 2.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 15, - 0, - 4, - 9, - 2500.0, - 10, - 1.8181818e-03, - 1077.727, - 3.0, - 0.00003, - 0.030, - 1, - 1.0, - 0, - ], - [ - 16, - 0, - 4, - 8, - 5000.0, - 10, - 1.8181818e-03, - 1070.909, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 17, - 0, - 5, - 7, - 3500.0, - 10, - 1.8181818e-03, - 1063.182, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 18, - 0, - 5, - 7, - 4000.0, - 15, - 1.0000000e-03, - 1058.000, - 3.0, - 0.00003, - 0.030, - 3, - 1.0, - 0, - ], - [ - 19, - 0, - 6, - 6, - 5000.0, - 15, - 1.0000000e-03, - 1053.500, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 20, - 0, - 7, - 6, - 3500.0, - 15, - 1.0000000e-03, - 1049.250, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 21, - 0, - 7, - 5, - 2500.0, - 15, - 1.0000000e-03, - 1046.250, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 22, - 0, - 8, - 5, - 5000.0, - 12, - 9.0909092e-04, - 1042.727, - 3.0, - 0.00003, - 0.030, - 3, - 1.0, - 0, - ], - [ - 23, - 0, - 9, - 6, - 5000.0, - 12, - 9.0909092e-04, - 1038.182, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 24, - 0, - 10, - 6, - 5000.0, - 12, - 9.0909092e-04, - 1033.636, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 25, - 0, - 11, - 6, - 5000.0, - 12, - 9.0909092e-04, - 1029.091, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 26, - 0, - 12, - 6, - 2000.0, - 12, - 9.0909092e-04, - 1025.909, - 3.0, - 0.00003, - 0.030, - 2, - 1.0, - 0, - ], - [ - 27, - 0, - 13, - 8, - 5000.0, - 55, - 9.6774194e-04, - 1037.581, - 3.0, - 0.00006, - 0.025, - 1, - 1.0, - 0, - ], - [ - 28, - 0, - 12, - 7, - 5500.0, - 55, - 9.6774194e-04, - 1032.500, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 29, - 0, - 12, - 6, - 5000.0, - 55, - 9.6774194e-04, - 1027.419, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 30, - 0, - 12, - 5, - 5000.0, - 40, - 1.2500000e-03, - 1021.875, - 3.0, - 0.00006, - 0.025, - 3, - 1.0, - 0, - ], - [ - 31, - 0, - 12, - 4, - 5000.0, - 40, - 1.2500000e-03, - 1015.625, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 32, - 0, - 12, - 3, - 5000.0, - 40, - 1.2500000e-03, - 1009.375, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 33, - 0, - 12, - 2, - 5000.0, - 40, - 1.2500000e-03, - 1003.125, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 34, - 0, - 12, - 1, - 5000.0, - 40, - 1.2500000e-03, - 996.8750, - 3.0, - 0.00006, - 0.025, - 2, - 1.0, - 0, - ], - [ - 35, - 0, - 12, - 0, - 3000.0, - 40, - 1.2500000e-03, - 991.8750, - 3.0, - 0.00006, - 0.025, - 1, - 1.0, - 0, - ], + [0, 0, 0, 0, 4500.0, 12, 8.6767896e-04, 1093.048, 3.0, 0.00003, 0.030, 1, 1.0, 0], + [1, 0, 1, 1, 7000.0, 12, 8.6767896e-04, 1088.059, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [2, 0, 2, 2, 6000.0, 12, 8.6767896e-04, 1082.419, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [3, 0, 2, 3, 5550.0, 12, 8.6767896e-04, 1077.408, 3.0, 0.00003, 0.030, 3, 1.0, 1], + [4, 0, 3, 4, 6500.0, 12, 9.4339624e-04, 1071.934, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [5, 0, 4, 5, 5000.0, 12, 9.4339624e-04, 1066.509, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [6, 0, 5, 5, 5000.0, 12, 9.4339624e-04, 1061.792, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [7, 0, 6, 5, 5000.0, 12, 9.4339624e-04, 1057.075, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [8, 0, 7, 5, 5000.0, 12, 9.4339624e-04, 1052.359, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [9, 0, 2, 4, 5000.0, 10, 5.4545456e-04, 1073.636, 2.0, 0.00003, 0.030, 2, 0.0, 0], + [10, 0, 2, 5, 5000.0, 10, 5.4545456e-04, 1070.909, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [11, 0, 2, 6, 4500.0, 10, 5.4545456e-04, 1068.318, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [12, 0, 3, 7, 6000.0, 10, 5.4545456e-04, 1065.455, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [13, 0, 4, 7, 5000.0, 10, 5.4545456e-04, 1062.455, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [14, 0, 5, 7, 2000.0, 10, 5.4545456e-04, 1060.545, 2.0, 0.00003, 0.030, 2, 1.0, 0], + [15, 0, 4, 9, 2500.0, 10, 1.8181818e-03, 1077.727, 3.0, 0.00003, 0.030, 1, 1.0, 0], + [16, 0, 4, 8, 5000.0, 10, 1.8181818e-03, 1070.909, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [17, 0, 5, 7, 3500.0, 10, 1.8181818e-03, 1063.182, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [18, 0, 5, 7, 4000.0, 15, 1.0000000e-03, 1058.000, 3.0, 0.00003, 0.030, 3, 1.0, 0], + [19, 0, 6, 6, 5000.0, 15, 1.0000000e-03, 1053.500, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [20, 0, 7, 6, 3500.0, 15, 1.0000000e-03, 1049.250, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [21, 0, 7, 5, 2500.0, 15, 1.0000000e-03, 1046.250, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [22, 0, 8, 5, 5000.0, 12, 9.0909092e-04, 1042.727, 3.0, 0.00003, 0.030, 3, 1.0, 0], + [23, 0, 9, 6, 5000.0, 12, 9.0909092e-04, 1038.182, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [24, 0, 10, 6, 5000.0, 12, 9.0909092e-04, 1033.636, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [25, 0, 11, 6, 5000.0, 12, 9.0909092e-04, 1029.091, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [26, 0, 12, 6, 2000.0, 12, 9.0909092e-04, 1025.909, 3.0, 0.00003, 0.030, 2, 1.0, 0], + [27, 0, 13, 8, 5000.0, 55, 9.6774194e-04, 1037.581, 3.0, 0.00006, 0.025, 1, 1.0, 0], + [28, 0, 12, 7, 5500.0, 55, 9.6774194e-04, 1032.500, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [29, 0, 12, 6, 5000.0, 55, 9.6774194e-04, 1027.419, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [30, 0, 12, 5, 5000.0, 40, 1.2500000e-03, 1021.875, 3.0, 0.00006, 0.025, 3, 1.0, 0], + [31, 0, 12, 4, 5000.0, 40, 1.2500000e-03, 1015.625, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [32, 0, 12, 3, 5000.0, 40, 1.2500000e-03, 1009.375, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [33, 0, 12, 2, 5000.0, 40, 1.2500000e-03, 1003.125, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [34, 0, 12, 1, 5000.0, 40, 1.2500000e-03, 996.8750, 3.0, 0.00006, 0.025, 2, 1.0, 0], + [35, 0, 12, 0, 3000.0, 40, 1.2500000e-03, 991.8750, 3.0, 0.00006, 0.025, 1, 1.0, 0], ] sfr_conn = [ @@ -967,11 +427,7 @@ def plot_grid(gwf, silent=True): mm.plot_inactive(color_noflow="0.5") mm.plot_grid(lw=0.5, color="black") cbar = plt.colorbar( - top_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + top_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Land surface elevation, $ft$") @@ -999,11 +455,7 @@ def plot_grid(gwf, silent=True): mm.plot_inactive(color_noflow="0.5") mm.plot_grid(lw=0.5, color="black") cbar = plt.colorbar( - bot_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + bot_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Bottom elevation, $ft$") @@ -1125,8 +577,7 @@ def plot_head_results(gwf, silent=True): # extract heads and specific discharge for first stress period head = hobj.get_data(kstpkper=kstpkper[0]) qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], gwf ) ax = axes[0] @@ -1154,8 +605,7 @@ def plot_head_results(gwf, silent=True): # extract heads and specific discharge for second stress period head = hobj.get_data(kstpkper=kstpkper[1]) qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[1])[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[1])[0], gwf ) ax = axes[1] @@ -1182,11 +632,7 @@ def plot_head_results(gwf, silent=True): # legend ax = axes[-1] cbar = plt.colorbar( - head_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + head_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Head, $ft$") @@ -1218,12 +664,7 @@ def plot_sfr_results(gwf, silent=True): # modify the time results["totim"] /= 365.25 * 86400.0 - rnos = ( - 3, - 14, - 26, - 35, - ) + rnos = (3, 14, 26, 35) sfr = gwf.sfr.packagedata.array["rtp"] offsets = [] for rno in rnos: @@ -1231,11 +672,7 @@ def plot_sfr_results(gwf, silent=True): # create the figure fig, axes = plt.subplots( - ncols=2, - nrows=4, - sharex=True, - figsize=(6.3, 6.3), - constrained_layout=True, + ncols=2, nrows=4, sharex=True, figsize=(6.3, 6.3), constrained_layout=True ) ipos = 0 for i in range(4): diff --git a/scripts/ex-gwf-sfr-p01b.py b/scripts/ex-gwf-sfr-p01b.py index 3d1e99a1..833a2747 100644 --- a/scripts/ex-gwf-sfr-p01b.py +++ b/scripts/ex-gwf-sfr-p01b.py @@ -3896,15 +3896,13 @@ def build_models(): continuous=sfr_obs_dict, ) - ( - idomain_wlakes, - lakepakdata_dict, - lakeconnectiondata, - ) = flopy.mf6.utils.get_lak_connections( - gwf.modelgrid, - lake_map, - idomain=gwf.dis.idomain.array, - bedleak=lake_leakance, + (idomain_wlakes, lakepakdata_dict, lakeconnectiondata) = ( + flopy.mf6.utils.get_lak_connections( + gwf.modelgrid, + lake_map, + idomain=gwf.dis.idomain.array, + bedleak=lake_leakance, + ) ) lak_pakdata = [] for key in lakepakdata_dict.keys(): @@ -3973,12 +3971,7 @@ def build_models(): ("id26_infil", "infiltration", 26), ("id126_infil", "infiltration", 126), ("id26_dpth=20", "water-content", 26, 20.0), - ( - "id126_dpth=51", - "water-content", - 126, - 1.0, - ), # DEPTH IS BELOW CELTOP + ("id126_dpth=51", "water-content", 126, 1.0), # DEPTH IS BELOW CELTOP ("id26_rch", "uzf-gwrch", 26), ("id126_rch", "uzf-gwrch", 126), ("id26_gwet", "uzf-gwet", 26), @@ -4091,11 +4084,7 @@ def plot_grid(gwf, silent=True): mm.plot_inactive(color_noflow="0.5") mm.plot_grid(lw=0.5, color="black") cbar = plt.colorbar( - top_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + top_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Land surface elevation, $ft$") @@ -4123,11 +4112,7 @@ def plot_grid(gwf, silent=True): mm.plot_inactive(color_noflow="0.5") mm.plot_grid(lw=0.5, color="black") cbar = plt.colorbar( - bot_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + bot_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Bottom elevation, $ft$") @@ -4249,8 +4234,7 @@ def plot_head_results(gwf, silent=True): # extract heads and specific discharge for first stress period head = hobj.get_data(kstpkper=kstpkper[0]) qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[0])[0], gwf ) ax = axes[0] @@ -4278,8 +4262,7 @@ def plot_head_results(gwf, silent=True): # extract heads and specific discharge for second stress period head = hobj.get_data(kstpkper=kstpkper[1]) qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[1])[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=kstpkper[1])[0], gwf ) ax = axes[1] @@ -4306,11 +4289,7 @@ def plot_head_results(gwf, silent=True): # legend ax = axes[-1] cbar = plt.colorbar( - head_coll, - shrink=0.8, - orientation="horizontal", - ax=ax, - format="%.0f", + head_coll, shrink=0.8, orientation="horizontal", ax=ax, format="%.0f" ) cbar.ax.tick_params(size=0) cbar.ax.set_xlabel(r"Head, $ft$") @@ -4363,11 +4342,11 @@ def plot_mvr_results(idx, gwf, silent=True): ( np.array(mvr_Q.recordarray["kper"] == i), np.array(mvr_Q.recordarray["paknam"] == provider), # Provider - np.array(mvr_Q.recordarray["paknam2"] == receiver1), + np.array(mvr_Q.recordarray["paknam2"] == receiver1), # Receiver ), axis=0, ) - ) # Receiver + ) tot_stp_gwirrig = 0 if len(mvr_idxs[0]) > 0: @@ -4426,12 +4405,7 @@ def plot_mvr_results(idx, gwf, silent=True): # Make the plot plt.bar( - br1, - gwirrig, - color="r", - width=barWidth, - edgecolor="grey", - label="GW Irrig", + br1, gwirrig, color="r", width=barWidth, edgecolor="grey", label="GW Irrig" ) plt.bar( br2, diff --git a/scripts/ex-gwf-sfr-pindersauer.py b/scripts/ex-gwf-sfr-pindersauer.py index ced38341..294af066 100644 --- a/scripts/ex-gwf-sfr-pindersauer.py +++ b/scripts/ex-gwf-sfr-pindersauer.py @@ -289,17 +289,7 @@ def plot_observations(sim_list, silent=True): colors = ("blue", "black") labels = ("no leakage", "leakage") markers = ("s", "o") - mosaic = [ - ["a"], - ["a"], - ["a"], - ["a"], - ["b"], - ["b"], - ["b"], - ["b"], - ["c"], - ] + mosaic = [["a"], ["a"], ["a"], ["a"], ["b"], ["b"], ["b"], ["b"], ["c"]] analytical = [] for key, value in parameters.items(): diff --git a/scripts/ex-gwf-spbc.py b/scripts/ex-gwf-spbc.py index 72377aad..76a9d6e8 100644 --- a/scripts/ex-gwf-spbc.py +++ b/scripts/ex-gwf-spbc.py @@ -190,8 +190,7 @@ def plot_grid(sim): # create MODFLOW 6 cell-by-cell budget object qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) ax = fig.add_subplot(1, 1, 1, aspect="equal") diff --git a/scripts/ex-gwf-twri.py b/scripts/ex-gwf-twri.py index b5371f17..6df6c6ff 100644 --- a/scripts/ex-gwf-twri.py +++ b/scripts/ex-gwf-twri.py @@ -298,13 +298,7 @@ def plot_results(sim, mf, silent=True): vmin, vmax = -25, 100 # check that the results are comparable - for idx, k in enumerate( - ( - 0, - 2, - 4, - ) - ): + for idx, k in enumerate((0, 2, 4)): diff = np.abs(head[k] - head0[idx]) msg = ( "aquifer {}: ".format(idx + 1) @@ -316,8 +310,7 @@ def plot_results(sim, mf, silent=True): # extract specific discharge qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - cobj.get_data(text="DATA-SPDIS", kstpkper=(0, 0))[0], - gwf, + cobj.get_data(text="DATA-SPDIS", kstpkper=(0, 0))[0], gwf ) frf = cobj0.get_data(text="FLOW RIGHT FACE", kstpkper=(0, 0))[0] fff = cobj0.get_data(text="FLOW FRONT FACE", kstpkper=(0, 0))[0] @@ -354,10 +347,7 @@ def plot_results(sim, mf, silent=True): fmp.plot_bc("DRN", color="green") fmp.plot_bc("WEL", color="0.5") cv = fmp.contour_array( - head, - levels=[-25, 0, 25, 75, 100], - linewidths=0.5, - colors="black", + head, levels=[-25, 0, 25, 75, 100], linewidths=0.5, colors="black" ) plt.clabel(cv, fmt="%1.0f") fmp.plot_vector(qx, qy, normalize=True, color="0.75") @@ -372,10 +362,7 @@ def plot_results(sim, mf, silent=True): fmp.plot_bc("DRN", color="green") fmp.plot_bc("WEL", color="0.5") cv = fmp.contour_array( - head0, - levels=[-25, 0, 25, 75, 100], - linewidths=0.5, - colors="black", + head0, levels=[-25, 0, 25, 75, 100], linewidths=0.5, colors="black" ) plt.clabel(cv, fmt="%1.0f") # fmp.plot_discharge( @@ -401,23 +388,9 @@ def plot_results(sim, mf, silent=True): # ax = axes.flatten()[-2] # ax.axis("off") ax.plot( - -10000, - -10000, - marker="s", - ms=10, - mfc="green", - mec="green", - label="Drain", - ) - ax.plot( - -10000, - -10000, - marker="s", - ms=10, - mfc="0.5", - mec="0.5", - label="Well", + -10000, -10000, marker="s", ms=10, mfc="green", mec="green", label="Drain" ) + ax.plot(-10000, -10000, marker="s", ms=10, mfc="0.5", mec="0.5", label="Well") ax.plot( -10000, -10000, diff --git a/scripts/ex-gwf-u1disv.py b/scripts/ex-gwf-u1disv.py index 6545ef34..22129e1f 100644 --- a/scripts/ex-gwf-u1disv.py +++ b/scripts/ex-gwf-u1disv.py @@ -267,20 +267,14 @@ def plot_head(idx, sim): # create MODFLOW 6 cell-by-cell budget object qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) ax = fig.add_subplot(1, 2, 1, aspect="equal") pmv = flopy.plot.PlotMapView(model=gwf, ax=ax, layer=0) pmv.plot_grid() cb = pmv.plot_array(head, cmap="jet") - pmv.plot_vector( - qx, - qy, - normalize=False, - color="0.75", - ) + pmv.plot_vector(qx, qy, normalize=False, color="0.75") cbar = plt.colorbar(cb, shrink=0.25) cbar.ax.set_xlabel(r"Head, ($m$)") ax.set_xlabel("x position (m)") diff --git a/scripts/ex-gwf-u1gwfgwf.py b/scripts/ex-gwf-u1gwfgwf.py index f873c323..d322ef2a 100644 --- a/scripts/ex-gwf-u1gwfgwf.py +++ b/scripts/ex-gwf-u1gwfgwf.py @@ -334,10 +334,7 @@ def plot_grid(idx, sim): pmv.plot_bc(name="CHD-RIGHT", alpha=0.75) ax.plot( - [200, 500, 500, 200, 200], - [200, 200, 500, 500, 200], - "r--", - linewidth=2.0, + [200, 500, 500, 200, 200], [200, 200, 500, 500, 200], "r--", linewidth=2.0 ) ax.set_xlabel("x position (m)") @@ -479,13 +476,11 @@ def plot_head(idx, sim): gwf_outer.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf_outer, ) - ( - qx_inner, - qy_inner, - qz_inner, - ) = flopy.utils.postprocessing.get_specific_discharge( - gwf_inner.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf_inner, + (qx_inner, qy_inner, qz_inner) = ( + flopy.utils.postprocessing.get_specific_discharge( + gwf_inner.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], + gwf_inner, + ) ) # create plot with head values and spdis @@ -498,18 +493,8 @@ def plot_head(idx, sim): cb = pmv_inner.plot_array(head_inner, cmap="jet", vmin=0.0, vmax=1.0) pmv.plot_grid() pmv_inner.plot_grid() - pmv.plot_vector( - qx, - qy, - normalize=False, - color="0.75", - ) - pmv_inner.plot_vector( - qx_inner, - qy_inner, - normalize=False, - color="0.75", - ) + pmv.plot_vector(qx, qy, normalize=False, color="0.75") + pmv_inner.plot_vector(qx_inner, qy_inner, normalize=False, color="0.75") cbar = plt.colorbar(cb, shrink=0.25) cbar.ax.set_xlabel(r"Head, ($m$)") ax.set_xlabel("x position (m)") diff --git a/scripts/ex-gwf-whirl.py b/scripts/ex-gwf-whirl.py index c5f99a25..5a98d751 100644 --- a/scripts/ex-gwf-whirl.py +++ b/scripts/ex-gwf-whirl.py @@ -177,8 +177,7 @@ def plot_spdis(sim): # create MODFLOW 6 cell-by-cell budget object qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge( - gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], - gwf, + gwf.output.budget().get_data(text="DATA-SPDIS", totim=1.0)[0], gwf ) ax = fig.add_subplot(1, 1, 1) diff --git a/scripts/ex-gwt-gwtgwt-p10.py b/scripts/ex-gwt-gwtgwt-p10.py index aad4d324..17274147 100644 --- a/scripts/ex-gwt-gwtgwt-p10.py +++ b/scripts/ex-gwt-gwtgwt-p10.py @@ -292,16 +292,7 @@ def add_flow(sim): for irow in range(nrow_inn): irow_outer = irow + 8 exgdata.append( - ( - (ilay, irow_outer, 5), - (ilay, irow, 0), - 1, - 50.0, - 25.0, - 50.0, - 0.0, - 75.0, - ) + ((ilay, irow_outer, 5), (ilay, irow, 0), 1, 50.0, 25.0, 50.0, 0.0, 75.0) ) # west for ilay in range(nlay): @@ -911,11 +902,7 @@ def plot_grids(sim): gwt_outer = sim.get_model(gwtname_out) mm = flopy.plot.PlotMapView(model=gwt_outer) mm.plot_grid(color="0.2", alpha=0.7) - ax.plot( - [xmin, xmax, xmax, xmin, xmin], - [ymin, ymin, ymax, ymax, ymin], - "r--", - ) + ax.plot([xmin, xmax, xmax, xmin, xmin], [ymin, ymin, ymax, ymax, ymin], "r--") fpath = figs_path / "ex-gwtgwt-p10-modelgrid.png" fig.savefig(fpath) diff --git a/scripts/ex-gwt-hecht-mendez.py b/scripts/ex-gwt-hecht-mendez.py index 27136e09..2706b959 100644 --- a/scripts/ex-gwt-hecht-mendez.py +++ b/scripts/ex-gwt-hecht-mendez.py @@ -879,20 +879,7 @@ def plot_results( R = 2.59 # From Hecht-Mendez manuscript tr_sln = hechtMendez3d( - x_pos, - t, - Y, - Z, - al, - ath, - atv, - thermdiff, - va, - n, - R, - Fplanar, - cw, - rhow, + x_pos, t, Y, Z, al, ath, atv, thermdiff, va, n, R, Fplanar, cw, rhow ) # list of where to draw vertical lines @@ -923,10 +910,7 @@ def plot_results( ax.axvline(x=xc, color="k", linestyle=":", alpha=0.1) ss_ln = ax.plot( - x_pos, - y_ss_anly_sln, - "r-", - label="Steady state analytical solution", + x_pos, y_ss_anly_sln, "r-", label="Steady state analytical solution" ) tr_ln = ax.plot( x_pos, y_tr_anly_sln, "b-", label="Transient analytical solution" @@ -940,11 +924,7 @@ def plot_results( mf6_ss_ln = ax.plot(x_pos, y_150_mf6_sln, "rx", label="Steady-state MF6-GWT") mf6_tr_ln = ax.plot( - x_pos, - y_10_mf6_sln, - "bo", - markerfacecolor="none", - label="Transient MF6-GWT", + x_pos, y_10_mf6_sln, "bo", markerfacecolor="none", label="Transient MF6-GWT" ) ax.set_xlim(1, 100) ax.set_ylim(285.15 - 2.1, 285.15 + 0.5) @@ -958,10 +938,7 @@ def plot_results( plt.show() if plot_save: letter = chr(ord("@") + idx + 1) - fpth = figs_path / "{}{}".format( - "ex-" + sim_name + "-" + letter, - ".png", - ) + fpth = figs_path / "{}{}".format("ex-" + sim_name + "-" + letter, ".png") fig.savefig(fpth) @@ -989,12 +966,7 @@ def scenario(idx, runMT3D=False, silent=True): run_models(sim_mf6gwf, sim_mf6gwt, mf2k5=mf2k5, mt3d=mt3d, silent=silent) if plot: plot_results( - sim_mf6gwf, - sim_mf6gwt, - idx, - mf2k5=mf2k5, - mt3d=mt3d, - **parameter_dict, + sim_mf6gwf, sim_mf6gwt, idx, mf2k5=mf2k5, mt3d=mt3d, **parameter_dict ) diff --git a/scripts/ex-gwt-keating.py b/scripts/ex-gwt-keating.py index 70613e32..116b01ff 100644 --- a/scripts/ex-gwt-keating.py +++ b/scripts/ex-gwt-keating.py @@ -193,7 +193,10 @@ def build_mf6gwf(): gwf, head_filerecord=head_filerecord, budget_filerecord=budget_filerecord, - saverecord=[("HEAD", "ALL"), ("BUDGET", "ALL")], + saverecord=[ + ("HEAD", "ALL"), + ("BUDGET", "ALL"), + ], ) return sim @@ -276,10 +279,7 @@ def build_mf6gwt(): saverecord=saverecord, printrecord=[ ("CONCENTRATION", "LAST"), - ( - "BUDGET", - "ALL", - ), + ("BUDGET", "ALL"), ], ) obs_data = { @@ -523,11 +523,7 @@ def plot_cvt_results(sims): fig, axes = plt.subplots(2, 1, figsize=(6, 4), dpi=300, tight_layout=True) ax = axes[0] ax.plot( - mf6gwt_ra["totim"], - mf6gwt_ra["OBS1"], - "b-", - alpha=1.0, - label="MODFLOW 6", + mf6gwt_ra["totim"], mf6gwt_ra["OBS1"], "b-", alpha=1.0, label="MODFLOW 6" ) ax.plot( obs1ra["totim"], @@ -546,11 +542,7 @@ def plot_cvt_results(sims): styles.graph_legend(ax) ax = axes[1] ax.plot( - mf6gwt_ra["totim"], - mf6gwt_ra["OBS2"], - "b-", - alpha=1.0, - label="MODFLOW 6", + mf6gwt_ra["totim"], mf6gwt_ra["OBS2"], "b-", alpha=1.0, label="MODFLOW 6" ) ax.plot( obs2ra["totim"], diff --git a/scripts/ex-gwt-moc3d-p01.py b/scripts/ex-gwt-moc3d-p01.py index 833103b8..eeb2b5af 100644 --- a/scripts/ex-gwt-moc3d-p01.py +++ b/scripts/ex-gwt-moc3d-p01.py @@ -321,11 +321,7 @@ def build_mf6gwf(sim_folder): flopy.mf6.ModflowGwfchd(gwf, stress_period_data=[[(0, 0, ncol - 1), 1.0]]) wel_spd = { 0: [ - [ - (0, 0, 0), - specific_discharge * delc * delr * top, - source_concentration, - ] + [(0, 0, 0), specific_discharge * delc * delr * top, source_concentration], ], } flopy.mf6.ModflowGwfwel( diff --git a/scripts/ex-gwt-mt3dms-p02.py b/scripts/ex-gwt-mt3dms-p02.py index d6801a27..eeb19017 100644 --- a/scripts/ex-gwt-mt3dms-p02.py +++ b/scripts/ex-gwt-mt3dms-p02.py @@ -153,18 +153,10 @@ def build_mf6gwf(sim_folder): flopy.mf6.ModflowGwfchd(gwf, stress_period_data=[[(0, 0, ncol - 1), 1.0]]) wel_spd = { 0: [ - [ - (0, 0, 0), - inflow_rate, - source_concentration, - ] + [(0, 0, 0), inflow_rate, source_concentration], ], 1: [ - [ - (0, 0, 0), - inflow_rate, - 0.0, - ] + [(0, 0, 0), inflow_rate, 0.0], ], } flopy.mf6.ModflowGwfwel( diff --git a/scripts/ex-gwt-mt3dms-p03.py b/scripts/ex-gwt-mt3dms-p03.py index d506ed5c..1a583bb3 100644 --- a/scripts/ex-gwt-mt3dms-p03.py +++ b/scripts/ex-gwt-mt3dms-p03.py @@ -510,10 +510,7 @@ def plot_results(mt3d, mf6, idx, ax=None): cs1 = mm.contour_array(conc_mt3d[1], levels=[0.1, 1.0, 10.0, 50.0], colors="k") plt.clabel(cs1, inline=1, fontsize=10) cs2 = mm.contour_array( - conc_mf6[1], - levels=[0.1, 1.0, 10.0, 50.0], - colors="r", - linestyles="--", + conc_mf6[1], levels=[0.1, 1.0, 10.0, 50.0], colors="r", linestyles="--" ) plt.clabel(cs2, inline=1, fontsize=10) labels = ["MT3DMS", "MODFLOW 6"] diff --git a/scripts/ex-gwt-mt3dms-p06.py b/scripts/ex-gwt-mt3dms-p06.py index fa1da58e..3bc4facf 100644 --- a/scripts/ex-gwt-mt3dms-p06.py +++ b/scripts/ex-gwt-mt3dms-p06.py @@ -519,13 +519,7 @@ def plot_results(mt3d, mf6, idx, ax=None): y_mf6 = mf6cobs["BCKGRND_CN"] x_mf6_pare = x_mf6[::20] y_mf6_pare = y_mf6[::20] - ax.plot( - x_mf6_pare, - y_mf6_pare, - label="MODFLOW 6", - marker="x", - linestyle=":", - ) + ax.plot(x_mf6_pare, y_mf6_pare, label="MODFLOW 6", marker="x", linestyle=":") plt.xlim(0, 10) plt.ylim(0, 100.0) diff --git a/scripts/ex-gwt-mt3dms-p07.py b/scripts/ex-gwt-mt3dms-p07.py index eb1e8564..41eea302 100644 --- a/scripts/ex-gwt-mt3dms-p07.py +++ b/scripts/ex-gwt-mt3dms-p07.py @@ -515,10 +515,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): conc_mt3d[0], levels=[0.01, 0.05, 0.15, 0.50], colors="k" ) cs2 = mm.contour_array( - conc_mf6[0], - levels=[0.01, 0.05, 0.15, 0.50], - colors="r", - linestyles=":", + conc_mf6[0], levels=[0.01, 0.05, 0.15, 0.50], colors="r", linestyles=":" ) plt.clabel(cs1) plt.xlabel("DISTANCE ALONG X-AXIS, IN METERS") @@ -540,10 +537,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): mm.plot_ibound() cs = mm.contour_array(conc_mt3d[0], levels=[0.01, 0.05, 0.15, 0.50], colors="k") cs = mm.contour_array( - conc_mf6[0], - levels=[0.01, 0.05, 0.15, 0.50], - colors="r", - linestyles=":", + conc_mf6[0], levels=[0.01, 0.05, 0.15, 0.50], colors="r", linestyles=":" ) plt.clabel(cs) plt.xlabel("DISTANCE ALONG X-AXIS, IN METERS") @@ -561,10 +555,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): mm.plot_ibound() cs = mm.contour_array(conc_mt3d[0], levels=[0.01, 0.05, 0.15, 0.50], colors="k") cs = mm.contour_array( - conc_mf6[0], - levels=[0.01, 0.05, 0.15, 0.50], - colors="r", - linestyles=":", + conc_mf6[0], levels=[0.01, 0.05, 0.15, 0.50], colors="r", linestyles=":" ) plt.clabel(cs) plt.xlabel("DISTANCE ALONG X-AXIS, IN METERS") @@ -573,9 +564,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): letter = chr(ord("@") + idx + 3) styles.heading(letter=letter, heading=title) plt.plot( - mf2k5.modelgrid.xcellcenters[7, 2], - mf2k5.modelgrid.ycellcenters[7, 2], - "ko", + mf2k5.modelgrid.xcellcenters[7, 2], mf2k5.modelgrid.ycellcenters[7, 2], "ko" ) if plot_show: diff --git a/scripts/ex-gwt-mt3dms-p08.py b/scripts/ex-gwt-mt3dms-p08.py index f64cde51..38dcc99d 100644 --- a/scripts/ex-gwt-mt3dms-p08.py +++ b/scripts/ex-gwt-mt3dms-p08.py @@ -628,8 +628,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): plt.show() if plot_save: fpth = figs_path / "{}{}".format( - mf6.name + "-" + str(yr_idx[i] + 1) + "yrs", - ".png", + mf6.name + "-" + str(yr_idx[i] + 1) + "yrs", ".png" ) fig.savefig(fpth) @@ -673,8 +672,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): plt.show() if plot_save: fpth = figs_path / "{}{}".format( - mf6.name + "-" + str(yr_idx[i] + 1) + "yrs", - ".png", + mf6.name + "-" + str(yr_idx[i] + 1) + "yrs", ".png" ) fig.savefig(fpth) @@ -718,8 +716,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): plt.show() if plot_save: fpth = figs_path / "{}{}".format( - mf6.name + "-" + str(yr_idx[i] + 1) + "yrs", - ".png", + mf6.name + "-" + str(yr_idx[i] + 1) + "yrs", ".png" ) fig.savefig(fpth) diff --git a/scripts/ex-gwt-mt3dms-p09.py b/scripts/ex-gwt-mt3dms-p09.py index 0ff82a9b..5a155566 100644 --- a/scripts/ex-gwt-mt3dms-p09.py +++ b/scripts/ex-gwt-mt3dms-p09.py @@ -579,10 +579,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): if plot_show: plt.show() if plot_save: - fpth = figs_path / "{}{}".format( - sim_name, - ".png", - ) + fpth = figs_path / "{}{}".format(sim_name, ".png") fig.savefig(fpth) diff --git a/scripts/ex-gwt-mt3dms-p10.py b/scripts/ex-gwt-mt3dms-p10.py index b725fec6..c9b5a812 100644 --- a/scripts/ex-gwt-mt3dms-p10.py +++ b/scripts/ex-gwt-mt3dms-p10.py @@ -749,10 +749,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): if plot_show: plt.show() if plot_save: - fpth = figs_path / "{}{}".format( - mf6.name, - ".png", - ) + fpth = figs_path / "{}{}".format(mf6.name, ".png") fig.savefig(fpth) diff --git a/scripts/ex-gwt-mt3dsupp82.py b/scripts/ex-gwt-mt3dsupp82.py index a4f55d9b..d8e1c8ac 100644 --- a/scripts/ex-gwt-mt3dsupp82.py +++ b/scripts/ex-gwt-mt3dsupp82.py @@ -115,9 +115,7 @@ def build_mf6gwf(sim_folder): print_flows=True, save_flows=False, pname="CHD-1", - auxiliary=[ - ("CONCENTRATION"), - ], + auxiliary=[("CONCENTRATION")], ) wellbottom = 0.0 wellradius = 0.01 @@ -153,9 +151,7 @@ def build_mf6gwf(sim_folder): auxiliary=["CONCENTRATION"], ) - packages = [ - ("maw-1",), - ] + packages = [("maw-1",)] perioddata = [ ("MAW-1", 1, "MAW-1", 2, "factor", 0.5), ("MAW-1", 1, "MAW-1", 3, "factor", 0.5), @@ -255,13 +251,12 @@ def build_mf6gwt(sim_folder): concentrationprintrecord=[ ("COLUMNS", ncol, "WIDTH", 15, "DIGITS", 6, "GENERAL") ], - saverecord=[("CONCENTRATION", "ALL")], + saverecord=[ + ("CONCENTRATION", "ALL"), + ], printrecord=[ ("CONCENTRATION", "ALL"), - ( - "BUDGET", - "ALL", - ), + ("BUDGET", "ALL"), ], ) return sim @@ -301,8 +296,8 @@ def build_mf2005(sim_folder): [0, 15, 15, q], # injection [0, 15, 20, -q], # extraction [0, 4, 15, 0.5 * q], # reinjection - [0, 26, 15, 0.5 * q], - ] # reinjection + [0, 26, 15, 0.5 * q], # reinjection + ] wel = flopy.modflow.ModflowWel(mf, stress_period_data=welspd) return mf diff --git a/scripts/ex-gwt-prudic2004t2.py b/scripts/ex-gwt-prudic2004t2.py index c282303d..43fff155 100644 --- a/scripts/ex-gwt-prudic2004t2.py +++ b/scripts/ex-gwt-prudic2004t2.py @@ -256,30 +256,16 @@ def build_mf6gwf(sim_folder): ll = line.strip().split() if len(ll) == 4: k, i, j, hd = ll - chdlist.append( - [ - ( - int(k) - 1, - int(i) - 1, - int(j) - 1, - ), - float(hd), - ] - ) + chdlist.append([(int(k) - 1, int(i) - 1, int(j) - 1), float(hd)]) flopy.mf6.ModflowGwfchd(gwf, stress_period_data=chdlist, pname="CHD-1") idomain = dis.idomain.array lake_map = np.ones((nlay, nrow, ncol), dtype=np.int32) * -1 lake_map[0, :, :] = lakibd[:, :] - 1 - ( - idomain, - lakepakdata_dict, - lakeconnectiondata, - ) = flopy.mf6.utils.get_lak_connections( - gwf.modelgrid, - lake_map, - idomain=idomain, - bedleak=lakebed_leakance, + (idomain, lakepakdata_dict, lakeconnectiondata) = ( + flopy.mf6.utils.get_lak_connections( + gwf.modelgrid, lake_map, idomain=idomain, bedleak=lakebed_leakance + ) ) gwf.dis.idomain.set_data(idomain[0], layer=0, multiplier=[1]) diff --git a/scripts/ex-gwt-rotate.py b/scripts/ex-gwt-rotate.py index 895004ad..08dcc991 100644 --- a/scripts/ex-gwt-rotate.py +++ b/scripts/ex-gwt-rotate.py @@ -423,10 +423,7 @@ def plot_conc(sim, idx): times = np.array(times) # plot times in the original publication - plot_times = [ - 2000.0, - 10000.0, - ] + plot_times = [2000.0, 10000.0] nplots = len(plot_times) for iplot in range(nplots): diff --git a/scripts/ex-gwt-stallman.py b/scripts/ex-gwt-stallman.py index 78ec477c..f905eaec 100644 --- a/scripts/ex-gwt-stallman.py +++ b/scripts/ex-gwt-stallman.py @@ -184,10 +184,7 @@ def build_models(sim_folder): flopy.mf6.ModflowGwfic(gwf, strt=top) - flopy.mf6.ModflowGwfchd( - gwf, - stress_period_data=chd_mf6, - ) + flopy.mf6.ModflowGwfchd(gwf, stress_period_data=chd_mf6) head_filerecord = f"{name}.hds" budget_filerecord = f"{name}.bud" @@ -237,10 +234,7 @@ def build_models(sim_folder): flopy.mf6.ModflowGwtadv(gwt, scheme="TVD") flopy.mf6.ModflowGwtdsp(gwt, xt3d_off=True, alh=alphal, ath1=alphat, diffc=diffc) flopy.mf6.ModflowGwtssm(gwt, sources=[[]]) - flopy.mf6.ModflowGwtcnc( - gwt, - stress_period_data=cnc_mf6, - ) + flopy.mf6.ModflowGwtcnc(gwt, stress_period_data=cnc_mf6) flopy.mf6.ModflowGwtoc( gwt, budget_filerecord=f"{gwt.name}.cbc", @@ -322,11 +316,7 @@ def plot_conc(sim, idx): # configure plot and save ax.plot(zconc, zbotm, "bo", mfc="none", label="MODFLOW6-GWT") ax.plot( - zanal[:, 1], - zanal[:, 0], - "k--", - linewidth=1.0, - label="Analytical solution", + zanal[:, 1], zanal[:, 0], "k--", linewidth=1.0, label="Analytical solution" ) ax.set_xlim(T_az - dT, T_az + dT) ax.set_ylim(-top, 0) diff --git a/scripts/ex-gwt-synthetic-valley.py b/scripts/ex-gwt-synthetic-valley.py index dc0bae90..161e986c 100644 --- a/scripts/ex-gwt-synthetic-valley.py +++ b/scripts/ex-gwt-synthetic-valley.py @@ -208,20 +208,12 @@ def circle_function(center=(0, 0), radius=1.0, dtheta=10.0): # create the voronoi grid temp_path = pl.Path("temp/triangle_data") temp_path.mkdir(parents=True, exist_ok=True) -tri = Triangle( - angle=30, - nodes=sg_densify, - model_ws=temp_path, -) +tri = Triangle(angle=30, nodes=sg_densify, model_ws=temp_path) tri.add_polygon(bp_densify) tri.add_polygon(rb_densify) tri.add_polygon(lp_densify) tri.add_region((10, 10), attribute=10, maximum_area=max_boundary_area) -tri.add_region( - (3050.0, 3050.0), - attribute=10, - maximum_area=max_boundary_area, -) +tri.add_region((3050.0, 3050.0), attribute=10, maximum_area=max_boundary_area) tri.add_region((900.0, 4600.0), attribute=11, maximum_area=max_lake_area) tri.add_region((1200.0, 150.0), attribute=10, maximum_area=max_river_area) for idx, w in enumerate(wp): @@ -302,34 +294,18 @@ def circle_function(center=(0, 0), radius=1.0, dtheta=10.0): # + # intersect the rasters with the vertex grid top_vg = top_base.resample_to_grid( - voronoi_grid, - band=top_base.bands[0], - method="linear", - extrapolate_edges=True, + voronoi_grid, band=top_base.bands[0], method="linear", extrapolate_edges=True ) bot_vg = bot.resample_to_grid( - voronoi_grid, - band=bot.bands[0], - method="linear", - extrapolate_edges=True, + voronoi_grid, band=bot.bands[0], method="linear", extrapolate_edges=True ) lake_cells_vg = lake_location.resample_to_grid( - voronoi_grid, - band=lake_location.bands[0], - method="nearest", - extrapolate_edges=True, + voronoi_grid, band=lake_location.bands[0], method="nearest", extrapolate_edges=True ) kaq_vg = kaq.resample_to_grid( - voronoi_grid, - band=kaq.bands[0], - method="nearest", - extrapolate_edges=True, -) -kclay_vg = kclay.resample_to_grid( - voronoi_grid, - band=kclay.bands[0], - method="nearest", + voronoi_grid, band=kaq.bands[0], method="nearest", extrapolate_edges=True ) +kclay_vg = kclay.resample_to_grid(voronoi_grid, band=kclay.bands[0], method="nearest") # - # + @@ -402,10 +378,7 @@ def circle_function(center=(0, 0), radius=1.0, dtheta=10.0): sfrpak_data.append( ( idx, - ( - 0, - cellid, - ), + (0, cellid), rlen, sfr_width, -sfr_slope, @@ -432,9 +405,7 @@ def circle_function(center=(0, 0), radius=1.0, dtheta=10.0): lake_map[idx] = 0 (idomain, lakpak_dict, lak_connections) = flopy.mf6.utils.get_lak_connections( - voronoi_grid, - lake_map, - bedleak=lake_bedleak, + voronoi_grid, lake_map, bedleak=lake_bedleak ) # add concentration to lake data as aux @@ -600,10 +571,7 @@ def build_mf6gwt(sim_folder): complexity="simple", linear_acceleration="bicgstab", ) - gwt = flopy.mf6.ModflowGwt( - sim, - modelname=name, - ) + gwt = flopy.mf6.ModflowGwt(sim, modelname=name) dis = flopy.mf6.ModflowGwtdisv( gwt, length_units="meters", @@ -617,10 +585,7 @@ def build_mf6gwt(sim_folder): idomain=[1, 1, idomain_2, 1, 1, 1], ) ic = flopy.mf6.ModflowGwtic(gwt, strt=0.0) - adv = flopy.mf6.ModflowGwtadv( - gwt, - scheme="tvd", - ) + adv = flopy.mf6.ModflowGwtadv(gwt, scheme="tvd") dsp = flopy.mf6.ModflowGwtdsp( gwt, diffc=0.0e-12, @@ -651,9 +616,7 @@ def build_mf6gwt(sim_folder): oc = flopy.mf6.ModflowGwtoc( gwt, concentration_filerecord=f"{name}.ucn", - saverecord=[ - ("CONCENTRATION", "LAST"), - ], + saverecord=[("CONCENTRATION", "LAST")], printrecord=[("BUDGET", "ALL")], ) return sim @@ -721,21 +684,10 @@ def run_models(sims, silent=True): "color": contour_color, "linestyle": contour_style, } -clabel_dict = { - "inline": True, - "fmt": "%1.0f", - "fontsize": 6, - "inline_spacing": 0.5, -} +clabel_dict = {"inline": True, "fmt": "%1.0f", "fontsize": 6, "inline_spacing": 0.5} font_dict = {"fontsize": 5, "color": "black"} grid_dict = {"lw": 0.25, "color": "0.5"} -arrowprops = dict( - arrowstyle="-", - edgecolor="red", - lw=0.5, - shrinkA=0.15, - shrinkB=0.15, -) +arrowprops = dict(arrowstyle="-", edgecolor="red", lw=0.5, shrinkA=0.15, shrinkB=0.15) river_dict = {"color": "blue", "linestyle": "-", "linewidth": 1} lake_cmap = colors.ListedColormap(["cyan"]) clay_cmap = colors.ListedColormap(["brown"]) @@ -870,22 +822,8 @@ def plot_river_mapping(sims, idx): ax = ax0 ax.set_aspect("equal", "box") mm = flopy.plot.PlotMapView(modelgrid=voronoi_grid, ax=ax) - mm.plot_array( - kclay_loc_vg, - masked_values=[ - 0, - ], - cmap=clay_cmap, - alpha=0.5, - ) - mm.plot_array( - lake_cells_vg, - masked_values=[ - 0, - ], - cmap=lake_cmap, - alpha=0.5, - ) + mm.plot_array(kclay_loc_vg, masked_values=[0], cmap=clay_cmap, alpha=0.5) + mm.plot_array(lake_cells_vg, masked_values=[0], cmap=lake_cmap, alpha=0.5) mm.plot_grid(**grid_dict) plot_river(ax) plot_wells(ax, ms=3) @@ -1001,51 +939,27 @@ def plot_head_results(sims, idx): # topography ax = ax0 styles.heading(ax=ax, idx=0) - mm = flopy.plot.PlotMapView( - model=gwf, - ax=ax, - extent=voronoi_grid.extent, - ) + mm = flopy.plot.PlotMapView(model=gwf, ax=ax, extent=voronoi_grid.extent) cb = mm.plot_array(top_vg, vmin=top_range[0], vmax=top_range[1]) mm.plot_grid(**grid_dict) plot_wells(ax=ax, ms=3) plot_river(ax=ax) plot_lake(ax=ax) - cs = mm.contour_array( - top_vg, - **sv_contour_dict, - levels=top_levels, - ) - ax.clabel( - cs, - **clabel_dict, - ) + cs = mm.contour_array(top_vg, **sv_contour_dict, levels=top_levels) + ax.clabel(cs, **clabel_dict) set_ticklabels(ax, fmt="{:.0f}") # topography colorbar cbar = plt.colorbar(cb, ax=ax, orientation="horizontal", shrink=0.65) cbar.ax.tick_params( - labelsize=5, - labelcolor="black", - color="black", - length=6, - pad=2, - ) - cbar.ax.set_title( - "Elevation (m)", - pad=2.5, - loc="left", - fontdict=font_dict, + labelsize=5, labelcolor="black", color="black", length=6, pad=2 ) + cbar.ax.set_title("Elevation (m)", pad=2.5, loc="left", fontdict=font_dict) # head ax = ax1 styles.heading(ax=ax, idx=1) - mm = flopy.plot.PlotMapView( - model=gwf, - ax=ax, - extent=voronoi_grid.extent, - ) + mm = flopy.plot.PlotMapView(model=gwf, ax=ax, extent=voronoi_grid.extent) cb = mm.plot_array(head, vmin=head_range[0], vmax=head_range[1]) mm.plot_grid(**grid_dict) @@ -1065,32 +979,16 @@ def plot_head_results(sims, idx): plot_wells(ax=ax, ms=3) plot_river(ax=ax) plot_lake(ax=ax) - cs = mm.contour_array( - head, - **sv_contour_dict, - levels=head_levels, - ) - ax.clabel( - cs, - **clabel_dict, - ) + cs = mm.contour_array(head, **sv_contour_dict, levels=head_levels) + ax.clabel(cs, **clabel_dict) set_ticklabels(ax, fmt="{:.0f}", xticks=xticks, yticks=yticks) # head colorbar cbar = plt.colorbar(cb, ax=ax, orientation="horizontal", shrink=0.65) cbar.ax.tick_params( - labelsize=5, - labelcolor="black", - color="black", - length=6, - pad=2, - ) - cbar.ax.set_title( - "Head (m)", - pad=2.5, - loc="left", - fontdict=font_dict, + labelsize=5, labelcolor="black", color="black", length=6, pad=2 ) + cbar.ax.set_title("Head (m)", pad=2.5, loc="left", fontdict=font_dict) # legend ax = ax2 @@ -1158,10 +1056,7 @@ def plot_conc_results(sims): ax = axs[k] ax.set_title(f"Layer {k + 1}") mm = flopy.plot.PlotMapView( - model=gwt, - ax=ax, - extent=gwt.modelgrid.extent, - layer=k, + model=gwt, ax=ax, extent=gwt.modelgrid.extent, layer=k ) xticks = np.arange(extent[0], extent[1], 1000.0).tolist() @@ -1172,12 +1067,7 @@ def plot_conc_results(sims): # plot confining unit if k == 2: mm.plot_array( - kclay_loc_vg, - masked_values=[ - 0, - ], - cmap=clay_cmap, - alpha=0.5, + kclay_loc_vg, masked_values=[0], cmap=clay_cmap, alpha=0.5 ) plot_river(ax=ax) plot_lake(ax=ax) @@ -1191,13 +1081,7 @@ def plot_conc_results(sims): **sv_gwt_contour_dict, ) - ax.clabel( - cs, - inline=True, - fmt="%1.3g", - fontsize=6, - inline_spacing=0.5, - ) + ax.clabel(cs, inline=True, fmt="%1.3g", fontsize=6, inline_spacing=0.5) set_ticklabels(ax, fmt="{:.0f}", xticks=xticks, yticks=yticks) diff --git a/scripts/ex-gwt-uzt-2d.py b/scripts/ex-gwt-uzt-2d.py index 638b7fe7..90bbcd3a 100644 --- a/scripts/ex-gwt-uzt-2d.py +++ b/scripts/ex-gwt-uzt-2d.py @@ -237,18 +237,7 @@ if k == nlay - 1: ivertcon = -1 # [] - uz = [ - iuzno, - (k, 0, j), - lflag, - ivertcon, - surfdep, - vk, - thtr, - thts, - thti, - eps, - ] + uz = [iuzno, (k, 0, j), lflag, ivertcon, surfdep, vk, thtr, thts, thti, eps] packagedata.append(uz) # now some transport book keeping @@ -938,10 +927,7 @@ def plot_results(mf2k5, mt3d, mf6, idx, ax=None): if plot_show: plt.show() if plot_save: - fpth = figs_path / "{}{}".format( - sim_name, - ".png", - ) + fpth = figs_path / "{}{}".format(sim_name, ".png") fig.savefig(fpth) diff --git a/scripts/ex-prt-mp7-p01.py b/scripts/ex-prt-mp7-p01.py index 13064186..e8649ac0 100644 --- a/scripts/ex-prt-mp7-p01.py +++ b/scripts/ex-prt-mp7-p01.py @@ -330,9 +330,7 @@ def build_models(example_name): filename=f"{prt_name}_1a.prp", nreleasepts=len(releasepts_1a), packagedata=releasepts_1a, - perioddata={ - 0: ["FIRST"], - }, + perioddata={0: ["FIRST"]}, exit_solve_tolerance=1e-5, extend_tracking=True, ) @@ -346,9 +344,7 @@ def build_models(example_name): filename=f"{prt_name}_1b.prp", nreleasepts=len(releasepts_1b), packagedata=releasepts_1b, - perioddata={ - 0: ["FIRST"], - }, + perioddata={0: ["FIRST"]}, exit_solve_tolerance=1e-10, extend_tracking=True, ) @@ -610,13 +606,7 @@ def plot_points(ax, gwf, data, **kwargs): label = "Captured by " + dest pdata = data[data.dest == dest] pts.append( - ax.scatter( - pdata["x"], - pdata["y"], - s=3, - color=color, - label=label, - ) + ax.scatter(pdata["x"], pdata["y"], s=3, color=color, label=label) ) return pts else: diff --git a/scripts/ex-prt-mp7-p02.py b/scripts/ex-prt-mp7-p02.py index d0ddf6d8..9fc31507 100644 --- a/scripts/ex-prt-mp7-p02.py +++ b/scripts/ex-prt-mp7-p02.py @@ -676,13 +676,7 @@ def get_mp7_timeseries(path, gwf_model): mp7ts.set_index(["particlegroup", "particleid"], drop=False, inplace=True) # convert indices to 1-based (flopy converts them to 0-based, but PRT uses 1-based, so do the same for consistency) - kijnames = [ - "k", - "node", - "particleid", - "particlegroup", - "particleidloc", - ] + kijnames = ["k", "node", "particleid", "particlegroup", "particleidloc"] for n in kijnames: mp7ts[n] += 1 @@ -728,13 +722,7 @@ def get_mp7_endpoints(path, gwf_model): mp7ep.set_index(["particlegroup", "particleid"], drop=False, inplace=True) # convert indices to 1-based (flopy converts them to 0-based, but PRT uses 1-based, so do the same for consistency) - kijnames = [ - "k", - "node", - "particleid", - "particlegroup", - "particleidloc", - ] + kijnames = ["k", "node", "particleid", "particlegroup", "particleidloc"] for n in kijnames: mp7ep[n] += 1 @@ -778,12 +766,7 @@ def get_mp7_endpoints(path, gwf_model): # + # colormap for boundary locations -cmapbd = mpl.colors.ListedColormap( - [ - "r", - "g", - ] -) +cmapbd = mpl.colors.ListedColormap(["r", "g"]) # time series point colors by layer colors = ["green", "orange", "red"] @@ -914,12 +897,7 @@ def plot_points(ax, gwf, data): ax.set_aspect("equal") mm = flopy.plot.PlotMapView(model=gwf, ax=ax) mm.plot_grid(alpha=0.25) - return ax.scatter( - data["x"], - data["y"], - color=data["mc"], - s=3, - ) + return ax.scatter(data["x"], data["y"], color=data["mc"], s=3) def plot_tracks( diff --git a/scripts/ex-prt-mp7-p03.py b/scripts/ex-prt-mp7-p03.py index 09a70826..f66b34ca 100644 --- a/scripts/ex-prt-mp7-p03.py +++ b/scripts/ex-prt-mp7-p03.py @@ -534,13 +534,7 @@ def get_mf6_pathlines(path): pl.reset_index(drop=True, inplace=True) # convert indices to 0-based - for n in [ - "imdl", - "iprp", - "irpt", - "ilay", - "icell", - ]: + for n in ["imdl", "iprp", "irpt", "ilay", "icell"]: pl[n] -= 1 return pl @@ -622,13 +616,7 @@ def plot_points(fig, ax, gwf, data, colorbar=True, **kwargs): label = "Captured by " + dest pdata = data[data.dest == dest] pts.append( - ax.scatter( - pdata["x"], - pdata["y"], - s=3, - color=color, - label=label, - ) + ax.scatter(pdata["x"], pdata["y"], s=3, color=color, label=label) ) return pts else: @@ -917,15 +905,9 @@ def plot_all(gwfsim): # plot the results plot_head(gwf, head=head) - plot_pathpoints( - gwf, - mf6pathlines, - title="2000-day points, colored by travel time", - ) + plot_pathpoints(gwf, mf6pathlines, title="2000-day points, colored by travel time") plot_pathpoints_3d( - gwf, - mf6pathlines, - title="Pathlines, 2000-day points,\ncolored by destination", + gwf, mf6pathlines, title="Pathlines, 2000-day points,\ncolored by destination" ) plot_endpoints( gwf, diff --git a/scripts/ex-prt-mp7-p04.py b/scripts/ex-prt-mp7-p04.py index e775548e..7c3d290f 100644 --- a/scripts/ex-prt-mp7-p04.py +++ b/scripts/ex-prt-mp7-p04.py @@ -586,9 +586,7 @@ def build_prt(): filename="{}_4.prp".format(prt_name), nreleasepts=len(particles_prt), packagedata=particles_prt, - perioddata={ - 0: ["FIRST"], - }, + perioddata={0: ["FIRST"]}, exit_solve_tolerance=1e-5, extend_tracking=True, ) @@ -640,10 +638,7 @@ def build_mp7(gwf): exe_name="mp7", model_ws=mp7_ws, ) - mpbas = flopy.modpath.Modpath7Bas( - mp, - porosity=porosity, - ) + mpbas = flopy.modpath.Modpath7Bas(mp, porosity=porosity) mpsim = flopy.modpath.Modpath7Sim( mp, simulationtype="pathline", @@ -940,12 +935,7 @@ def plot_all(gwf): ) plot_grid(gwf, title="Model grid and boundary conditions") - plot_all_pathlines( - grid, - hds, - prt_pl, - title="Head and pathlines", - ) + plot_all_pathlines(grid, hds, prt_pl, title="Head and pathlines") # - diff --git a/scripts/process-scripts.py b/scripts/process-scripts.py index 00d2b29d..93bc5e27 100644 --- a/scripts/process-scripts.py +++ b/scripts/process-scripts.py @@ -79,30 +79,14 @@ def _replace_quotes(proc_str): def table_standard_header(caption, label): - col_widths = ( - 0.5, - 0.3, - ) - headings = ( - "Parameter", - "Value", - ) + col_widths = (0.5, 0.3) + headings = ("Parameter", "Value") return get_header(caption, label, headings, col_widths=col_widths, center=False) def table_scenario_header(caption, label): - col_widths = ( - 0.1, - 0.25, - 0.3, - 0.15, - ) - headings = ( - "Scenario", - "Scenario Name", - "Parameter", - "Value", - ) + col_widths = (0.1, 0.25, 0.3, 0.15) + headings = ("Scenario", "Scenario Name", "Parameter", "Value") return get_header(caption, label, headings, col_widths=col_widths, center=False) @@ -641,13 +625,7 @@ def build_tex_tables(ex_dict): "Grid \\newline Dimensions", "Packages", ) - col_widths = ( - 0.10, - 0.22, - 0.25, - 0.15, - 0.28, - ) + col_widths = (0.10, 0.22, 0.25, 0.15, 0.28) caption = "List of example problems and simulation characteristics." label = "tab:ex-table" @@ -655,13 +633,7 @@ def build_tex_tables(ex_dict): on_ex = 0 for idx, (key, sim_dict) in enumerate(ex_tex.items()): - for jdx, ( - ex_number, - namefile, - dimensions, - model_paks, - sim_paks, - ) in enumerate( + for jdx, (ex_number, namefile, dimensions, model_paks, sim_paks) in enumerate( zip( sim_dict["ex_number"], sim_dict["namefiles"],