Skip to content

Commit aad1377

Browse files
Remove assignment of interpolator in from_fesom2
We don't want to provide this convenience here, due to the fact that some variable placements are not supported (e.g. on an edge), but we don't want to prevent someone who is building a new interpolator from leveraging this new from_fesom2 method.
1 parent 0b20ab1 commit aad1377

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/parcels/_core/fieldset.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ def from_fesom2(ds: ux.UxDataset):
282282
grid = UxGrid(ds.uxgrid, z=ds.coords["nz"])
283283
ds = _discover_fesom2_U_and_V(ds)
284284

285+
for var in ds.data_vars:
286+
if "location" not in ds[var].attrs:
287+
raise ValueError(
288+
f"Variable {var!r} missing required attribute 'location' to indicate its placement on the mesh."
289+
)
290+
if ds[var].attrs["location"] not in location_to_interpmethod:
291+
raise ValueError(
292+
f"Variable {var!r} has attribute 'location' with unexpected value {ds[var].attrs['location']!r}. Expected one of {list(location_to_interpmethod.keys())}"
293+
)
294+
285295
fields = {}
286296
if "U" in ds.data_vars and "V" in ds.data_vars:
287297
fields["U"] = Field("U", ds["U"], grid, location_to_interpmethod[ds["U"].attrs.get("location")])

0 commit comments

Comments
 (0)