Skip to content

Commit f2fe1d8

Browse files
authored
test(prt): support structured grids in plot util function (MODFLOW-ORG#2130)
The utility function only supported unstructured grids.
1 parent 5f49a19 commit f2fe1d8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

autotest/prt_test_utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,17 @@ def plot_nodes_and_vertices(
391391

392392
# plot nodes
393393
xc, yc = mg.get_xcellcenters_for_layer(0), mg.get_ycellcenters_for_layer(0)
394-
for i in range(ncpl):
395-
x, y = xc[i], yc[i]
396-
ax.plot(x, y, "o", color="grey", alpha=0.5)
397-
ax.annotate(str(i + 1), (x, y), color="grey", alpha=0.5)
394+
if mg.grid_type == "structured":
395+
ids = mg.get_lrc(range(mg.ncpl))
396+
for _, i, j in ids:
397+
x, y = xc[i], yc[i]
398+
ax.plot(x, y, "o", color="grey", alpha=0.5)
399+
ax.annotate(f"{i + 1}, {j + 1}", (x, y), color="grey", alpha=0.5)
400+
else:
401+
for i in range(mg.ncpl):
402+
x, y = xc[i], yc[i]
403+
ax.plot(x, y, "o", color="grey", alpha=0.5)
404+
ax.annotate(str(i + 1), (x, y), color="grey", alpha=0.5)
398405

399406
# create legend
400407
ax.legend(

0 commit comments

Comments
 (0)