Skip to content

Commit 937b6e2

Browse files
authored
consolidate package lists (#281)
1 parent 2a029b0 commit 937b6e2

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

docs/examples/twri.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,10 @@ def plot_head(head, workspace):
252252
del gwf.rch[0]
253253

254254
# add array based inputs
255-
# TODO: needs type checking and list consolidation support (see comments in gwf init)
256-
gwf.chdg = [chdg]
257-
gwf.drng = [drng]
258-
gwf.welg = [welg]
259-
gwf.rcha = [rcha]
255+
gwf.chd = [chdg]
256+
gwf.drn = [drng]
257+
gwf.wel = [welg]
258+
gwf.rch = [rcha]
260259

261260
# create new workspace
262261
workspace = Path(__file__).parent / "twri" / "array_stresspkg"

flopy4/mf6/gwf/__init__.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import Optional
2+
from typing import Optional, Union
33

44
import attrs
55
import xarray as xr
@@ -97,18 +97,10 @@ def budget(self):
9797
oc: Oc | None = field(block="packages", default=None)
9898
npf: Npf | None = field(block="packages", default=None)
9999
sto: Sto | None = field(block="packages", default=None)
100-
# TODO: implement type check for all lists (and singletons?)
101-
chd: list[Chd] = field(block="packages")
102-
chdg: list[Chdg] = field(block="packages")
103-
# TODO: consolidate all package flavors to single list
104-
# based on hydrologic feature
105-
# chd: List[Union[Chd, Chdg]] = field(block="packages")
106-
drn: list[Drn] = field(block="packages")
107-
drng: list[Drng] = field(block="packages")
108-
rch: list[Rch] = field(block="packages")
109-
rcha: list[Rcha] = field(block="packages")
110-
wel: list[Wel] = field(block="packages")
111-
welg: list[Welg] = field(block="packages")
100+
chd: list[Union[Chd, Chdg]] = field(block="packages")
101+
drn: list[Union[Drn, Drng]] = field(block="packages")
102+
rch: list[Union[Rch, Rcha]] = field(block="packages")
103+
wel: list[Union[Wel, Welg]] = field(block="packages")
112104
output: Output = attrs.field(
113105
default=attrs.Factory(lambda self: Gwf.Output(self), takes_self=True)
114106
)

0 commit comments

Comments
 (0)