MCPcopy Index your code
hub / github.com/pydata/xarray / load_async

Method load_async

xarray/core/dataarray.py:1179–1214  ·  view source on GitHub ↗

Trigger and await asynchronous loading of data into memory and return this dataarray. Data will be computed and/or loaded from disk or a remote source. Unlike ``.compute``, the original dataarray is modified and returned. Only works when opening data lazily from IO storage

(self, **kwargs)

Source from the content-addressed store, hash-verified

1177 return self
1178
1179 async def load_async(self, **kwargs) -> Self:
1180 """Trigger and await asynchronous loading of data into memory and return this dataarray.
1181
1182 Data will be computed and/or loaded from disk or a remote source.
1183
1184 Unlike ``.compute``, the original dataarray is modified and returned.
1185
1186 Only works when opening data lazily from IO storage backends which support lazy asynchronous loading.
1187 Otherwise will raise a NotImplementedError.
1188
1189 Note users are expected to limit concurrency themselves - xarray does not internally limit concurrency in any way.
1190
1191 Parameters
1192 ----------
1193 **kwargs : dict
1194 Additional keyword arguments passed on to ``dask.compute``.
1195
1196 Returns
1197 -------
1198 object : Dataarray
1199 Same object but with lazy data and coordinates as in-memory arrays.
1200
1201 See Also
1202 --------
1203 dask.compute
1204 DataArray.compute
1205 DataArray.load
1206 Dataset.load_async
1207 Variable.load_async
1208 """
1209 temp_ds = self._to_temp_dataset()
1210 ds = await temp_ds.load_async(**kwargs)
1211 new = self._from_temp_dataset(ds)
1212 self._variable = new._variable
1213 self._coords = new._coords
1214 return self
1215
1216 def compute(self, **kwargs) -> Self:
1217 """Trigger loading data into memory and return a new dataarray.

Callers

nothing calls this directly

Calls 2

_to_temp_datasetMethod · 0.95
_from_temp_datasetMethod · 0.95

Tested by

no test coverage detected