diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 4f5c4fe5ddf..34acac1514f 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -3007,6 +3007,9 @@ def isel( if drop and var.ndim == 0 and name in coord_names: coord_names.remove(name) continue + # Update our reference to `var_dims` after the call to isel + # to reflect any dropped dimensions + var_dims = var.dims variables[name] = var dims.update(zip(var_dims, var.shape))