From 5a8e68fcda7cabe8d4e028ba6c905ae4f84448d6 Mon Sep 17 00:00:00 2001 From: Joshua Larsen Date: Thu, 8 Sep 2022 10:50:03 -0700 Subject: [PATCH] fix(PlotCrossSection): update number of points check (#1533) * fix(PlotCrossSection): update number of points check * update to check n points instead of n cells intersected * linting --- flopy/plot/crosssection.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/flopy/plot/crosssection.py b/flopy/plot/crosssection.py index 8558f8b35..15ed74de3 100644 --- a/flopy/plot/crosssection.py +++ b/flopy/plot/crosssection.py @@ -179,10 +179,14 @@ def __init__( ) if len(self.xypts) < 2: - s = "cross-section cannot be created\n." - s += " less than 2 points intersect the model grid\n" - s += f" {len(self.xypts)} points intersect the grid." - raise Exception(s) + if len(list(self.xypts.values())[0]) < 2: + s = ( + "cross-section cannot be created\n." + " less than 2 points intersect the model grid\n" + f" {len(self.xypts.values()[0])} points" + " intersect the grid." + ) + raise Exception(s) if self.geographic_coords: # transform back to geographic coordinates