select

method of dascore.core.spool.Spool source

select(
    self ,
    _attrs: collections.abc.Mapping[collections.abc.Mapping[str, Any], str, collections.abc.Iterable[str], None] = None,
    _coords: collections.abc.Mapping[collections.abc.Mapping[str, Any], str, collections.abc.Iterable[str], None] = None,
    samples: bool = False,
    relative: bool = False,
    **kwargs ,
)-> ‘Self’

Sub-select parts of the spool.

Can be used to specify dimension ranges, or unix-style matches on string attributes. Bare keyword names resolve against attributes first, then coordinates; unknown names raise.

Parameters

Parameter Description
_attrs Attribute selections: a dict of name -> selector (the
general form — required when a name cannot be a Python
keyword) or a name/collection of names tagging bare kwargs
as attributes (disambiguates names shared with coordinates).
_coords Coordinate selections; same forms as _attrs, validating
names as coordinates only.
samples If True, selections are coordinate-only and given in sample
indices; they never exclude patches, but are applied to each
patch as it loads.
relative If True, range bounds are relative to the spool’s coordinate
envelope: positive from the start, negative from the end.
**kwargs Specifies query. Can be of the form {dim_name=(start, stop)}
or {attr_name=query}.

Examples

import dascore as dc
spool = dc.get_example_spool("diverse_das")
# subselect data in a particular time range
time = ('2020-01-03', '2020-01-03T00:00:10')
time_spool = spool.select(time=time)
# subselect based on matching tag parameter
tag_spool = spool.select(tag='some*')