Hi!
I’m new to this forum so I hope this is the right place to ask this question, if not feel free to redirect me.
I would like to reproduce the following numpy functionality : np.logical_and.reduce([array_1, array_2,...])
for an arbitrary number of arrays.
I figured this is possible via:
import dask.array as da
import numpy as np
data_1 = da.from_array(
np.array(
[
[False, True, True, True],
[True, True, True, True],
[False, False, False, False],
[True, True, True, True],
]
),
chunks=2,
)
data_2 = da.from_array(
np.array(
[
[True, True, True, True],
[True, True, True, True],
[False, False, False, False],
[True, True, True, True],
]
),
chunks=2,
)
data = [data_1, data_2]
output = da.map_blocks(lambda *arrays: np.logical_and.reduce(arrays), *data, chunks=data_1.chunks).compute()
output
However, I’m curious if I can do the same thing via dask.array.reduction()
. I haven’t found many examples using dask.array.reduction
so I’m curious if this is possible and if so, how
thanks in advance!