Skip to content

Commit

Permalink
update(cross_section_set_contour_arrays): updates for single layer un…
Browse files Browse the repository at this point in the history
…structured and vertex model contouring (#1155)

Closes #1154
  • Loading branch information
jlarsen-usgs authored Jul 21, 2021
1 parent e2a64d0 commit 78b513a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion flopy/discretization/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def cross_section_set_contour_arrays(
plotarray, xcenter array, ycenter array, and a boolean flag
for contouring
"""
if self.nlay != 1:
if self.ncpl != self.nnodes:
return plotarray, xcenters, None, False
else:
zcenters = []
Expand Down
27 changes: 26 additions & 1 deletion flopy/discretization/unstructuredgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,32 @@ def cross_section_set_contour_arrays(
plotarray, xcenter array, ycenter array, and a boolean flag
for contouring
"""
return plotarray, xcenters, None, False
if self.ncpl[0] != self.nnodes:
return plotarray, xcenters, None, False
else:
zcenters = []
if isinstance(head, np.ndarray):
head = head.reshape(1, self.nnodes)
head = np.vstack((head, head))
else:
head = elev.reshape(2, self.nnodes)

elev = elev.reshape(2, self.nnodes)
for k, ev in enumerate(elev):
if k == 0:
zc = [
ev[i] if head[k][i] > ev[i] else head[k][i]
for i in sorted(projpts)
]
else:
zc = [ev[i] for i in sorted(projpts)]
zcenters.append(zc)

plotarray = np.vstack((plotarray, plotarray))
xcenters = np.vstack((xcenters, xcenters))
zcenters = np.array(zcenters)

return plotarray, xcenters, zcenters, True

@property
def map_polygons(self):
Expand Down

0 comments on commit 78b513a

Please sign in to comment.