From 78b513ab1e2e94403a55c8155865e5ad1a6ddf8f Mon Sep 17 00:00:00 2001 From: Joshua Larsen Date: Wed, 21 Jul 2021 10:37:25 -0700 Subject: [PATCH] update(cross_section_set_contour_arrays): updates for single layer unstructured and vertex model contouring (#1155) Closes #1154 --- flopy/discretization/grid.py | 2 +- flopy/discretization/unstructuredgrid.py | 27 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/flopy/discretization/grid.py b/flopy/discretization/grid.py index 56ba6578f7..9c4e72f9bf 100644 --- a/flopy/discretization/grid.py +++ b/flopy/discretization/grid.py @@ -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 = [] diff --git a/flopy/discretization/unstructuredgrid.py b/flopy/discretization/unstructuredgrid.py index 837561eda4..0df3829858 100644 --- a/flopy/discretization/unstructuredgrid.py +++ b/flopy/discretization/unstructuredgrid.py @@ -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):