stack

function of dascore.core.lazy_array source

stack(
    arrays: collections.abc.Sequence[LazyArray] ,
    axis: int = 0,
)-> ‘LazyArray’

Join arrays along a new axis, in one pass over their members.

Parameters

Parameter Description
arrays The arrays to stack; they must all have the same shape.
axis Where the new axis goes in the output.

Examples

import numpy as np
from dascore.core.source import ArraySource
from dascore.core.lazy_array import LazyArray, stack

parts = [LazyArray.from_source(ArraySource.full((2, 3), x)) for x in (1, 2)]
stacked = stack(parts, axis=1)
assert stacked.shape == (2, 2, 3)
assert np.array_equal(stacked.load(), np.stack([x.load() for x in parts], 1))