Commit 8ac1be95 authored by Mike Bedington's avatar Mike Bedington

Extra option for get_boundary_polgons to make plotting easier

parent 6633a5ca
......@@ -4742,7 +4742,7 @@ def rotate_points(x, y, origin, angle):
return xr, yr
def get_boundary_polygons(triangle, noisy=False, nodes=None):
def get_boundary_polygons(triangle, noisy=False, nodes=None, double_start_end=False):
Gets a list of the grid boundary nodes ordered correctly.
......@@ -4754,11 +4754,12 @@ def get_boundary_polygons(triangle, noisy=False, nodes=None):
triangle : np.ndarray
The triangle connectivity matrix as produced by the read_fvcom_mesh
nodes : optional, np.ndarray
Optionally a Nx2 array of coordinates for nodes in the grid, if passed the function will
additionally return a boolean of whether the polygons are boundaries (domain on interior)
or islands (domain on the exterior)
double_start_end : optional, boolean
Optionally add the start point to the end of each boundary polygon; useful for plotting
......@@ -4804,6 +4805,11 @@ def get_boundary_polygons(triangle, noisy=False, nodes=None):
nodes_lt_4 = np.asarray(list(set(nodes_lt_4) - set(boundary_node_list)), dtype=int)
if double_start_end:
new_bp_list = []
for this_poly in boundary_polygon_list:
new_bp_list.append(np.append(this_poly, this_poly[0]))
boundary_polygon_list = new_bp_list
if nodes is None:
return boundary_polygon_list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment