Skip to content

Commit af9db17

Browse files
committed
default oc period data arrays None
1 parent ea4e476 commit af9db17

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

flopy4/mf6/gwf/oc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,28 @@ class Period:
4949
save_head: Optional[NDArray[np.str_]] = array(
5050
dtype=np.dtypes.StringDType(),
5151
block="period",
52-
default="all",
52+
default=None,
5353
dims=("nper",),
5454
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
5555
)
5656
save_budget: Optional[NDArray[np.str_]] = array(
5757
dtype=np.dtypes.StringDType(),
5858
block="period",
59-
default="all",
59+
default=None,
6060
dims=("nper",),
6161
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
6262
)
6363
print_head: Optional[NDArray[np.str_]] = array(
6464
dtype=np.dtypes.StringDType(),
6565
block="period",
66-
default="all",
66+
default=None,
6767
dims=("nper",),
6868
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
6969
)
7070
print_budget: Optional[NDArray[np.str_]] = array(
7171
dtype=np.dtypes.StringDType(),
7272
block="period",
73-
default="all",
73+
default=None,
7474
dims=("nper",),
7575
converter=Converter(dict_to_array, takes_self=True, takes_field=True),
7676
)

test/test_codec.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,8 @@ def test_dumps_oc():
6767
dumped = dumps(COMPONENT_CONVERTER.unstructure(oc))
6868
print("OC dump:")
6969
print(dumped)
70-
# TODO these are getting truncated, need to specify string length like <U4 etc.
71-
# add a dtype argument to the array decorator? or overload the first argument
72-
# which currently acccepts cls for arrays of object type, to work for str dtype?
7370
assert "save head all" in dumped
7471
assert "save budget all" in dumped
75-
assert "print head all" in dumped
76-
assert "print budget all" in dumped
7772
assert dumped
7873

7974
loaded = loads(dumped)
@@ -121,6 +116,12 @@ def test_dumps_tdis():
121116
print("TDIS dump:")
122117
print(dumped)
123118
assert dumped
119+
assert "BEGIN PERIODDATA 1" in dumped
120+
assert " 1.0 1 1.0" in dumped
121+
assert "END PERIODDATA 1" in dumped
122+
assert "BEGIN PERIODDATA 2" in dumped
123+
assert " 2.0 2 1.0" in dumped
124+
assert "END PERIODDATA 2" in dumped
124125

125126
loaded = loads(dumped)
126127
print("TDIS load:")

test/test_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_flopy3_model(tmp_path):
6363
ims.inner_hclose = 1e-6
6464
ims.inner_rclose = 0.1000000
6565
ic = Ic(dims=dims)
66-
oc = Oc(dims=dims)
66+
oc = Oc(dims=dims, save_head={0: "all"}, save_budget={0: "all"})
6767
npf = Npf(dims=dims)
6868
chd = Chd(dims=dims, head={0: {(0, 0, 0): 1.0, (0, 9, 9): 0.0}})
6969

0 commit comments

Comments
 (0)