Skip to content

Commit

Permalink
review updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mjreno authored and mjreno committed Jul 31, 2024
1 parent 25bdb72 commit 8136ad1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions flopy4/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def __init__(
tagged=False,
reader=MFReader.urword,
default_value=None,
extpath=None,
path: Optional[Path] = None,
):
MFParam.__init__(
self,
Expand All @@ -228,7 +228,7 @@ def __init__(
self._shape = shape
self._how = how
self._factor = factor
self._extpath = extpath
self._path = path

def __getitem__(self, item):
return self.raw[item]
Expand Down Expand Up @@ -361,18 +361,18 @@ def write(self, f, **kwargs):
elif len(values.shape) == 3:
v = f"{PAD*3}"
for i in range(len(values)):
v += v.join(
" ".join(str(x) for x in y) for y in values[i]
v += " ".join(
f"\n{PAD*3}" + " ".join(str(x) for x in y)
for y in values[i]
)
v += f"\n{PAD*3}"
lines = f"{PAD*2}" + f"{MFArrayType.to_string(mfa._how)}"
if mfa._factor:
lines += f" FACTOR {mfa._factor}"
lines += f"\n{PAD*3}" + f"{v}\n"
elif mfa._how == MFArrayType.external:
lines = (
f"{PAD*2}" + f"{MFArrayType.to_string(mfa._how)} "
f"{mfa._extpath}\n"
f"{mfa._path}\n"
)
elif mfa._how == MFArrayType.constant:
lines = (
Expand All @@ -384,30 +384,30 @@ def write(self, f, **kwargs):
values = self.raw
if self._how == MFArrayType.internal:
if len(values.shape) == 1:
v = f"{PAD*3}"
v = f"\n{PAD*3}"
v += " ".join([str(x) for x in values])
elif len(values.shape) == 2:
v = f"\n{PAD*3}"
v = v.join(" ".join(str(x) for x in y) for y in values)
elif len(values.shape) == 3:
v = f"{PAD*3}"
for i in range(len(values)):
v += v.join(
" ".join(str(x) for x in y) for y in values[i]
v += " ".join(
f"\n{PAD*3}" + " ".join(str(x) for x in y)
for y in values[i]
)
v += f"\n{PAD*3}"
lines = (
f"{PAD}" + f"{self.name.upper()}\n"
f"{PAD*2}" + f"{MFArrayType.to_string(self._how)}"
)
if self._factor:
lines += f" FACTOR {self._factor}"
lines += f"\n{v}\n"
lines += f"{v}\n"
elif self._how == MFArrayType.external:
lines = (
f"{PAD}" + f"{self.name.upper()}\n"
f"{PAD*2}"
+ f"{MFArrayType.to_string(self._how)} {self._extpath}\n"
+ f"{MFArrayType.to_string(self._how)} {self._path}\n"
)
elif self._how == MFArrayType.constant:
lines = (
Expand Down Expand Up @@ -491,7 +491,7 @@ def _load(cls, f, cwd, shape, layered=False, **kwargs):
array=array,
how=how,
factor=factor,
extpath=extpath,
path=extpath,
**kwargs,
)

Expand Down

0 comments on commit 8136ad1

Please sign in to comment.