Skip to content

Commit 3257294

Browse files
committed
rework oc
1 parent 44a5df1 commit 3257294

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

docs/examples/quickstart.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
assert gwf.dis.data.botm.sel(lay=0, col=0, row=0) == 0.0
4242

4343
# check OC
44-
assert oc.data["saverecord"][0] == "all"
45-
assert oc.data.save_head.sel(per=0) == "all"
44+
oc.data.perioddata[0].saverecord
4645

4746
# get head and budget results
4847
budget = gwf.output.budget.squeeze()

flopy4/mf6/gwf/oc.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ class FormatRecord:
2222
format: Literal["exponential", "fixed", "general", "scientific"] = field(default="general")
2323

2424
@define(slots=False)
25-
class OCSettingOption:
25+
class OCSetting:
2626
first: bool = field(default=True)
2727
last: bool = field(default=False)
2828
all: bool = field(default=False)
29-
steps: Optional[list[int]] = field(default=None)
29+
steps: Optional[tuple[int]] = field(default=None)
3030
frequency: Optional[int] = field(default=None)
3131

32-
@define(slots=False)
33-
class OCSetting:
34-
ocsetting: Optional[list["Oc.OCSettingOption"]] = field(default=None)
35-
3632
@define(slots=False)
3733
class SaveRecord:
3834
rtype: str = field()
@@ -43,6 +39,11 @@ class PrintRecord:
4339
rtype: str = field()
4440
ocsetting: "Oc.OCSetting" = field()
4541

42+
@define(slots=False)
43+
class PeriodData:
44+
saverecord: Optional[tuple["Oc.SaveRecord"]] = field(default=None)
45+
printrecord: Optional[tuple["Oc.PrintRecord"]] = field(default=None)
46+
4647
budget_file: Optional[Path] = field(
4748
block="options",
4849
converter=to_path,
@@ -59,16 +60,8 @@ class PrintRecord:
5960
default=None,
6061
)
6162
headprintrecord: Optional[FormatRecord] = field(block="options", default=None, init=False)
62-
saverecord: Optional[NDArray[np.object_]] = array(
63-
SaveRecord,
64-
block="period",
65-
default=None,
66-
dims=("nper",),
67-
converter=Converter(structure_array, takes_self=True, takes_field=True),
68-
reader="urword",
69-
)
70-
printrecord: Optional[NDArray[np.object_]] = array(
71-
PrintRecord,
63+
perioddata: Optional[NDArray[np.object_]] = array(
64+
PeriodData,
7265
block="period",
7366
default=None,
7467
dims=("nper",),

0 commit comments

Comments
 (0)