File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import numpy .typing as npt
88import xarray as xr
99import xgcm
10+ from dask import is_dask_collection
1011
1112import parcels ._sgrid as sgrid
1213import parcels ._typing as ptyping
@@ -207,6 +208,9 @@ def lon(self):
207208 _ = self .xgcm_grid .axes ["X" ]
208209 except KeyError :
209210 return np .zeros (1 )
211+ # ensure lon is loaded into memory for dask-backed datasets, as it is used in the search method
212+ if is_dask_collection (self ._ds ["lon" ].data ):
213+ self ._ds ["lon" ].load ()
210214 return self ._ds ["lon" ].values
211215
212216 @property
@@ -221,6 +225,9 @@ def lat(self):
221225 _ = self .xgcm_grid .axes ["Y" ]
222226 except KeyError :
223227 return np .zeros (1 )
228+ # ensure lat is loaded into memory for dask-backed datasets, as it is used in the search method
229+ if is_dask_collection (self ._ds ["lat" ].data ):
230+ self ._ds ["lat" ].load ()
224231 return self ._ds ["lat" ].values
225232
226233 @property
You can’t perform that action at this time.
0 commit comments