Skip to content

Commit fc86d90

Browse files
committed
Update convert.fesom_to_ugrid
1 parent 3141fca commit fc86d90

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/parcels/convert.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,8 @@ def fesom_to_ugrid(ds: ux.UxDataset) -> ux.UxDataset:
685685
Renames vertical dimensions:
686686
- nz -> zf (vertical layer faces/interfaces)
687687
- nz1 -> zc (vertical layer centers)
688+
- nod2 -> n_face (face)
689+
- elem -> n_node (node)
688690
689691
Parameters
690692
----------
@@ -706,6 +708,11 @@ def fesom_to_ugrid(ds: ux.UxDataset) -> ux.UxDataset:
706708
>>> fieldset = FieldSet.from_ugrid_conventions(ds_ugrid, mesh="flat")
707709
"""
708710
ds = ds.copy()
711+
712+
for try_dim, target in [("nod2", "n_face"), ("elem", "n_node")]:
713+
if try_dim in ds.dims:
714+
ds = ds.rename_dims({try_dim: target})
715+
709716
interface_dim, center_dim = _detect_vertical_coordinates(ds, _FESOM2_VERTICAL_DIMS)
710717
return _rename_vertical_dims(ds, interface_dim, center_dim)
711718

0 commit comments

Comments
 (0)