Skip to content

Commit 444a629

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b958f0d commit 444a629

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

tests/test_windowed_array.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ def test_windowed_isel_backward_clock_loads_once_and_evicts():
7171
assert win.loads == ntime # each time level read exactly once, going backward
7272
assert max_cache <= 2 # only the bracketing levels resident
7373

74-
@pytest.mark.parametrize("fset_convention, ds",
75-
[(FieldSet.from_sgrid_conventions, simple_UV_dataset(mesh="flat")),
76-
(FieldSet.from_ugrid_conventions, _ux_constant_flow_face_centered_2D())],
77-
ids=["structured", "unstructured"]
78-
)
74+
75+
@pytest.mark.parametrize(
76+
"fset_convention, ds",
77+
[
78+
(FieldSet.from_sgrid_conventions, simple_UV_dataset(mesh="flat")),
79+
(FieldSet.from_ugrid_conventions, _ux_constant_flow_face_centered_2D()),
80+
],
81+
ids=["structured", "unstructured"],
82+
)
7983
def test_windowed_arrays_wraps_dask_but_not_numpy(fset_convention: callable, ds: xr.Dataset):
8084
fset_np = fset_convention(ds, mesh="flat")
8185
fset_dk = fset_convention(ds.chunk({"time": 1}), mesh="flat")
@@ -95,11 +99,15 @@ def test_windowed_arrays_wraps_dask_but_not_numpy(fset_convention: callable, ds:
9599
assert fset_dk.U.data.dims == fset_np.U.data.dims
96100
assert fset_dk.U.data.shape == fset_np.U.data.shape
97101

98-
@pytest.mark.parametrize("fset_convention, ds",
99-
[(FieldSet.from_sgrid_conventions, simple_UV_dataset(mesh="flat")),
100-
(FieldSet.from_ugrid_conventions, _ux_constant_flow_face_centered_2D())],
101-
ids=["structured", "unstructured"]
102-
)
102+
103+
@pytest.mark.parametrize(
104+
"fset_convention, ds",
105+
[
106+
(FieldSet.from_sgrid_conventions, simple_UV_dataset(mesh="flat")),
107+
(FieldSet.from_ugrid_conventions, _ux_constant_flow_face_centered_2D()),
108+
],
109+
ids=["structured", "unstructured"],
110+
)
103111
def test_to_windowed_arrays_is_idempotent_and_forwards_max_levels(fset_convention: callable, ds: xr.Dataset):
104112
fs = fset_convention(ds.chunk({"time": 1}), mesh="flat")
105113

@@ -170,6 +178,7 @@ def run(chunked):
170178
np.testing.assert_allclose(x_dk, x_np, atol=1e-9)
171179
np.testing.assert_allclose(y_dk, y_np, atol=1e-9)
172180

181+
173182
@pytest.mark.parametrize("mesh", ["flat", "spherical"])
174183
@pytest.mark.parametrize("dt_minutes", [15, -15], ids=["forward", "backward"])
175184
def test_dask_advection_matches_numpy_on_unstructured_grids(mesh, dt_minutes):
@@ -184,7 +193,7 @@ def run(chunked):
184193
fs = FieldSet.from_ugrid_conventions(d, mesh=mesh)
185194
if chunked:
186195
fs.to_windowed_arrays()
187-
pset = ParticleSet(fs, x=10*np.ones(10), y=np.linspace(5, 15, 10))
196+
pset = ParticleSet(fs, x=10 * np.ones(10), y=np.linspace(5, 15, 10))
188197
pset.execute(AdvectionRK2, runtime=3600, dt=np.timedelta64(dt_minutes, "m"))
189198
return np.array(pset.x), np.array(pset.y)
190199

0 commit comments

Comments
 (0)