xugrid.Ugrid2d.earcut_triangulate_polygons#

static Ugrid2d.earcut_triangulate_polygons(polygons, return_index: bool = False)[source]#

Break down polygons using mapbox_earcut, and create a mesh from the resulting triangles.

Parameters:
  • polygons (ndarray of shapely polygons)

  • return_index (bool, default is False.)

Returns:

  • grid (xugrid.Ugrid2d)

  • index (ndarray of integer, optional) – The polygon index for each triangle. Only provided if return_index is True.