Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/parcels/_core/spatialhash.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,9 @@ def _spherical_face_bounds(verts):
# A triangle with no area encloses nothing. Rather
# than let np.linalg.solve raise on it, conver those faces' weights to NaN.
weights = np.full(M.shape[:-1] + (len(_AXIS_POINTS),), np.nan)
has_area = np.abs(np.linalg.det(M)) > 1e-14
# Faces with NaN nodes give a NaN determinant
with np.errstate(invalid="ignore"):
has_area = np.abs(np.linalg.det(M)) > 1e-14
if has_area.any():
weights[has_area] = np.linalg.solve(M[has_area], _AXIS_POINTS.T)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_vectorfield_init_different_time_intervals():
dsV["timeV"] = dsV["timeV"] + np.timedelta64(1, "D")
dsV["timeV"].attrs["axis"] = "T"

ds = xr.merge([dsU, dsV])
ds = xr.merge([dsU, dsV], compat="no_conflicts")
with pytest.raises(ValueError, match="Multiple time coordinates"):
FieldSet.from_sgrid_conventions(ds)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_fieldset.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def test_vectorfields_without_time():
"""Test that vector fields without a time dimension can be evaluated."""
ds1 = datasets_structured["ds_2d_left"][["U_A_grid", "V_A_grid", "grid"]].rename({"U_A_grid": "U", "V_A_grid": "V"})
ds2 = ds1.isel(time=0).drop_vars("time").rename({"U": "U_const", "V": "V_const"})
ds = xr.merge([ds1, ds2])
ds = xr.merge([ds1, ds2], compat="no_conflicts")

fset = FieldSet.from_sgrid_conventions(ds, vector_fields={"UV_const": ("U_const", "V_const")})
fset.UV_const.eval(t=0, z=0, y=0, x=0)
Expand Down
Loading