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

Function contains_only_chunked_or_numpy

xarray/core/utils.py:1197–1212  ·  view source on GitHub ↗

Returns True if xarray object contains only numpy arrays or chunked arrays (i.e. pure dask or cubed). Expects obj to be Dataset or DataArray

(obj)

Source from the content-addressed store, hash-verified

1195
1196
1197def contains_only_chunked_or_numpy(obj) -> bool:
1198 """Returns True if xarray object contains only numpy arrays or chunked arrays (i.e. pure dask or cubed).
1199
1200 Expects obj to be Dataset or DataArray"""
1201 from xarray.core.dataarray import DataArray
1202 from xarray.core.indexing import ExplicitlyIndexed
1203 from xarray.namedarray.pycompat import is_chunked_array
1204
1205 if isinstance(obj, DataArray):
1206 obj = obj._to_temp_dataset()
1207
1208 return all(
1209 isinstance(var._data, ExplicitlyIndexed | np.ndarray)
1210 or is_chunked_array(var._data)
1211 for var in obj._variables.values()
1212 )
1213
1214
1215def find_stack_level(test_mode=False) -> int:

Callers 15

countMethod · 0.90
allMethod · 0.90
anyMethod · 0.90
maxMethod · 0.90
minMethod · 0.90
meanMethod · 0.90
prodMethod · 0.90
sumMethod · 0.90
stdMethod · 0.90
varMethod · 0.90
cumsumMethod · 0.90
countMethod · 0.90

Calls 3

is_chunked_arrayFunction · 0.90
_to_temp_datasetMethod · 0.80
valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…