Skip to content

Commit 5e18ca4

Browse files
authored
Adopting imod open_cbc code (#133)
Remove imod dependency Co-authored-by: deltamarnix <[email protected]>
1 parent 18791bb commit 5e18ca4

File tree

10 files changed

+920
-580
lines changed

10 files changed

+920
-580
lines changed

docs/examples/image/quickstart.png

0 Bytes
Loading

docs/examples/quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@
5757
head.plot.imshow(ax=ax)
5858
head.plot.contour(ax=ax, levels=[0.2, 0.4, 0.6, 0.8], linewidths=3.0)
5959
budget.plot.quiver(x="x", y="y", u="npf-qx", v="npf-qy", ax=ax, color="white")
60-
fig.savefig(workspace / f"{name}.png")
60+
fig.savefig(workspace / ".." / "image" / "quickstart.png")

flopy4/mf6/gwf/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Optional
33

44
import attrs
5-
import imod
65
import xarray as xr
76
from attrs import define
87
from flopy.discretization.grid import Grid
@@ -15,7 +14,7 @@
1514
from flopy4.mf6.gwf.npf import Npf
1615
from flopy4.mf6.gwf.oc import Oc
1716
from flopy4.mf6.model import Model
18-
from flopy4.mf6.utils import open_hds
17+
from flopy4.mf6.utils import open_cbc, open_hds
1918

2019
__all__ = ["Gwf", "Chd", "Dis", "Ic", "Npf", "Oc"]
2120

@@ -45,10 +44,9 @@ def head(self) -> xr.DataArray:
4544
@property
4645
def budget(self):
4746
# TODO support other extensions than .bud (e.g. .cbc)
48-
return imod.mf6.open_cbc(
47+
return open_cbc(
4948
self.parent.parent.path / f"{self.parent.name}.bud",
5049
self.parent.parent.path / f"{self.parent.name}.dis.grb",
51-
merge_to_dataset=True,
5250
)
5351

5452
dis: Dis = field(converter=convert_grid)

flopy4/mf6/utils/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from .cbc_reader import open_cbc
12
from .heads_reader import open_hds
23

3-
__all__ = ["open_hds"]
4+
__all__ = ["open_hds", "open_cbc"]

0 commit comments

Comments
 (0)