|
1 | 1 | from pathlib import Path |
2 | 2 |
|
3 | | -import flopy |
4 | 3 | import imod.mf6 |
5 | 4 | import matplotlib.pyplot as plt |
6 | 5 | import numpy as np |
|
49 | 48 | grbpth = Path("./quickstart_data/mymodel.dis.grb") |
50 | 49 |
|
51 | 50 | # set specific discharge |
52 | | -spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=False) |
| 51 | +spdis = imod.mf6.open_cbc(bpth, grbpth, merge_to_dataset=True) |
53 | 52 |
|
54 | 53 | # create head reader |
55 | 54 | hpth = Path("./quickstart_data/mymodel.hds") |
56 | 55 | heads = imod.mf6.open_hds(hpth, grbpth) |
57 | | - |
58 | | -# create grid |
59 | | -grid = flopy.discretization.StructuredGrid.from_binary_grid_file(grbpth) |
60 | | - |
61 | | -# set discharge component arrays |
62 | | -u = [] |
63 | | -v = [] |
64 | | -for r in spdis: |
65 | | - u.append(r[3]) |
66 | | - v.append(r[4]) |
67 | | -qx = np.array(u).reshape(grid.nrow, grid.ncol) |
68 | | -qy = np.array(v).reshape(grid.nrow, grid.ncol) |
69 | | - |
| 56 | +sq = heads.squeeze() |
70 | 57 | fig, ax = plt.subplots() |
71 | | -pmv = flopy.plot.PlotMapView(modelgrid=grid, ax=ax) |
72 | | -pmv.plot_array(heads[0][0]) |
73 | | -pmv.plot_grid(colors="white") |
74 | | -pmv.contour_array(heads[0][0], levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0) |
75 | | -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 | +) |
76 | 69 | qs_pth = Path("./image/quickstart.png") |
77 | 70 | fig.savefig(qs_pth) |
0 commit comments