xdas.DataCollection.query#

DataCollection.query(indexers=None, **indexers_kwargs)[source]#

Query a given subset from a data collection.

The data collection is walked through, if any node name corresponds to a key of the indexers, the corresponding value is used to select a subset of that node.

Parameters:
  • indexers (dict, optional) – A dict with keys matching fields and values given by string or int.

  • **indexers_kwargs (dict, optional) – The keyword arguments form of indexers. Overwrite indexers input if both are provided.

Returns:

The queried data.

Return type:

DataCollection

Examples

>>> import xdas as xd
>>> from xdas.synthetics import wavelet_wavefronts
>>> da = wavelet_wavefronts()
>>> dc = xd.DataCollection(
...     {
...         "das1": ("acquisition", [da, da]),
...         "das2": ("acquisition", [da, da, da]),
...     },
...     "instrument",
... )
>>> dc.query(instrument="das1", acquisition=0)
Instrument:
  das1:
    Acquisition:
    0: <xdas.DataArray (time: 300, distance: 401)>