Replies: 1 comment 5 replies
-
FloPy supports three different types of model grid objects to varying degrees. These grids are StructuredGrid, VertexGrid, and UnstructuredGrid. These model grids are typically created under-the-hood by flopy when you create a model. StructuredGrid corresponds to a DIS-type MODFLOW grid and is well supported throughout flopy. VertexGrid corresponds to a DISV-type MODFLOW grid in which the mesh is the same for all layers. A VertexGrid should be supported by the grid intersect classes. The DISU-type UnstructuredGrid object is probably the least well supported, though support has been improving. I suspect you are using the DISU UnstructuredGrid. If so, you might be able to create a separate VertexGrid object for your model (by instantiating a VertexGrid object manually) and use it for the intersects. We plan to continue to add better support for DISU unstructured grids, but the flexibility to change the mesh by layer, or not use layers at all, poses some challenges for full support. |
Beta Was this translation helpful? Give feedback.
-
I am trying to intersect an unstructured grid with one or more polygons. I see there is a GridIntersect class in flopy.utils which should do the job nicely (and with a min_area_fraction). However it seems not to have been implemented for unstructured grids (see error below). Is this correct? And is it something that can easily be included? I can achieve the same thing using geopandas sjoin, but need extra steps to select nodes by a minimum area fraction. Intersecting straight from the grid object would be more efficient, but its not a show-stopper. Thanks.
NotImplementedError Traceback (most recent call last)
NotImplementedError Traceback (most recent call last)
Cell In[14], line 2
1 # Create the GridIntersect class for our modelgrid
----> 2 ix = GridIntersect(grid, method = 'vertex')
File ~\anaconda3\lib\site-packages\flopy\utils\gridintersect.py:179, in GridIntersect.init(self, mfgrid, method, rtree, local)
174 self.rtree = rtree
176 # really only necessary for method=='vertex' as structured methods
177 # do not require a full list of shapely geometries, but useful to be
178 # able to obtain the grid shapes nonetheless
--> 179 self._set_method_get_gridshapes()
181 if self.method == "vertex":
182 # build arrays of geoms and cellids
183 self.geoms, self.cellids = self._get_gridshapes()
File ~\anaconda3\lib\site-packages\flopy\utils\gridintersect.py:345, in GridIntersect._set_method_get_gridshapes(self)
343 self._get_gridshapes = self._vtx_grid_to_geoms_cellids
344 elif self.mfgrid.grid_type == "unstructured":
--> 345 raise NotImplementedError()
NotImplementedError:
Beta Was this translation helpful? Give feedback.
All reactions