From d434c61afbc7c6115b3e7433f1cf4422724f12c4 Mon Sep 17 00:00:00 2001 From: Christian Langevin Date: Fri, 1 Oct 2021 15:01:20 -0500 Subject: [PATCH 1/2] ci(voronoi): test script was not running --- ...{t075_ugridtests.py => t075_test_ugrid.py} | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) rename autotest/{t075_ugridtests.py => t075_test_ugrid.py} (95%) diff --git a/autotest/t075_ugridtests.py b/autotest/t075_test_ugrid.py similarity index 95% rename from autotest/t075_ugridtests.py rename to autotest/t075_test_ugrid.py index 14fecb01eb..830546e324 100644 --- a/autotest/t075_ugridtests.py +++ b/autotest/t075_test_ugrid.py @@ -291,9 +291,10 @@ def test_voronoi_grid0(plot=False): vor = VoronoiGrid(tri) gridprops = vor.get_gridprops_vertexgrid() + ncpl = gridprops["ncpl"] assert ( - gridprops["ncpl"] == answer_ncpl - ), "Number of cells should be {answer_ncpl}" + ncpl == answer_ncpl + ), f"Number of cells should be {answer_ncpl}. Found {ncpl}" voronoi_grid = VertexGrid(**gridprops, nlay=1) @@ -326,9 +327,10 @@ def test_voronoi_grid1(plot=False): vor = VoronoiGrid(tri) gridprops = vor.get_gridprops_vertexgrid() voronoi_grid = VertexGrid(**gridprops, nlay=1) + ncpl = gridprops["ncpl"] assert ( - gridprops["ncpl"] == answer_ncpl - ), "Number of cells should be {answer_ncpl}" + ncpl == answer_ncpl + ), f"Number of cells should be {answer_ncpl}. Found {ncpl}" if plot: import matplotlib.pyplot as plt @@ -358,9 +360,10 @@ def test_voronoi_grid2(plot=False): vor = VoronoiGrid(tri) gridprops = vor.get_gridprops_vertexgrid() voronoi_grid = VertexGrid(**gridprops, nlay=1) + ncpl = gridprops["ncpl"] assert ( - gridprops["ncpl"] == answer_ncpl - ), "Number of cells should be {answer_ncpl}" + ncpl == answer_ncpl + ), f"Number of cells should be {answer_ncpl}. Found {ncpl}" if plot: import matplotlib.pyplot as plt @@ -400,9 +403,10 @@ def test_voronoi_grid3(plot=False): vor = VoronoiGrid(tri) gridprops = vor.get_gridprops_vertexgrid() voronoi_grid = VertexGrid(**gridprops, nlay=1) + ncpl = gridprops["ncpl"] assert ( - gridprops["ncpl"] == answer_ncpl - ), "Number of cells should be {answer_ncpl}" + ncpl == answer_ncpl + ), f"Number of cells should be {answer_ncpl}. Found {ncpl}" if plot: import matplotlib.pyplot as plt @@ -435,9 +439,10 @@ def test_voronoi_grid4(plot=False): vor = VoronoiGrid(tri) gridprops = vor.get_gridprops_vertexgrid() voronoi_grid = VertexGrid(**gridprops, nlay=1) + ncpl = gridprops["ncpl"] assert ( - gridprops["ncpl"] == answer_ncpl - ), "Number of cells should be {answer_ncpl}" + ncpl == answer_ncpl + ), f"Number of cells should be {answer_ncpl}. Found {ncpl}" if plot: import matplotlib.pyplot as plt @@ -498,9 +503,10 @@ def test_voronoi_grid5(plot=False): vor = VoronoiGrid(tri) gridprops = vor.get_gridprops_vertexgrid() voronoi_grid = VertexGrid(**gridprops, nlay=1) + ncpl = gridprops["ncpl"] assert ( - gridprops["ncpl"] == answer_ncpl - ), "Number of cells should be {answer_ncpl}" + ncpl == answer_ncpl + ), f"Number of cells should be {answer_ncpl}. Found {ncpl}" if plot: import matplotlib.pyplot as plt From 35b96f6884ff615633fd52c93c7efe0dc8487015 Mon Sep 17 00:00:00 2001 From: Christian Langevin Date: Fri, 1 Oct 2021 15:54:07 -0500 Subject: [PATCH 2/2] changed voronoi tests --- autotest/t075_test_ugrid.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autotest/t075_test_ugrid.py b/autotest/t075_test_ugrid.py index 830546e324..55f96c9a8a 100644 --- a/autotest/t075_test_ugrid.py +++ b/autotest/t075_test_ugrid.py @@ -347,13 +347,13 @@ def test_voronoi_grid1(plot=False): def test_voronoi_grid2(plot=False): name = "vor2" - answer_ncpl = 5058 + answer_ncpl = 538 theta = np.arange(0.0, 2 * np.pi, 0.2) radius = 100.0 x = radius * np.cos(theta) y = radius * np.sin(theta) circle_poly = [(x, y) for x, y in zip(x, y)] - tri = Triangle(maximum_area=5, angle=30, model_ws=tpth) + tri = Triangle(maximum_area=50, angle=30, model_ws=tpth) tri.add_polygon(circle_poly) tri.build(verbose=False) @@ -380,7 +380,7 @@ def test_voronoi_grid2(plot=False): def test_voronoi_grid3(plot=False): name = "vor3" - answer_ncpl = 2375 + answer_ncpl = 300 theta = np.arange(0.0, 2 * np.pi, 0.2) radius = 100.0 @@ -394,7 +394,7 @@ def test_voronoi_grid3(plot=False): y = radius * np.sin(theta) + 25.0 inner_circle_poly = [(x, y) for x, y in zip(x, y)] - tri = Triangle(maximum_area=10, angle=30, model_ws=tpth) + tri = Triangle(maximum_area=100, angle=30, model_ws=tpth) tri.add_polygon(circle_poly) tri.add_polygon(inner_circle_poly) tri.add_hole((25, 25))