xdas#

Opening files#

open(paths[, dim, tolerance, squeeze, ...])

Open one or several files as a data array or collection.

open_dataarray(fname[, engine, vtype, ctype])

Open a dataarray.

open_mfdataarray(paths[, dim, tolerance, ...])

Open a multiple file dataset.

open_mfdatatree(paths[, dim, tolerance, ...])

Open a directory tree structure as a data collection.

open_datacollection(fname[, group])

Open a DataCollection from a file.

open_mfdatacollection(paths[, dim, ...])

Open a multiple file DataCollection.

Data manipulation#

align(*objs)

Given any number of data arrays, returns new objects with aligned dimensions.

asdataarray(obj[, tolerance])

Try to convert given object to a dataarray.

combine_by_coords(objs[, dim, tolerance, ...])

Combine several data arrays by coordinates.

combine_by_field(objs[, dim, tolerance, ...])

Combine data collections by field along a dimension.

concat(objs[, dim, tolerance, virtual, verbose])

Concatenate data arrays along a given dimension.

concatenate(objs[, dim, tolerance, virtual, ...])

Concatenate data arrays along a given dimension.

concat_coords(objs, *[, sort, return_order, ...])

Concatenate coordinate objects.

split(da[, indices_or_sections, dim, tolerance])

Split a data array along a dimension.

plot_availability(obj[, dim])

Plot the availability of a given dimension in a timeline chart.

Mathematical and statistical functions#

cumprod(da[, dim, skipna])

Return the cumulative product of elements along a given dimension.

cumsum(da[, dim, skipna])

Return the cumulative sum of elements along a given dimension.

all(da[, dim])

Test whether all elements along a given dimension evaluate to True.

any(da[, dim])

Test whether any element along a given dimension evaluates to True.

max(da[, dim, skipna])

Compute the maximum of an array or maximum along an dimension.

min(da[, dim, skipna])

Compute the minimum of an array or minimum along an dimension.

argmax(da[, dim, skipna])

Return the indices of the maximum values along an dimension.

argmin(da[, dim, skipna])

Return the indices of the minimum values along an dimension.

median(da[, dim, skipna])

Compute the median along the specified dimension.

ptp(da[, dim])

Compute the range of values along the specified dimension.

mean(da[, dim, skipna])

Compute the arithmetic mean along the specified dimension.

prod(da[, dim, skipna])

Compute the product of array elements along the specified dimension.

std(da[, dim, skipna])

Compute the standard deviation along the specified dimension.

sum(da[, dim, skipna])

Compute the sum of array elements along the specified dimension.

var(da[, dim, skipna])

Compute the variance along the specified dimension.

percentile(da, q[, dim, skipna])

Compute the q-th percentile of the data along the specified dimension.

quantile(da, q[, dim, skipna])

Compute the q-th quantile of the data along the specified dimension.

average(da[, dim, weights])

Compute the weighted average along the specified dimension.

count_nonzero(da[, dim])

Count the number of non-zero values along the specified dimension.

diff(da, dim[, n, label])

Calculate the n-th order discrete difference along given axis.

Data Structures#

DataArray#

DataArray([data, coords, dims, name, attrs])

N-dimensional array with labeled coordinates and dimensions.

Attributes

DataArray.data

The underlying array (numpy, dask, or VirtualArray).

DataArray.coords

The Coordinates container for this array.

DataArray.dims

Tuple of dimension names in axis order.

DataArray.shape

Shape tuple of the underlying data array.

DataArray.dtype

NumPy dtype of the underlying data array.

DataArray.ndim

Number of dimensions.

DataArray.size

Total number of elements.

DataArray.sizes

Dict-like mapping from dimension name to its size.

DataArray.nbytes

Total byte size of the underlying data.

DataArray.values

Materialised numpy array of all values.

DataArray.empty

True if any dimension has size zero.

DataArray.loc

Label-based indexer; supports da.loc[label] and da.loc[label] = value.

DataArray.T

Transposed array with dimension order reversed.

DataArray.conj()

Return the complex conjugate, element-wise.

DataArray.conjugate()

Return the complex conjugate, element-wise (alias of conj()).

Methods

