MCPcopy
hub / github.com/pydata/xarray / compute

Method compute

xarray/core/dataarray.py:1216–1247  ·  view source on GitHub ↗

Trigger loading data into memory and return a new dataarray. Data will be computed and/or loaded from disk or a remote source. Unlike ``.load``, the original dataarray is left unaltered. Normally, it should not be necessary to call this method in user code, because

(self, **kwargs)

Source from the content-addressed store, hash-verified

1214 return self
1215
1216 def compute(self, **kwargs) -> Self:
1217 """Trigger loading data into memory and return a new dataarray.
1218
1219 Data will be computed and/or loaded from disk or a remote source.
1220
1221 Unlike ``.load``, the original dataarray is left unaltered.
1222
1223 Normally, it should not be necessary to call this method in user code,
1224 because all xarray functions should either work on deferred data or
1225 load data automatically. However, this method can be necessary when
1226 working with many file objects on disk.
1227
1228 Parameters
1229 ----------
1230 **kwargs : dict
1231 Additional keyword arguments passed on to ``dask.compute``.
1232
1233 Returns
1234 -------
1235 object : DataArray
1236 New object with the data and all coordinates as in-memory arrays.
1237
1238 See Also
1239 --------
1240 dask.compute
1241 DataArray.load
1242 DataArray.load_async
1243 Dataset.compute
1244 Variable.compute
1245 """
1246 new = self.copy(deep=False)
1247 return new.load(**kwargs)
1248
1249 def persist(self, **kwargs) -> Self:
1250 """Trigger computation in constituent dask arrays

Calls 2

copyMethod · 0.95
loadMethod · 0.45

Tested by 13

test_dataarray_pickleMethod · 0.76
test_idxmin_chunkingFunction · 0.76
test_lazy_groupingFunction · 0.76
test_integrateFunction · 0.76
test_trapezoid_datetimeFunction · 0.76
test_curvefitMethod · 0.76