Skip to content

Commit f726a55

Browse files
mjrenomjreno
authored andcommitted
more cleanup
1 parent 29d9f14 commit f726a55

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

flopy4/mf6/converter/unstructure.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,18 @@ def _hack_structured_grid_dims(
9393
def _hack_period_non_numeric(name: str, value: xr.DataArray) -> dict[str, dict[int, Any]]:
9494
from flopy4.mf6.gwf import Oc
9595

96-
def oc_setting_data(rec, action):
96+
def oc_setting_data(rec):
9797
dat = {}
98-
key = f"{action} {rec.rtype}"
9998
if rec.steps.first:
10099
dat = {kper: "first" for kper in range(value.sizes["nper"])}
101-
data[key] = dat
102100
elif rec.steps.last:
103101
dat = {kper: "last" for kper in range(value.sizes["nper"])}
104-
data[key] = dat
105102
elif rec.steps.steps:
106103
steps = " ".join(str(x - 1) for x in rec.steps.steps)
107104
dat = {kper: f"steps {steps}" for kper in range(value.sizes["nper"])}
108-
data[key] = dat
109105
elif rec.steps.all:
110106
# check last as this defaults to True
111107
dat = {kper: "all" for kper in range(value.sizes["nper"])}
112-
data[key] = dat
113108

114109
return dat
115110

@@ -127,17 +122,15 @@ def oc_setting_data(rec, action):
127122
if hasattr(value.values[0], "printrecord") and isinstance(
128123
value.values[0].printrecord, list
129124
):
130-
action = "PRINT"
131125
for rec in value.values[0].printrecord:
132-
key = f"{action} {rec.rtype}"
133-
data[key] = oc_setting_data(rec, action)
126+
key = f"{rec.print} {rec.rtype}"
127+
data[key] = oc_setting_data(rec)
134128
if hasattr(value.values[0], "saverecord") and isinstance(
135129
value.values[0].saverecord, list
136130
):
137-
action = "SAVE"
138131
for rec in value.values[0].saverecord: # type: ignore
139-
key = f"{action} {rec.rtype}"
140-
data[key] = oc_setting_data(rec, action)
132+
key = f"{rec.save} {rec.rtype}" # type: ignore
133+
data[key] = oc_setting_data(rec)
141134

142135
return data
143136

0 commit comments

Comments
 (0)