diff --git a/src/parcels/_core/model.py b/src/parcels/_core/model.py index 7a0945573..79c9c6460 100644 --- a/src/parcels/_core/model.py +++ b/src/parcels/_core/model.py @@ -103,12 +103,10 @@ def to_windowed_arrays(self, *, max_levels: int | None = None) -> Self: and ``max_levels`` then bounds its size. """ windowed = self.__dict__.setdefault("_windowed", {}) - for dim in ["lon", "lat"]: - # ensure lon and lat are loaded into memory for dask-backed datasets - if is_dask_collection(self.data[dim]): + for dim in ["lon", "lat", "depth"]: + # ensure lon, lat, depth are loaded into memory for dask-backed datasets + if dim in self.data and is_dask_collection(self.data[dim]): self.data[dim].load() - if "depth" in self.data.dims and is_dask_collection(self.data["depth"]): - self.data["depth"].load() for name in self.scalar_field_names: current = windowed.get(name, self.data[name]) windowed[name] = maybe_windowed(current, max_levels=max_levels)