Skip to content

Commit 6215839

Browse files
Updating XGrid construction to use f-points
1 parent 458e876 commit 6215839

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/parcels/_core/fieldset.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,32 @@ def add_constant_field(self, name: str, value, mesh: Mesh = "spherical"):
140140
coords={
141141
"time": (["time"], [np.timedelta64(0, "s")], {"axis": "T"}),
142142
"depth": (["depth"], [0], {"axis": "Z"}),
143-
"lat": (["lat"], [0], {"axis": "Y", "c_grid_axis_shift": -0.5}),
144-
"lon": (["lon"], [0], {"axis": "X", "c_grid_axis_shift": -0.5}),
145-
"lat_C": (["lat_C"], [0.5], {"axis": "Y"}), # TODO why is this needed?
146-
"lon_C": (["lon_C"], [0.5], {"axis": "X"}), # TODO why is this needed?
143+
"lat": (["lat"], [0], {"axis": "Y"}),
144+
"lon": (["lon"], [0], {"axis": "X"}),
147145
},
148146
)
149-
grid = XGrid(xgcm.Grid(ds, **_DEFAULT_XGCM_KWARGS), mesh=mesh)
147+
grid = XGrid(
148+
xgcm.Grid(
149+
ds,
150+
coords={
151+
"X": {
152+
"left": "lon",
153+
},
154+
"Y": {
155+
"left": "lat",
156+
},
157+
"Z": {
158+
"left": "depth",
159+
},
160+
"T": {
161+
"center": "time",
162+
},
163+
},
164+
autoparse_metadata=False,
165+
**_DEFAULT_XGCM_KWARGS,
166+
),
167+
mesh=mesh,
168+
)
150169
self.add_field(
151170
Field(
152171
name,

0 commit comments

Comments
 (0)