Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions reproject/_array_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,16 @@ def aligned_chunks(lo, hi, edges=edges):


class ArrayWrapper:
"""
A minimal getitem-only wrapper hiding an array from dask's tokenizer.

Passing a Numpy array (in particular a memmap) directly to
``da.from_array`` can make dask hash the whole buffer to compute the array
name, which silently loads the entire file into memory (see
https://github.com/dask/dask/issues/11850). Wrapping the array so that
dask can only access it through ``__getitem__``, combined with an explicit
``name=``, guarantees the data is only ever read chunk by chunk.
"""

def __init__(self, array):
self._array = array
Expand Down
Loading
Loading