Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reformat multi-line statements #234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions scripts/ex-gwe-ates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions scripts/ex-gwe-barends.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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")]},
)
Expand Down
24 changes: 5 additions & 19 deletions scripts/ex-gwe-geotherm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
47 changes: 9 additions & 38 deletions scripts/ex-gwe-prt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"])
Expand Down
33 changes: 9 additions & 24 deletions scripts/ex-gwe-radial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand All @@ -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"],
Expand Down
6 changes: 1 addition & 5 deletions scripts/ex-gwe-vsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
41 changes: 6 additions & 35 deletions scripts/ex-gwf-advtidal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)")
Expand Down
Loading