|
1 | 1 | from pathlib import Path |
2 | 2 |
|
3 | | -import flopy |
| 3 | +import imod.mf6 |
4 | 4 | import matplotlib.pyplot as plt |
5 | 5 | import numpy as np |
6 | 6 |
|
|
45 | 45 | # PLOT |
46 | 46 | # create budget reader |
47 | 47 | bpth = Path("./quickstart_data/mymodel.bud") |
48 | | -bobj = flopy.utils.CellBudgetFile(bpth, precision="double") |
| 48 | +grbpth = Path("./quickstart_data/mymodel.dis.grb") |
49 | 49 |
|
50 | 50 | # set specific discharge |
51 | | -spdis = bobj.get_data(text="DATA-SPDIS")[0] |
| 51 | +spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=True) |
52 | 52 |
|
53 | 53 | # create head reader |
54 | 54 | hpth = Path("./quickstart_data/mymodel.hds") |
55 | | -hobj = flopy.utils.HeadFile(hpth, precision="double") |
56 | | - |
57 | | -# set heads |
58 | | -heads = hobj.get_alldata() |
59 | | - |
60 | | -# create grid |
61 | | -grbpth = Path("./quickstart_data/mymodel.dis.grb") |
62 | | -grid = flopy.discretization.StructuredGrid.from_binary_grid_file(grbpth) |
63 | | - |
64 | | -# TODO: get_specific_discharge is dependent on flopy3 model |
65 | | -# qx, qy, qz = flopy.utils.postprocessing.get_specific_discharge(spdis, gwf) |
66 | | - |
67 | | -# set discharge component arrays |
68 | | -u = [] |
69 | | -v = [] |
70 | | -for r in spdis: |
71 | | - u.append(r[3]) |
72 | | - v.append(r[4]) |
73 | | -qx = np.array(u).reshape(grid.nrow, grid.ncol) |
74 | | -qy = np.array(v).reshape(grid.nrow, grid.ncol) |
75 | | - |
| 55 | +heads = imod.mf6.open_hds(hpth, grbpth) |
| 56 | +sq = heads.squeeze() |
76 | 57 | fig, ax = plt.subplots() |
77 | | -pmv = flopy.plot.PlotMapView(modelgrid=grid, ax=ax) |
78 | | -pmv.plot_array(heads[0][0]) |
79 | | -pmv.plot_grid(colors="white") |
80 | | -pmv.contour_array(heads[0][0], levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0) |
81 | | -pmv.plot_vector(qx, qy, normalize=True, color="white") |
| 58 | +ax.tick_params() |
| 59 | +ax.set_xticks(np.arange(0, 11, 2), minor=False) |
| 60 | +ax.set_xticks(np.arange(1, 10, 2), minor=True) |
| 61 | +ax.set_yticks(np.arange(0, 11, 2), minor=False) |
| 62 | +ax.set_yticks(np.arange(1, 10, 2), minor=True) |
| 63 | +ax.grid(which="both", color="white") |
| 64 | +sq.plot.imshow(ax=ax) |
| 65 | +sq.plot.contour(ax=ax, levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0) |
| 66 | +spdis.squeeze().plot.quiver( |
| 67 | + x="x", y="y", u="npf-qx", v="npf-qy", ax=ax, color="white" |
| 68 | +) |
82 | 69 | qs_pth = Path("./image/quickstart.png") |
83 | 70 | fig.savefig(qs_pth) |
0 commit comments