DataArray.equals(other)

Return True if other has equal data, coordinates, dims, name, and attrs.

DataArray.get_axis_num(dim)

Return axis number corresponding to dimension in this array.

DataArray.isel([indexers, drop])

Return a new DataArray selecting indexes along the specified dimension(s).

DataArray.sel([indexers, method, endpoint, drop])

Return a new DataArray selecting index labels along the specified dimension(s).

DataArray.drop_dims(*dims)

Return a new DataArray with dims and their coordinates removed.

DataArray.drop_coords(*names)

Return a new DataArray with the named coordinates removed.

DataArray.copy([deep, data])

Return a copy of this array.

DataArray.rename([new_name_or_name_dict])

Return a new DataArray with renamed coordinates, dimensions or a new name.

DataArray.assign_coords([coords])

Assign new coordinates to this object.

DataArray.swap_dims([dims_dict])

Return a new DataArray with swapped dimensions.

DataArray.transpose(*dims)

Return a new DataArray object with transposed dimensions.

DataArray.expand_dims(dim[, axis])

Add an additional dimension at a given axis position.

DataArray.load()

Load the data into memory and return a new DataArray backed by a numpy array.

DataArray.to_xarray()

Convert to the xarray implementation of the DataArray structure.

DataArray.from_xarray(da)

Build a DataArray from an xarray.DataArray da.

DataArray.to_stream([network, station, ...])

Convert a data array into an obspy stream.

DataArray.from_stream(st[, dims])

Convert an obspy stream into a data array.

DataArray.to_netcdf(fname[, mode, group, ...])

Write DataArray contents to a netCDF file.

DataArray.from_netcdf(fname[, group])

Lazily read a data array from a NetCDF file.

DataArray.to_dict()

Convert the DataArray to a dictionary.

DataArray.from_dict(dct)

Create a DataArray from a dictionary.

DataArray.plot(*args, **kwargs)

Plot a DataArray.

DataCollection#

Constructor

DataCollection(data[, name])

Nested collection of dataarray.

Attributes

DataCollection.empty

True if the collection contains no elements.

Methods

DataCollection.query([indexers])

Query a given subset from a data collection.

DataCollection.issequence()

Return True if this is a DataSequence.

DataCollection.ismapping()

Return True if this is a DataMapping.

DataCollection.from_netcdf(fname[, group])

Lazily read a data collection from a NetCDF file.

DataMapping#

Constructor

DataMapping(data[, name])

A Mapping of dataarrays.

Methods

DataMapping.copy([deep])

Return a copy of the data collection.

DataMapping.equals(other)

Return True if other is a DataMapping with identical keys and values.

DataMapping.isel([indexers])

Perform index selection to each data array of the data collection.

DataMapping.sel([indexers, method, endpoint])

Perform labeled selection to each data array of the data collection.

DataMapping.load()

Load in memory each data array of the data collection.

DataMapping.map(atom)

Apply an atom to each data array of the data collection.

DataMapping.to_netcdf(fname[, mode, group, ...])

Write this DataMapping to a NetCDF file (see save_datamapping()).

DataMapping.from_netcdf(fname[, group])

Lazily read a DataMapping from a NetCDF file (see open_datamapping()).

DataSequence#

Constructor

DataSequence(data[, name])

A collection of dataarrays.

Methods

DataSequence.copy([deep])

Return a copy of the data collection.

DataSequence.equals(other)

Return True if other is a DataSequence with identical elements.

DataSequence.isel([indexers])

Perform index selection to each data array of the data collection.

DataSequence.sel([indexers, method, endpoint])

Perform labeled selection to each data array of the data collection.

DataSequence.load()

Load in memory each data array of the data collection.

DataSequence.map(atom)

Apply an atom to each data array of the data collection.

DataSequence.to_mapping()

Convert to an integer-keyed DataMapping.

DataSequence.from_mapping(data)

Build a DataSequence from the values of a DataMapping.

DataSequence.to_netcdf(fname[, mode, group, ...])

Write this DataSequence to a NetCDF file by converting to a mapping first.

DataSequence.from_netcdf(fname[, group])

Lazily read a DataSequence from a NetCDF file.