Skip to content

Commit

Permalink
rerun black after version update (24)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Jan 31, 2024
1 parent 1eaaa51 commit 7172e30
Show file tree
Hide file tree
Showing 88 changed files with 205 additions and 131 deletions.
1 change: 1 addition & 0 deletions .docs/Notebooks/mf_error_tutorial01.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

try:
import pandas as pd

summary_pth = os.path.join(workspace, "checksummary.csv")
df = pd.read_csv(summary_pth)
except:
Expand Down
7 changes: 1 addition & 6 deletions .docs/Notebooks/mf_watertable_recharge_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@ def analytical_water_table_solution(h1, h2, z, R, K, L, x):
# x -= dx
b1 = h1 - z
b2 = h2 - z
h = (
np.sqrt(
b1**2 - (x / L) * (b1**2 - b2**2) + (R * x / K) * (L - x)
)
+ z
)
h = np.sqrt(b1**2 - (x / L) * (b1**2 - b2**2) + (R * x / K) * (L - x)) + z
return h


Expand Down
1 change: 1 addition & 0 deletions autotest/test_copy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test copying of flopy objects.
"""

import copy
import inspect

Expand Down
9 changes: 6 additions & 3 deletions autotest/test_get_modflow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test get-modflow utility."""

import os
import platform
import sys
Expand All @@ -20,9 +21,11 @@
flopy_dir = get_project_root_path()
get_modflow_script = flopy_dir / "flopy" / "utils" / "get_modflow.py"
bindir_options = {
"flopy": Path(expandvars(r"%LOCALAPPDATA%\flopy")) / "bin"
if system() == "Windows"
else Path.home() / ".local" / "share" / "flopy" / "bin",
"flopy": (
Path(expandvars(r"%LOCALAPPDATA%\flopy")) / "bin"
if system() == "Windows"
else Path.home() / ".local" / "share" / "flopy" / "bin"
),
"python": Path(sys.prefix)
/ ("Scripts" if system() == "Windows" else "bin"),
"home": Path.home() / ".local" / "bin",
Expand Down
12 changes: 3 additions & 9 deletions autotest/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
from flopy.discretization import StructuredGrid, UnstructuredGrid, VertexGrid
from flopy.mf6 import MFSimulation
from flopy.modflow import Modflow, ModflowDis
from flopy.utils import import_optional_dependency
from flopy.utils.crs import get_authority_crs
from flopy.utils.cvfdutil import gridlist_to_disv_gridprops, to_cvfd
from flopy.utils.triangle import Triangle
from flopy.utils.voronoi import VoronoiGrid
from flopy.utils import import_optional_dependency

HAS_PYPROJ = has_pkg("pyproj", strict=True)
if HAS_PYPROJ:
Expand Down Expand Up @@ -1239,9 +1239,7 @@ def test_unstructured_neighbors(unstructured_grid):
queen_neighbors = unstructured_grid.neighbors(
5, method="queen", reset=True
)
assert np.allclose(
queen_neighbors, [0, 10, 1, 6, 11, 2, 3, 7, 8, 12, 13]
)
assert np.allclose(queen_neighbors, [0, 10, 1, 6, 11, 2, 3, 7, 8, 12, 13])


@parametrize_with_cases("grid", cases=GridCases, prefix="structured_cbd")
Expand Down Expand Up @@ -1345,11 +1343,7 @@ def test_unstructured_convert(unstructured_grid):
@requires_pkg("geopandas")
def test_geo_dataframe(structured_grid, vertex_grid, unstructured_grid):
geopandas = import_optional_dependency("geopandas")
grids = (
structured_grid,
vertex_grid,
unstructured_grid
)
grids = (structured_grid, vertex_grid, unstructured_grid)

for grid in grids:
gdf = grid.geo_dataframe
Expand Down
6 changes: 3 additions & 3 deletions autotest/test_grid_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def structured_small(self):
delr=delr,
top=top,
botm=botm,
idomain=idomain
idomain=idomain,
)

def structured_cbd_small(self):
Expand Down Expand Up @@ -96,7 +96,7 @@ def vertex_small(self):
cell2d=cell2d,
top=top,
botm=botm,
idomain=idomain
idomain=idomain,
)

def unstructured_small(self):
Expand Down Expand Up @@ -164,7 +164,7 @@ def unstructured_small(self):
ncpl=ncpl,
top=top.flatten(),
botm=botm.flatten(),
idomain=idomain.flatten()
idomain=idomain.flatten(),
)

