diff --git a/autotest/test_export.py b/autotest/test_export.py index 0028ada34..a4ac22f78 100644 --- a/autotest/test_export.py +++ b/autotest/test_export.py @@ -646,6 +646,65 @@ def test_export_array2(function_tmpdir): assert os.path.isfile(filename), "did not create array shapefile" +@pytest.mark.mf6 +@requires_pkg("pyshp", name_map={"pyshp": "shapefile"}) +def test_array3d_export_structured(function_tmpdir): + from shapefile import Reader + + xll, yll = 468970, 3478635 + xur, yur = 681010, 3716462 + spacing = 20000 + ncol = int((xur - xll) / spacing) + nrow = int((yur - yll) / spacing) + sim = flopy.mf6.MFSimulation("sim", sim_ws=function_tmpdir) + gwf = flopy.mf6.ModflowGwf( + sim, + modelname="array3d_export_unstructured", + ) + flopy.mf6.ModflowGwfdis( + gwf, + nlay=3, + top=5, + botm=[4, 3, 2], + delr=spacing, + delc=spacing, + nrow=nrow, + ncol=ncol, + ) + + shp_file = os.path.join(function_tmpdir, "dis_botm.shp") + gwf.dis.botm.export(shp_file) + + with Reader(shp_file) as shp: + assert list(shp.shapeRecord(-1).record) == [ + 110, # node + 11, # row + 10, # column + 4.0, # botm_1 + 3.0, # botm_2 + 2.0, # botm_3 + ] + + +@requires_pkg("pyshp", name_map={"pyshp": "shapefile"}) +def test_array3d_export_unstructured(function_tmpdir): + from shapefile import Reader + + name = "array3d_export_unstructured" + sim = disu_sim(name, function_tmpdir) + gwf = sim.get_model(name) + + shp_file = function_tmpdir / "disu_bot.shp" + gwf.disu.bot.export(shp_file) + + with Reader(shp_file) as shp: + assert list(shp.shapeRecord(-1).record) == [ + 1770, # node + 3, # layer + 0.0, # bot + ] + + @requires_pkg("pyshp", "shapely", name_map={"pyshp": "shapefile"}) def test_export_array_contours_structured(function_tmpdir): nrow = 7