diff --git a/cf_xarray/geometry.py b/cf_xarray/geometry.py index fb520796..6e4f1090 100644 --- a/cf_xarray/geometry.py +++ b/cf_xarray/geometry.py @@ -412,8 +412,8 @@ def reshape_unique_geometries( out = out.unstack(temp_name) # geom_var was reshaped also, reconstruct it from the unique values. - unique_indexes = xr.DataArray(unique_indexes, dims=(new_dim,)) - out[geom_var] = ds[geom_var].isel({old_name: unique_indexes}) + unique_indexes_da = xr.DataArray(unique_indexes, dims=(new_dim,)) + out[geom_var] = ds[geom_var].isel({old_name: unique_indexes_da}) if old_name not in ds.coords: # If there was no coord before, drop the dummy one we made. out = out.drop_vars(old_name) # type: ignore[arg-type,unused-ignore] # Hashable/str stuff