Skip to content

Commit 173c73e

Browse files
Fix loading dimensions on ugrids for WindowedArrays (#2758)
* Fix loading dimensions on ugrids * Combining lon/lat/depth in one loop
1 parent 1fd82a8 commit 173c73e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/parcels/_core/model.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ def to_windowed_arrays(self, *, max_levels: int | None = None) -> Self:
103103
and ``max_levels`` then bounds its size.
104104
"""
105105
windowed = self.__dict__.setdefault("_windowed", {})
106-
for dim in ["lon", "lat"]:
107-
# ensure lon and lat are loaded into memory for dask-backed datasets
108-
if is_dask_collection(self.data[dim]):
106+
for dim in ["lon", "lat", "depth"]:
107+
# ensure lon, lat, depth are loaded into memory for dask-backed datasets
108+
if dim in self.data and is_dask_collection(self.data[dim]):
109109
self.data[dim].load()
110-
if "depth" in self.data.dims and is_dask_collection(self.data["depth"]):
111-
self.data["depth"].load()
112110
for name in self.scalar_field_names:
113111
current = windowed.get(name, self.data[name])
114112
windowed[name] = maybe_windowed(current, max_levels=max_levels)

0 commit comments

Comments
 (0)