Skip to content

Commit e380c0a

Browse files
committed
Refactor
1 parent e175ca3 commit e380c0a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/parcels/convert.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,13 @@ def nemo_to_sgrid(*, coords: xr.Dataset, **fields: dict[str, xr.Dataset | xr.Dat
245245
"Dataset already has a 'grid' variable (according to cf_roles). Didn't expect there to be grid metadata on copernicusmarine datasets - please open an issue with more information about your dataset."
246246
)
247247

248-
# Update to use lon and lat internally
249-
250-
ds = ds.rename({"gphif": "lat", "glamf": "lon"}) # TODO: Logging message about rename
251248
ds["grid"] = xr.DataArray(
252249
0,
253250
attrs=sgrid.Grid2DMetadata(
254251
cf_role="grid_topology",
255252
topology_dimension=2,
256253
node_dimensions=("x", "y"),
257-
node_coordinates=("lon", "lat"),
254+
node_coordinates=("glamf", "gphif"),
258255
face_dimensions=(
259256
sgrid.DimDimPadding("x_center", "x", sgrid.Padding.LOW),
260257
sgrid.DimDimPadding("y_center", "y", sgrid.Padding.LOW),
@@ -264,6 +261,9 @@ def nemo_to_sgrid(*, coords: xr.Dataset, **fields: dict[str, xr.Dataset | xr.Dat
264261
)
265262

266263
# NEMO models are always in degrees
267-
ds["lon"].attrs["units"] = "degrees"
268-
ds["lat"].attrs["units"] = "degrees"
264+
ds["glamf"].attrs["units"] = "degrees"
265+
ds["gphif"].attrs["units"] = "degrees"
266+
267+
# Update to use lon and lat for internal naming
268+
ds = sgrid.rename(ds, {"gphif": "lat", "glamf": "lon"}) # TODO: Logging message about rename
269269
return ds

0 commit comments

Comments
 (0)