Skip to content

Commit

Permalink
add npf
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 12, 2024
1 parent 399594b commit d56faf2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/examples/attrs_xarray_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,48 @@ def __attrs_post_init__(self):
pass


@datatree
@define(slots=False)
class Npf:
# no options, just arrays for now
icelltype: NDArray[np.integer] = field(
metadata={"block": "griddata", "shape": "(nodes)"}
)
k: NDArray[np.floating] = field(
metadata={"block": "griddata", "shape": "(nodes)"}
)
k22: Optional[NDArray[np.floating]] = field(
default=None, metadata={"block": "griddata", "shape": "(nodes)"}
)
k33: Optional[NDArray[np.floating]] = field(
default=None, metadata={"block": "griddata", "shape": "(nodes)"}
)
angle1: Optional[NDArray[np.floating]] = field(
default=None, metadata={"block": "griddata", "shape": "(nodes)"}
)
angle2: Optional[NDArray[np.floating]] = field(
default=None, metadata={"block": "griddata", "shape": "(nodes)"}
)
angle3: Optional[NDArray[np.floating]] = field(
default=None, metadata={"block": "griddata", "shape": "(nodes)"}
)
wetdry: Optional[NDArray[np.floating]] = field(
default=None, metadata={"block": "griddata", "shape": "(nodes)"}
)
model: Optional[Model] = field(default=None)

def __attrs_post_init__(self):
# for some reason this is necessary..
pass


@datatree
@define(slots=False)
class Gwf(Model):
dis: Optional[Dis] = field(default=None)
ic: Optional[Ic] = field(default=None)
oc: Optional[Oc] = field(default=None)
npf: Optional[Npf] = field(default=None)
sim: Optional["Sim"] = field(default=None)

def __attrs_post_init__(self):
Expand Down Expand Up @@ -342,6 +378,7 @@ def __attrs_post_init__(self):
dis = Dis(model=gwf)
ic = Ic(model=gwf, strt=1)
oc = Oc(model=gwf, perioddata=[Oc.Steps()])
npf = Npf(model=gwf, icelltype=0, k=1.0)

# View the data tree.
gwf.data

0 comments on commit d56faf2

Please sign in to comment.