xdas.DataCollection#

class xdas.DataCollection(data, name=None)[source]#

Nested collection of dataarray.

Parameters:
  • data (list or dict of DataCollection or DataArray) – The nested data. It can be composed either of sequences or mapping. The leaves must be dataarrays.

  • name (str) – The name of the current level of nesting.

Returns:

The nested data as a DataSequence or DataMapping.

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
Instrument:
  das1:
    Acquisition:
      0: <xdas.DataArray (time: 300, distance: 401)>
      1: <xdas.DataArray (time: 300, distance: 401)>
  das2:
    Acquisition:
      0: <xdas.DataArray (time: 300, distance: 401)>
      1: <xdas.DataArray (time: 300, distance: 401)>
      2: <xdas.DataArray (time: 300, distance: 401)>
__init__()#

Methods

__init__()

from_netcdf(fname[, group])

Lazily read a data collection from a NetCDF file.

ismapping()

Return True if this is a DataMapping.

issequence()

Return True if this is a DataSequence.

query([indexers])

Query a given subset from a data collection.

Attributes

empty

True if the collection contains no elements.