Skip to content

Commit 5f98158

Browse files
committed
Update naming to 'mock' axes
1 parent 70b8fef commit 5f98158

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

parcels/xgrid.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ def _drop_field_data(ds: xr.Dataset) -> xr.Dataset:
5050
def _transpose_xfield_data_to_tzyx(da: xr.DataArray, xgcm_grid: xgcm.Grid) -> xr.DataArray:
5151
"""
5252
Transpose a DataArray of any shape into a 4D array of order TZYX. Uses xgcm to determine
53-
the axes, and inserts dummy dimensions of size 1 for any axes not present in the DataArray.
53+
the axes, and inserts mock dimensions of size 1 for any axes not present in the DataArray.
5454
"""
5555
ax_dims = [(get_axis_from_dim_name(xgcm_grid.axes, dim), dim) for dim in da.dims]
5656

5757
if all(ax_dim[0] is None for ax_dim in ax_dims):
5858
# Assuming its a 1D constant field (hence has no axes)
5959
assert da.shape == (1, 1, 1, 1)
60-
return da.rename({old_dim: f"dummy{axis}" for old_dim, axis in zip(da.dims, _FIELD_DATA_ORDERING, strict=True)})
60+
return da.rename({old_dim: f"mock{axis}" for old_dim, axis in zip(da.dims, _FIELD_DATA_ORDERING, strict=True)})
6161

6262
# All dimensions must be associated with an axis in the grid
6363
if any(ax_dim[0] is None for ax_dim in ax_dims):
@@ -67,13 +67,13 @@ def _transpose_xfield_data_to_tzyx(da: xr.DataArray, xgcm_grid: xgcm.Grid) -> xr
6767

6868
axes_not_in_field = set(_FIELD_DATA_ORDERING) - set(ax_dim[0] for ax_dim in ax_dims)
6969

70-
dummy_dims_to_create = {}
70+
mock_dims_to_create = {}
7171
for ax in axes_not_in_field:
72-
dummy_dims_to_create[f"dummy{ax}"] = 1
73-
ax_dims.append((ax, f"dummy{ax}"))
72+
mock_dims_to_create[f"mock{ax}"] = 1
73+
ax_dims.append((ax, f"mock{ax}"))
7474

75-
if dummy_dims_to_create:
76-
da = da.expand_dims(dummy_dims_to_create, create_index_for_new_dim=False)
75+
if mock_dims_to_create:
76+
da = da.expand_dims(mock_dims_to_create, create_index_for_new_dim=False)
7777

7878
ax_dims = sorted(ax_dims, key=lambda x: _FIELD_DATA_ORDERING.index(x[0]))
7979

0 commit comments

Comments
 (0)