xray.Coordinate

class xray.Coordinate(name, data, attrs=None, encoding=None)

Wrapper around pandas.Index that adds xray specific functionality.

The most important difference is that Coordinate objects must always have a name, which is the dimension along which they index values.

Coordinates must always be 1-dimensional. In addition to Variable methods and properties (attributes, encoding, broadcasting), they support some pandas.Index methods directly (e.g., get_indexer), even though pandas does not (yet) support duck-typing for indexes.

Attributes

T
as_index
attributes
attrs Dictionary of local attributes on this variable.
dimensions
dims Tuple of dimension names with which this variable is associated.
dtype
encoding Dictionary of encodings on this variable.
is_monotonic
name
ndim
shape
size
values The variable’s data as a numpy.ndarray

Methods

all([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.all along some dimension(s).
any([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.any along some dimension(s).
argmax([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.argmax along some dimension(s).
argmin([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.argmin along some dimension(s).
argsort(*args, **kwargs)
astype(*args, **kwargs)
clip(*args, **kwargs)
concat(variables[, dim, indexers, length, ...]) Concatenate variables along a new or existing dimension.
conj(*args, **kwargs)
conjugate(*args, **kwargs)
copy([deep]) Returns a copy of this object.
equals(other) True if two Variables have the same dimensions and values; otherwise False.
get_axis_num(dim) Return axis number(s) corresponding to dimension(s) in this array.
get_indexer(label)
get_loc(label)
identical(other) Like equals, but also checks attributes.
indexed(*args, **kwargs) Return a new array indexed along the specified dimension(s).
is_numeric()
isel(**indexers) Return a new array indexed along the specified dimension(s).
isnull(*args, **kwargs) Detect missing values (NaN in numeric arrays, None/NaN in object arrays)
item(*args, **kwargs)
load_data() Manually trigger loading of this variable’s data from disk or a remote source into memory and return this variable.
max([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.max along some dimension(s).
mean([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.mean along some dimension(s).
min([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.min along some dimension(s).
notnull(*args, **kwargs) Replacement for numpy.isfinite / -numpy.isnan which is suitable for use on object arrays.
prod([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.prod along some dimension(s).
ptp([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.ptp along some dimension(s).
reduce(func[, dim, axis, keep_attrs]) Reduce this array by applying func along some dimension(s).
round(*args, **kwargs)
searchsorted(*args, **kwargs)
slice_indexer([start, stop, step])
slice_locs([start, stop])
squeeze([dim]) Return a new Variable object with squeezed data.
std([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.std along some dimension(s).
sum([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.sum along some dimension(s).
to_coord() Return this variable as an xray.Coordinate
to_index() Convert this variable to a pandas.Index
transpose(*dims) Return a new Variable object with transposed dimensions.
var([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.var along some dimension(s).
__init__(name, data, attrs=None, encoding=None)

Methods

__init__(name, data[, attrs, encoding])
all([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.all along some dimension(s).
any([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.any along some dimension(s).
argmax([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.argmax along some dimension(s).
argmin([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.argmin along some dimension(s).
argsort(*args, **kwargs)
astype(*args, **kwargs)
clip(*args, **kwargs)
concat(variables[, dim, indexers, length, ...]) Concatenate variables along a new or existing dimension.
conj(*args, **kwargs)
conjugate(*args, **kwargs)
copy([deep]) Returns a copy of this object.
equals(other) True if two Variables have the same dimensions and values; otherwise False.
get_axis_num(dim) Return axis number(s) corresponding to dimension(s) in this array.
get_indexer(label)
get_loc(label)
identical(other) Like equals, but also checks attributes.
indexed(*args, **kwargs) Return a new array indexed along the specified dimension(s).
is_numeric()
isel(**indexers) Return a new array indexed along the specified dimension(s).
isnull(*args, **kwargs) Detect missing values (NaN in numeric arrays, None/NaN in object arrays)
item(*args, **kwargs)
load_data() Manually trigger loading of this variable’s data from disk or a remote source into memory and return this variable.
max([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.max along some dimension(s).
mean([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.mean along some dimension(s).
min([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.min along some dimension(s).
notnull(*args, **kwargs) Replacement for numpy.isfinite / -numpy.isnan which is suitable for use on object arrays.
prod([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.prod along some dimension(s).
ptp([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.ptp along some dimension(s).
reduce(func[, dim, axis, keep_attrs]) Reduce this array by applying func along some dimension(s).
round(*args, **kwargs)
searchsorted(*args, **kwargs)
slice_indexer([start, stop, step])
slice_locs([start, stop])
squeeze([dim]) Return a new Variable object with squeezed data.
std([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.std along some dimension(s).
sum([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.sum along some dimension(s).
to_coord() Return this variable as an xray.Coordinate
to_index() Convert this variable to a pandas.Index
transpose(*dims) Return a new Variable object with transposed dimensions.
var([dim, axis, keep_attrs]) Reduce this Variable’s data by applying numpy.var along some dimension(s).

Attributes

T
as_index
attributes
attrs Dictionary of local attributes on this variable.
dimensions
dims Tuple of dimension names with which this variable is associated.
dtype
encoding Dictionary of encodings on this variable.
is_monotonic
name
ndim
shape
size
values The variable’s data as a numpy.ndarray