Skip to content

Commit 0c6e466

Browse files
Added a default empty geometry list for mesh2d_get_mesh_boundaries as_polygons() (#223)
* set default value * simplify test again
1 parent f15b1f2 commit 0c6e466

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

meshkernel/meshkernel.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,8 @@ def get_splines(
11491149
return geometry_list_out
11501150

11511151
def mesh2d_get_mesh_boundaries_as_polygons(
1152-
self, geometry_list: GeometryList
1152+
self,
1153+
geometry_list: GeometryList = GeometryList(),
11531154
) -> GeometryList:
11541155
"""Retrieves the boundaries of a mesh as a series of separated polygons within the selecting polygon.
11551156
If the polygon is empty, all the mesh boundaries are retrieved.
@@ -1158,7 +1159,7 @@ def mesh2d_get_mesh_boundaries_as_polygons(
11581159
one for the inner boundary and one for the outer boundary.
11591160
11601161
Args:
1161-
geometry_list (GeometryList): The selecting polygon.
1162+
geometry_list (GeometryList, optional): The selecting polygon.
11621163
11631164
Returns:
11641165
GeometryList: The output network boundary polygon.

tests/test_mesh2d_basics.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,12 +1121,7 @@ def test_mesh2d_get_mesh_boundaries_as_polygons(meshkernel_with_mesh2d: MeshKern
11211121

11221122
mk = meshkernel_with_mesh2d(2, 2)
11231123

1124-
# Create an empty polygon for selecting all boundaries
1125-
x_coordinates = np.empty(0, dtype=np.double)
1126-
y_coordinates = np.empty(0, dtype=np.double)
1127-
geometry_list_in = GeometryList(x_coordinates, y_coordinates)
1128-
1129-
mesh_boundary = mk.mesh2d_get_mesh_boundaries_as_polygons(geometry_list_in)
1124+
mesh_boundary = mk.mesh2d_get_mesh_boundaries_as_polygons()
11301125

11311126
assert_array_equal(
11321127
mesh_boundary.x_coordinates,

0 commit comments

Comments
 (0)