xray.Variable

class xray.Variable(dims, data, attributes=None, encoding=None)

A netcdf-like variable consisting of dimensions, data and attributes which describe a single Array. A single Variable object is not fully described outside the context of its parent Dataset (if you want such a fully described object, use a DataArray instead).

Attributes

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

Methods

all([dimension, axis]) Reduce this Variable’s data’ by applying numpy.all along some dimension(s).
any([dimension, axis]) Reduce this Variable’s data’ by applying numpy.any along some dimension(s).
argmax([dimension, axis]) Reduce this Variable’s data’ by applying numpy.argmax along some dimension(s).
argmin([dimension, axis]) Reduce this Variable’s data’ by applying numpy.argmin along some dimension(s).
argsort(*args, **kwargs)
astype(*args, **kwargs)
clip(*args, **kwargs)
concat(variables[, dimension, indexers, ...]) 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(dimension) Return axis number(s) corresponding to dimension(s) in this array.
identical(other) Like equals, but also checks attributes.
indexed(**indexers) Return a new array indexed along the specified dimension(s).
item() Calls numpy.ndarray.item on this array’s values
max([dimension, axis]) Reduce this Variable’s data’ by applying numpy.max along some dimension(s).
mean([dimension, axis]) Reduce this Variable’s data’ by applying numpy.mean along some dimension(s).
min([dimension, axis]) Reduce this Variable’s data’ by applying numpy.min along some dimension(s).
prod([dimension, axis]) Reduce this Variable’s data’ by applying numpy.prod along some dimension(s).
ptp([dimension, axis]) Reduce this Variable’s data’ by applying numpy.ptp along some dimension(s).
reduce(func[, dimension, axis]) Reduce this array by applying func along some dimension(s).
round(*args, **kwargs)
squeeze([dimension]) Return a new Variable object with squeezed data.
std([dimension, axis]) Reduce this Variable’s data’ by applying numpy.std along some dimension(s).
sum([dimension, axis]) Reduce this Variable’s data’ by applying numpy.sum along some dimension(s).
to_coord() Return this variable as a Coordinate
transpose(*dimensions) Return a new Variable object with transposed dimensions.
var([dimension, axis]) Reduce this Variable’s data’ by applying numpy.var along some dimension(s).
__init__(dims, data, attributes=None, encoding=None)
Parameters:

dims : str or sequence of str

Name(s) of the the data dimension(s). Must be either a string (only for 1D data) or a sequence of strings with length equal to the number of dimensions.

data : array_like

Data array which supports numpy-like data access.

attributes : dict_like or None, optional

Attributes to assign to the new variable. If None (default), an empty attribute dictionary is initialized.

encoding : dict_like or None, optional

Dictionary specifying how to encode this array’s data into a serialized format like netCDF4. Currently used keys (for netCDF) include ‘_FillValue’, ‘scale_factor’, ‘add_offset’ and ‘dtype’. Well behaviored code to serialize a Variable should ignore unrecognized encoding items.

Methods

__init__(dims, data[, attributes, encoding])
Parameters:
all([dimension, axis]) Reduce this Variable’s data’ by applying numpy.all along some dimension(s).
any([dimension, axis]) Reduce this Variable’s data’ by applying numpy.any along some dimension(s).
argmax([dimension, axis]) Reduce this Variable’s data’ by applying numpy.argmax along some dimension(s).
argmin([dimension, axis]) Reduce this Variable’s data’ by applying numpy.argmin along some dimension(s).
argsort(*args, **kwargs)
astype(*args, **kwargs)
clip(*args, **kwargs)
concat(variables[, dimension, indexers, ...]) 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(dimension) Return axis number(s) corresponding to dimension(s) in this array.
identical(other) Like equals, but also checks attributes.
indexed(**indexers) Return a new array indexed along the specified dimension(s).
item() Calls numpy.ndarray.item on this array’s values
max([dimension, axis]) Reduce this Variable’s data’ by applying numpy.max along some dimension(s).
mean([dimension, axis]) Reduce this Variable’s data’ by applying numpy.mean along some dimension(s).
min([dimension, axis]) Reduce this Variable’s data’ by applying numpy.min along some dimension(s).
prod([dimension, axis]) Reduce this Variable’s data’ by applying numpy.prod along some dimension(s).
ptp([dimension, axis]) Reduce this Variable’s data’ by applying numpy.ptp along some dimension(s).
reduce(func[, dimension, axis]) Reduce this array by applying func along some dimension(s).
round(*args, **kwargs)
squeeze([dimension]) Return a new Variable object with squeezed data.
std([dimension, axis]) Reduce this Variable’s data’ by applying numpy.std along some dimension(s).
sum([dimension, axis]) Reduce this Variable’s data’ by applying numpy.sum along some dimension(s).
to_coord() Return this variable as a Coordinate
transpose(*dimensions) Return a new Variable object with transposed dimensions.
var([dimension, axis]) Reduce this Variable’s data’ by applying numpy.var along some dimension(s).

Attributes

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