def unstructured_medium(self):
Expand Down
7 changes: 1 addition & 6 deletions autotest/test_mfnwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ def analytical_water_table_solution(h1, h2, z, R, K, L, x):
h = np.zeros((x.shape[0]), float)
b1 = h1 - z
b2 = h2 - z
h = (
np.sqrt(
b1**2 - (x / L) * (b1**2 - b2**2) + (R * x / K) * (L - x)
)
+ z
)
h = np.sqrt(b1**2 - (x / L) * (b1**2 - b2**2) + (R * x / K) * (L - x)) + z
return h


Expand Down
16 changes: 10 additions & 6 deletions autotest/test_mnw.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,16 @@ def test_mnw2_create_file(function_tmpdir, dataframe):
wellids[i],
nnodes=nlayers[i],
nper=len(stress_period_data.index),
node_data=node_data.to_records(index=False)
if not dataframe
else node_data,
stress_period_data=stress_period_data.to_records(index=False)
if not dataframe
else stress_period_data,
node_data=(
node_data.to_records(index=False)
if not dataframe
else node_data
),
stress_period_data=(
stress_period_data.to_records(index=False)
if not dataframe
else stress_period_data
),
)

wells.append(wl)
Expand Down
1 change: 1 addition & 0 deletions flopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
contribute.
"""

# See CITATION.cff for authors
__author__ = "FloPy Team"

Expand Down
6 changes: 3 additions & 3 deletions flopy/export/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ def __init__(
}
for n, v in spatial_attribs.items():
self.global_attributes["flopy_sr_" + n] = v
self.global_attributes[
"start_datetime"
] = self.model_time.start_datetime
self.global_attributes["start_datetime"] = (
self.model_time.start_datetime
)

self.fillvalue = FILLVALUE

Expand Down
1 change: 1 addition & 0 deletions flopy/export/shapefile_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Module for exporting and importing flopy model attributes
"""

import copy
import json
import os
Expand Down
1 change: 1 addition & 0 deletions flopy/mbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
all of the other models inherit from.
"""

import abc
import copy
import os
Expand Down
34 changes: 16 additions & 18 deletions flopy/mf6/data/mfdatastorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,16 +1372,16 @@ def store_internal(
# convert numbers to be multiplied by the original factor
data = data * adjustment
if const:
self.layer_storage[
layer
].data_storage_type = DataStorageType.internal_constant
self.layer_storage[layer].data_storage_type = (
DataStorageType.internal_constant
)
self.layer_storage[layer].data_const_value = [
mfdatautil.get_first_val(data)
]
else:
self.layer_storage[
layer
].data_storage_type = DataStorageType.internal_array
self.layer_storage[layer].data_storage_type = (
DataStorageType.internal_array
)
try:
self.layer_storage[layer].internal_data = np.reshape(
data, dimensions
Expand Down Expand Up @@ -1410,12 +1410,10 @@ def store_internal(
data_type = self.data_dimensions.structure.get_datum_type(True)
dt = self.layer_storage[layer].internal_data.dtype
if dt != data_type:
self.layer_storage[
layer
].internal_data = self.layer_storage[
layer
].internal_data.astype(
data_type
self.layer_storage[layer].internal_data = (
self.layer_storage[layer].internal_data.astype(
data_type
)
)
if not preserve_record:
self.layer_storage[layer].factor = multiplier
Expand Down Expand Up @@ -1804,9 +1802,9 @@ def store_external(
if self._calc_data_size(data, 2) == 1 and data_size > 1:
# constant data, need to expand
self.layer_storage[layer_new].data_const_value = data
self.layer_storage[
layer_new
].data_storage_type = DataStorageType.internal_constant
self.layer_storage[layer_new].data_storage_type = (
DataStorageType.internal_constant
)
data = self._fill_const_layer(layer)
elif isinstance(data, list):
data = self._to_ndarray(data, layer)
Expand Down Expand Up @@ -1863,9 +1861,9 @@ def set_ext_file_attributes(self, layer, file_path, print_format, binary):
self.layer_storage[layer].fname = file_path
self.layer_storage[layer].iprn = print_format
self.layer_storage[layer].binary = binary
self.layer_storage[
layer
].data_storage_type = DataStorageType.external_file
self.layer_storage[layer].data_storage_type = (
DataStorageType.external_file
)

def point_to_existing_external_file(self, arr_line, layer):
(
Expand Down
6 changes: 3 additions & 3 deletions flopy/mf6/data/mffileaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1802,9 +1802,9 @@ def load_list_line(
keyword_data_item.type = (
DatumType.string
)
self._temp_dict[
data_item.name
] = keyword_data_item
self._temp_dict[data_item.name] = (
keyword_data_item
)
(
data_index,
more_data_expected,
Expand Down
19 changes: 10 additions & 9 deletions flopy/mf6/data/mfstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import ast
import keyword
import os
Expand Down Expand Up @@ -275,9 +276,9 @@ def get_block_structure_dict(self, path, common, model_file, block_parent):
current_block.add_dataset(block_dataset_struct)
else:
new_data_item_struct.block_type = block_type
dataset_items_in_block[
new_data_item_struct.name
] = new_data_item_struct
dataset_items_in_block[new_data_item_struct.name] = (
new_data_item_struct
)

# if data item belongs to existing dataset(s)
item_location_found = False
Expand Down Expand Up @@ -585,9 +586,9 @@ def get_block_structure_dict(self, path, common, model_file, block_parent):
current_block.add_dataset(block_dataset_struct)
else:
new_data_item_struct.block_type = block_type
dataset_items_in_block[
new_data_item_struct.name
] = new_data_item_struct
dataset_items_in_block[new_data_item_struct.name] = (
new_data_item_struct
)

# if data item belongs to existing dataset(s)
item_location_found = False
Expand Down Expand Up @@ -651,9 +652,9 @@ def get_block_structure_dict(self, path, common, model_file, block_parent):
key,
val,
) in new_data_item_struct.keystring_dict.items():
keystring_items_needed_dict[
key
] = new_data_item_struct
keystring_items_needed_dict[key] = (
new_data_item_struct
)

# if data set does not exist
if not item_location_found:
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/mfbase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Base classes for Modflow 6 """

