xugrid.polygonize#

xugrid.polygonize(uda: UgridDataArray) gpd.GeoDataFrame[source]#

Polygonize a UgridDataArray.

This function creates vector polygons for all connected regions of cells (faces) in the Ugrid2d topology sharing a common value.

The produced polygon edges will follow exactly the cell boundaries. When the data consists of many unique values (e.g. unbinned elevation data), the result will essentially be one polygon per face. In such cases, it is much more efficient to use xugrid.UgridDataArray.to_geodataframe, which directly converts every cell to a polygon. This function is meant for data with relatively few unique values such as classification results.

Parameters:

uda (UgridDataArray) – The DataArray should only contain the face dimension. Additional dimensions, such as time, are not allowed.

Returns:

polygonized

Return type:

GeoDataFrame