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

Function _chunked_array_with_chunks_hint

xarray/core/indexing.py:1524–1534  ·  view source on GitHub ↗

Create a chunked array using the chunks hint for dimensions of size > 1.

(
    array, chunks, chunkmanager: ChunkManagerEntrypoint[Any]
)

Source from the content-addressed store, hash-verified

1522
1523
1524def _chunked_array_with_chunks_hint(
1525 array, chunks, chunkmanager: ChunkManagerEntrypoint[Any]
1526):
1527 """Create a chunked array using the chunks hint for dimensions of size > 1."""
1528
1529 if len(chunks) < array.ndim:
1530 raise ValueError("not enough chunks in hint")
1531 new_chunks = []
1532 for chunk, size in zip(chunks, array.shape, strict=False):
1533 new_chunks.append(chunk if size > 1 else (1,))
1534 return chunkmanager.from_array(array, new_chunks) # type: ignore[arg-type]
1535
1536
1537def _logical_any(args):

Callers 1

Calls 1

from_arrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…