stack

function of dascore.lazy.recipe source

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

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.lazy.recipe import Recipe, stack

parts = [Recipe.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))