Closed jlarsen-usgs closed 9 months ago
Hey @jlarsen-usgs, it makes sense that we should filter out these invalid cells. I think @wpbonelli also had a fix for the case where unnecessary vertices were placed along a cell edge. Would be great if you submitted a PR with this change. Would also be good in the future if we added some tests for these degenerate cases.
I'll submit a PR with this change today.
Describe the bug In certain cases such as fine triangular refinement the VoronoiGrid class creates modflow grid nodes that have either 1) empty iverts, 2) a single ivert (point feature), or 3) 2 iverts (line feature). While the VertexGrid class of FloPy can digest this information, it is invalid for geospatial processing such as raster resampling or creating GeoDataFrames
To Reproduce See the notebook Sagehen_structured_2_voronoi_workshop.ipynb
Additional context A simple check at the end of the
tri2vor
method resolves this issue. After the code that finds unique iverts and sorts them, a few lines of code can be added to check for nodes with less than 3 iverts, remove them, and remove their xy centers from tri.verts. Here is the proposed solution