import copy
import inspect
import os
Expand Down
6 changes: 3 additions & 3 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,9 @@ def inspect_cells(
# call the package's "inspect_cells" method
package_output = pp.inspect_cells(cell_list, stress_period)
if len(package_output) > 0:
output_by_package[
f"{pp.package_name} package"
] = package_output
output_by_package[f"{pp.package_name} package"] = (
package_output
)
# get dependent variable
if inspect_dependent_var:
try:
Expand Down
18 changes: 9 additions & 9 deletions flopy/mf6/mfpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def __init__(
"blk_post_comment",
)
if self.blk_trailing_comment_path not in simulation_data.mfdata:
simulation_data.mfdata[
self.blk_trailing_comment_path
] = MFComment("", "", simulation_data, 0)
simulation_data.mfdata[self.blk_trailing_comment_path] = (
MFComment("", "", simulation_data, 0)
)
if self.blk_post_comment_path not in simulation_data.mfdata:
simulation_data.mfdata[self.blk_post_comment_path] = MFComment(
"\n", "", simulation_data, 0
Expand Down Expand Up @@ -856,9 +856,9 @@ def load(self, block_header, fd, strict=True):
aux_vars = self._container_package.auxiliary.get_data()
if aux_vars is not None:
for var_name in list(aux_vars[0])[1:]:
self.datasets_keyword[
(var_name,)
] = self._container_package.aux.structure
self.datasets_keyword[(var_name,)] = (
self._container_package.aux.structure
)

comments = []

Expand Down Expand Up @@ -2838,9 +2838,9 @@ def is_valid(self):

def _load_blocks(self, fd_input_file, strict=True, max_blocks=sys.maxsize):
# init
self._simulation_data.mfdata[
self.path + ("pkg_hdr_comments",)
] = MFComment("", self.path, self._simulation_data)
self._simulation_data.mfdata[self.path + ("pkg_hdr_comments",)] = (
MFComment("", self.path, self._simulation_data)
)
self.post_block_comments = MFComment(
"", self.path, self._simulation_data
)
Expand Down
1 change: 1 addition & 0 deletions flopy/mf6/utils/createpackages.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
files, the package classes, and updated init.py that createpackages.py created.
"""

import datetime
import os
import textwrap
Expand Down
Loading

0 comments on commit 7172e30

Please sign in to comment.