Skip to content

Commit 973c2b0

Browse files
committed
Run pre-commit
1 parent 2e27071 commit 973c2b0

File tree

8 files changed

+15
-17
lines changed

8 files changed

+15
-17
lines changed

.github/ci/min_deps_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def main() -> None:
193193
print("\nErrors:")
194194
print("-------")
195195
for i, e in enumerate(errors):
196-
print(f"{i+1}. {e}")
196+
print(f"{i + 1}. {e}")
197197
sys.exit(1)
198198

199199

docs/examples/tutorial_nemo_3D.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"print(\n",
122122
" f\"Level[{int(depth_level)}] depth is: \"\n",
123123
" f\"[{fieldset.W.grid.depth[depth_level]:g} \"\n",
124-
" f\"{fieldset.W.grid.depth[depth_level+1]:g}]\"\n",
124+
" f\"{fieldset.W.grid.depth[depth_level + 1]:g}]\"\n",
125125
")\n",
126126
"\n",
127127
"plt.pcolormesh(\n",

docs/examples/tutorial_peninsula_AvsCgrid.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
" # Set the same limits for all subplots\n",
243243
" ax.set_xlim([fieldset.U.lon.min(), fieldset.U.lon.max()])\n",
244244
" ax.set_ylim([0, 23e3])\n",
245-
" m2km = lambda x, _: f\"{x/1000:.1f}\"\n",
245+
" m2km = lambda x, _: f\"{x / 1000:.1f}\"\n",
246246
" ax.xaxis.set_major_formatter(m2km)\n",
247247
" ax.yaxis.set_major_formatter(m2km)\n",
248248
" ax.set_xlabel(\"x [km]\")\n",
@@ -306,7 +306,7 @@
306306
"ax.set_ylim([0, 23e3])\n",
307307
"ax.set_ylabel(\"y [km]\")\n",
308308
"ax.set_xlabel(\"x [km]\")\n",
309-
"m2km = lambda x, _: f\"{x/1000:.1f}\"\n",
309+
"m2km = lambda x, _: f\"{x / 1000:.1f}\"\n",
310310
"ax.xaxis.set_major_formatter(m2km)\n",
311311
"ax.yaxis.set_major_formatter(m2km)\n",
312312
"\n",

docs/v4/api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ classDiagram
3535
Here, important things to note are:
3636

3737
- Interpolators (which would implement the `Interpolator` protocol) are responsible for the actual interpolation of the data, and performance considerations. There will be interpolation and indexing utilities that can be made available to the interpolators, allowing for code re-use.
38-
3938
- Interpolators of the data should handle spatial periodicity and, for the case of rectilinear structured grids, without pre-computing a halo for the FieldSet and Grid ([issue](https://github.com/OceanParcels/Parcels/issues/1898)).
4039

4140
- In the `Field` class, not all combinations of `data`, `grid`, and `interpolator` will logically make sense (e.g., a `xr.DataArray` on a `ux.Grid`, or `ux.DataArray` on a `parcels.Grid`). It's up to the `Interpolator.assert_is_compatible(Field)` to define what is and is not compatible, and raise `ValueError` / `TypeError` on incompatible data types. The `.assert_is_compatible()` method also acts as developer documentation, defining clearly for the `.interpolate()` method what assumptions it is working on. The `.assert_is_compatible()` method should be lightweight as it will be called on `Field` initialisation.

parcels/interaction/interactionkernel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def __init__(
7474

7575
numkernelargs = self.check_kernel_signature_on_version()
7676

77-
assert numkernelargs[0] == 5 and numkernelargs.count(numkernelargs[0]) == len(
78-
numkernelargs
79-
), "Interactionkernels take exactly 5 arguments: particle, fieldset, time, neighbors, mutator"
77+
assert numkernelargs[0] == 5 and numkernelargs.count(numkernelargs[0]) == len(numkernelargs), (
78+
"Interactionkernels take exactly 5 arguments: particle, fieldset, time, neighbors, mutator"
79+
)
8080

8181
def check_fieldsets_in_kernels(self, pyfunc):
8282
# Currently, the implemented interaction kernels do not impose

parcels/particleset.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ def __init__(
133133
for kwvar in kwargs:
134134
if kwvar not in ["partition_function"]:
135135
kwargs[kwvar] = convert_to_flat_array(kwargs[kwvar])
136-
assert (
137-
lon.size == kwargs[kwvar].size
138-
), f"{kwvar} and positions (lon, lat, depth) don't have the same lengths."
136+
assert lon.size == kwargs[kwvar].size, (
137+
f"{kwvar} and positions (lon, lat, depth) don't have the same lengths."
138+
)
139139

140140
self._data = {
141141
"lon": lon.astype(lonlatdepth_dtype),
@@ -233,9 +233,9 @@ def add(self, particles):
233233
The current ParticleSet
234234
235235
"""
236-
assert (
237-
particles is not None
238-
), f"Trying to add another {type(self)} to this one, but the other one is None - invalid operation."
236+
assert particles is not None, (
237+
f"Trying to add another {type(self)} to this one, but the other one is None - invalid operation."
238+
)
239239
assert type(particles) is type(self)
240240

241241
if len(particles) == 0:

parcels/tools/timer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def print_tree_sequential(self, step=0, root_time=0, parent_time=0):
4848
if step > 0:
4949
print(f"({round(time / parent_time * 100):3d}%) ", end="")
5050
t_str = f"{time:1.3e} s" if root_time < 300 else datetime.timedelta(seconds=time)
51-
print(f"Timer {(self._name).ljust(20 - 2*step + 7*(step == 0))}: {t_str}")
51+
print(f"Timer {(self._name).ljust(20 - 2 * step + 7 * (step == 0))}: {t_str}")
5252
for child in self._children:
5353
child.print_tree_sequential(step + 1, root_time, time)
5454

parcels/xgcm/grid.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,7 @@ def check_neighbor(link, position):
516516
neighbor_link = face_links[idx][ax][correct_position]
517517
except (KeyError, IndexError):
518518
raise KeyError(
519-
f"Couldn't find a face link for face {idx!r}"
520-
f"in axis {ax!r} at position {correct_position!r}"
519+
f"Couldn't find a face link for face {idx!r}in axis {ax!r} at position {correct_position!r}"
521520
)
522521
idx_n, ax_n, rev_n = neighbor_link
523522
if ax not in self.axes:

0 commit comments

Comments
 (0)