Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… iMOD5 import Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…when mf6 is not on the PATH
JoerivanEngelen
left a comment
There was a problem hiding this comment.
This is a very good step, which turns out to be a lot less work than I expected. What I'm still missing is also adding this to the HFB objects which are not assigned to a single layer. This included some complex back-and-forth between Z-polygons to avoid some shapely edge case behavior. I hope this will not cause too much extra trouble.
There was a problem hiding this comment.
I'm surprised that our snapping functionality supports linearrings, and so little work is required! Long live xugrid, geopandas, and shapely I guess.
There was a problem hiding this comment.
Actually, what I'm still missing is the three other HFB packages, the ones which are not assigned to a single layer, but have a Z-coordinate as well. These have a more complex procedure computing the hydraulic characteristic, but I hope this is not a problem?
| hfb.cleanup(dis) | ||
| assert hfb.line_data.geometry.length.sum() == pytest.approx(160.0) |
There was a problem hiding this comment.
I think the intention of similar tests I added here was to first clip then call cleanup on the clipped object, which is not what is happening here? I'm not entirely sure what is happening here. It could be that the tests this is derived from are wrong as well, or intended to do this actually.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|



Fixes #1757
Description
iMOD5 supported HFBs as linearrings in GEN files, and some models rely on GEN
files with both linestrings and linearrings. MODFLOW6 HFBs only accepted
linestrings. This PR adds the following:
imod.gen.read, ASCII): linestrings and closed rings are nowconverted to shapely geometries separately and merged back in file order. This
fixes reading files with both. Closed rings are read as polygons. A closed
feature with fewer than 4 vertices stays a linestring.
(
SingleLayerHorizontalFlowBarrierResistance.from_imod5_data): polygons areconverted to
LinearRings using the exterior ring. Interior rings are dropped.The input GeoDataFrame is not mutated.
(
...Resistance,...Multiplier,...HydraulicCharacteristic) acceptLinearRinggeometries, for example for building pits. Polygons are stillrejected.
Checklist
Issue #nr, e.g.Issue #737pixi run generate-sbomand committed changesExecutable validation
Since I've just reinstalled everything on my new laptop, I forgot to put the modflow6 bin dir in my PATH.
This was not clear from errors in the tests though, and let to some cryptic
subprocess.PopenErrors.Now,
Modflow6Simulation.runresolves the executable through a new_validate_mf6_executable, which does the exact same thing as before when not providing anything, just with better error messages. Precedence ismf6pathargument, then theMODFLOW6_EXECUTABLEvariable, thenmf6on the PATH. It raises descriptive errors when the executable is missing, is a directory, or is not executable.Did this while waiting for tests to run, and is somewhat unrelated to this PR, so can also make a separate PR if preferred?