build_patches

function of dascore.io.utils source

build_patches(
    coords: CoordManager ,
    data: ndarray ,
    attrs: dascore.core.attrs.PatchAttrs | collections.abc.Mapping[PatchAttrs, collections.abc.Mapping[str, Any], None] = None,
    attr_cls: type[type[PatchAttrs], None] = None,
    selection: collections.abc.Mapping[collections.abc.Mapping[str, Any], None] = None,
)-> ‘list[dc.Patch]’

Trim a data source to a selection and build the resulting patch list.

This is the tail most single-patch readers share. It returns one patch, or nothing if the selection left no data.

Parameters

Parameter Description
coords The coordinates of the untrimmed patch.
data The patch data, often an unread node (eg an h5 dataset).
attrs The patch attributes, or anything convertible to them.
attr_cls The format’s PatchAttrs subclass. Defaults to PatchAttrs.
selection A mapping of {dimension_name: selection}, eg {“time”: (t1, t2)}.
None values are dropped, so a read with nothing to trim never
touches the data source. Passed to CoordManager.select, which
ignores names it doesn’t know.