I am trying to manually iterate through the chunks of a dask array, one by one, and apply my computation. I understand that a benefit of dask is that it can to do the iteration for me, but my computation is failing (for reasons that I don't think are related to dask) and I want to iterate through manually for the purpose of debugging. How would I do that?
I am imagining something like:
import dask.array as da
data = da.random.randint(0, 30, size=(1_000, 100, 100), chunks=(-1, 10, 10))
for chunk in data.iterchunks():
# chunk would contain some information about which chunk I have access to,
# and I could somehow get the data contained in that chunk
chunk_data = get_chunk(chunk)
my_function(chunk_data)
Where the chunk that I get back has some information about which chunk I am in, and there would also be get the data for that chunk.