diff --git a/flopy4/array.py b/flopy4/array.py index 71caee4..bf70ac5 100644 --- a/flopy4/array.py +++ b/flopy4/array.py @@ -203,7 +203,7 @@ def __init__( tagged=False, reader=MFReader.urword, default_value=None, - extpath=None, + path: Optional[Path] = None, ): MFParam.__init__( self, @@ -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] @@ -361,10 +361,10 @@ 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}" @@ -372,7 +372,7 @@ def write(self, f, **kwargs): 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 = ( @@ -384,7 +384,7 @@ 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}" @@ -392,22 +392,22 @@ 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}" + 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 = ( @@ -491,7 +491,7 @@ def _load(cls, f, cwd, shape, layered=False, **kwargs): array=array, how=how, factor=factor, - extpath=extpath, + path=extpath, **kwargs, )