import numpy as np
from dascore.core.source import ArraySource
from dascore.core.lazy_array import LazyArray
array = LazyArray.from_source(ArraySource.full((6, 4), np.nan))
assert array.shape == (6, 4) and array.ndim == 2
window = array[2:5]
assert window.shape == (3, 4)
assert np.isnan(window.load()).all()LazyArray
LazyArray(
table ,
row ,
)
An array which says where each of its members is read from.
A view of one row of a LazyTable. Slicing and transposing keep a window and an axis order instead, and the members are clipped to them only when something needs them. The shape, ndim and dtype are stored rather than derived, so an array which selects nothing still knows what it is. Boxes may not overlap and must cover the whole output; a hole is an explicit constant member. validate checks every rule, on demand.
A member is cast once, from the dtype it is stored at to the array’s, so a chain of joins does not round at each step as numpy would. A caller reproducing a buffer which did round states where, per member, with cast_via.
Examples
Methods
| Name | Description |
|---|---|
| from_columns | Return an array which reads one member per row, laid end to end. |
| from_frame |
Return the array to_frame wrote.
|
| load | Read every member and return the array they make. |
| rechunk | Cut the array at new bounds along one axis, giving one array each. |
| source | Return the source one member reads, resolved against its base uri. |
| to_frame | Return one row per member per output axis, for inspection. |
| transpose | Return the array with its output axes permuted. |
| validate |
Check the array’s rules, raising ParameterError for the first broken.
|