Skip to content

Commit

Permalink
fix(flopy/export/utils.py): add line continuations
Browse files Browse the repository at this point in the history
  • Loading branch information
aleaf committed Mar 20, 2023
1 parent e8bd8c7 commit 49c159b
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions flopy/export/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,9 @@ def output_helper(
elif verbose:
print(msg)
times = [t for t in common_times[::stride]]
if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(
f, ml, time_values=times, logger=logger, forgive=forgive, **kwargs
)
Expand Down Expand Up @@ -612,8 +613,9 @@ def model_export(
if package_names is None:
package_names = [pak.name[0] for pak in ml.packagelist]

if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(f, ml, **kwargs)

if (isinstance(f, str) or isinstance(f, Path)) and Path(
Expand Down Expand Up @@ -705,8 +707,9 @@ def package_export(
"""
assert isinstance(pak, PackageInterface)

if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(f, pak.parent, **kwargs)

if (isinstance(f, str) or isinstance(f, Path)) and Path(
Expand Down Expand Up @@ -818,8 +821,9 @@ def generic_array_export(
flopy model object
"""
if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
assert "model" in kwargs.keys(), (
"creating a new netCDF using generic_array_helper requires a "
"'model' kwarg"
Expand Down Expand Up @@ -906,8 +910,9 @@ def mflist_export(f: Union[str, os.PathLike, NetCdf], mfl, **kwargs):
if "modelgrid" in kwargs:
modelgrid = kwargs.pop("modelgrid")

if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(f, mfl.model, **kwargs)

if (isinstance(f, str) or isinstance(f, Path)) and Path(
Expand Down Expand Up @@ -1062,8 +1067,9 @@ def transient2d_export(f: Union[str, os.PathLike], t2d, fmt=None, **kwargs):
if "modelgrid" in kwargs:
modelgrid = kwargs.pop("modelgrid")

if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(f, t2d.model, **kwargs)

if (isinstance(f, str) or isinstance(f, Path)) and Path(
Expand Down Expand Up @@ -1218,8 +1224,9 @@ def array3d_export(f: Union[str, os.PathLike], u3d, fmt=None, **kwargs):
if "modelgrid" in kwargs:
modelgrid = kwargs.pop("modelgrid")

if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(f, u3d.model, **kwargs)

if (isinstance(f, str) or isinstance(f, Path)) and Path(
Expand Down Expand Up @@ -1395,8 +1402,9 @@ def array2d_export(
if "modelgrid" in kwargs:
modelgrid = kwargs.pop("modelgrid")

if (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".nc":
if (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".nc":
f = NetCdf(f, u2d.model, **kwargs)

if (isinstance(f, str) or isinstance(f, Path)) and Path(
Expand All @@ -1408,8 +1416,9 @@ def array2d_export(
)
return

elif (isinstance(f, str) or isinstance(f, Path)) and
Path(f).suffix.lower() == ".asc":
elif (isinstance(f, str) or isinstance(f, Path)) and Path(
f
).suffix.lower() == ".asc":
export_array(modelgrid, f, u2d.array, **kwargs)
return

Expand Down

0 comments on commit 49c159b

Please sign in to comment.