xray.Dataset

class xray.Dataset(variables=None, attributes=None)

A netcdf-like data object consisting of variables and attributes which together form a self describing dataset.

Dataset implements the mapping interface with keys given by variable names and values given by DataArray objects for each variable name.

One dimensional variables with name equal to their dimension are coordinate variables, which means they are saved in the dataset as pandas.Index objects.

Attributes

attributes
attrs Dictionary of global attributes on this dataset
coordinates Dictionary of Coordinate objects used for label based indexing.
dimensions Mapping from dimension names to lengths.
noncoordinates Dictionary of DataArrays whose names do not match dimensions.
variables Dictionary of Variable objects contained in this dataset.
virtual_variables A frozenset of variable names that don’t exist in this dataset but for which could be created on demand.

Methods

concat(datasets[, dimension, indexers, ...]) Concatenate datasets along a new or existing dimension.
copy([deep]) Returns a copy of this dataset.
dump(filepath, **kwdargs) Dump dataset contents to a location on disk using the netCDF4 package.
dump_to_store(store) Store dataset contents to a backends.*DataStore object.
dumps(**kwargs) Serialize dataset contents to a string.
equals(other) Two Datasets are equal if they have the same variables and all variables are equal.
from_dataframe(dataframe) Convert a pandas.DataFrame into an xray.Dataset
get(key[, default])
groupby(group[, squeeze]) Group this dataset by unique values of the indicated group.
identical(other) Two Datasets are identical if they have the same variables and all variables are identical (with the same attributes), and they also have the same global attributes.
indexed(**indexers) Return a new dataset with each array indexed along the specified dimension(s).
items()
iteritems()
iterkeys()
itervalues()
keys()
labeled(**indexers) Return a new dataset with each variable indexed by coordinate labels along the specified dimension(s).
load_store(store[, decode_cf, ...]) Create a new dataset from the contents of a backends.*DataStore
merge(other[, inplace, overwrite_vars, compat]) Merge the variables of two datasets into a single new dataset.
reindex([copy]) Conform this object onto a new set of coordinates or pandas.Index objects, filling in missing values with NaN.
reindex_like(other[, copy]) Conform this object onto the coordinates of another object, filling in missing values with NaN.
rename(name_dict) Returns a new object with renamed variables and dimensions.
select(*names) Returns a new dataset that contains only the named variables and their coordinates.
squeeze([dimension]) Return a new dataset with squeezed data.
to_dataframe() Convert this dataset into a pandas.DataFrame.
to_netcdf(filepath, **kwdargs) Dump dataset contents to a location on disk using the netCDF4 package.
unselect(*names) Returns a new dataset without the named variables.
update(other[, inplace]) Update this dataset’s variables and attributes with those from another dataset.
values()
__init__(variables=None, attributes=None)

To load data from a file or file-like object, use the open_dataset function.

Parameters:

variables : dict-like, optional

A mapping from variable names to DataArray objets, Variable objects or sequences of the form (dimensions, data[, attributes]) which can be used as arguments to create a new Variable. Each dimension must have the same length in all variables in which it appears.

attributes : dict-like, optional

Global attributes to save on this dataset.

Methods

__init__([variables, attributes]) To load data from a file or file-like object, use the open_dataset function.
concat(datasets[, dimension, indexers, ...]) Concatenate datasets along a new or existing dimension.
copy([deep]) Returns a copy of this dataset.
dump(filepath, **kwdargs) Dump dataset contents to a location on disk using the netCDF4 package.
dump_to_store(store) Store dataset contents to a backends.*DataStore object.
dumps(**kwargs) Serialize dataset contents to a string.
equals(other) Two Datasets are equal if they have the same variables and all variables are equal.
from_dataframe(dataframe) Convert a pandas.DataFrame into an xray.Dataset
get(key[, default])
groupby(group[, squeeze]) Group this dataset by unique values of the indicated group.
identical(other) Two Datasets are identical if they have the same variables and all variables are identical (with the same attributes), and they also have the same global attributes.
indexed(**indexers) Return a new dataset with each array indexed along the specified dimension(s).
items()
iteritems()
iterkeys()
itervalues()
keys()
labeled(**indexers) Return a new dataset with each variable indexed by coordinate labels along the specified dimension(s).
load_store(store[, decode_cf, ...]) Create a new dataset from the contents of a backends.*DataStore
merge(other[, inplace, overwrite_vars, compat]) Merge the variables of two datasets into a single new dataset.
reindex([copy]) Conform this object onto a new set of coordinates or pandas.Index objects, filling in missing values with NaN.
reindex_like(other[, copy]) Conform this object onto the coordinates of another object, filling in missing values with NaN.
rename(name_dict) Returns a new object with renamed variables and dimensions.
select(*names) Returns a new dataset that contains only the named variables and their coordinates.
squeeze([dimension]) Return a new dataset with squeezed data.
to_dataframe() Convert this dataset into a pandas.DataFrame.
to_netcdf(filepath, **kwdargs) Dump dataset contents to a location on disk using the netCDF4 package.
unselect(*names) Returns a new dataset without the named variables.
update(other[, inplace]) Update this dataset’s variables and attributes with those from another dataset.
values()

Attributes

attributes
attrs Dictionary of global attributes on this dataset
coordinates Dictionary of Coordinate objects used for label based indexing.
dimensions Mapping from dimension names to lengths.
noncoordinates Dictionary of DataArrays whose names do not match dimensions.
variables Dictionary of Variable objects contained in this dataset.
virtual_variables A frozenset of variable names that don’t exist in this dataset but for which could be created on demand.