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

Function _masked_result_drop_slice

xarray/core/indexing.py:1541–1563  ·  view source on GitHub ↗
(key, data: duckarray[Any, Any] | None = None)

Source from the content-addressed store, hash-verified

1539
1540
1541def _masked_result_drop_slice(key, data: duckarray[Any, Any] | None = None):
1542 key = (k for k in key if not isinstance(k, slice))
1543 chunks_hint = getattr(data, "chunks", None)
1544
1545 new_keys = []
1546 for k in key:
1547 if isinstance(k, np.ndarray):
1548 if is_chunked_array(data): # type: ignore[arg-type]
1549 chunkmanager = get_chunked_array_type(data)
1550 new_keys.append(
1551 _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
1552 )
1553 elif isinstance(data, array_type("sparse")):
1554 import sparse
1555
1556 new_keys.append(sparse.COO.from_numpy(k))
1557 else:
1558 new_keys.append(k)
1559 else:
1560 new_keys.append(k)
1561
1562 mask = _logical_any(k == -1 for k in new_keys)
1563 return mask
1564
1565
1566def create_mask(

Callers 1

create_maskFunction · 0.85

Calls 5

is_chunked_arrayFunction · 0.90
get_chunked_array_typeFunction · 0.90
array_typeFunction · 0.90
_logical_anyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…