xdas.coordinates.DenseCoordinate#
- class xdas.coordinates.DenseCoordinate(data=None, dim=None, dtype=None)[source]#
Coordinate backed by an explicit numpy array.
Suitable for irregularly-spaced or small axes where every value must be stored. Look-up is performed via a
pandas.Index.- Parameters:
data (array-like or None, optional) – 1-D array of coordinate values.
Nonecreates an empty coordinate.dim (str, optional) – Dimension name.
dtype (dtype-like, optional) – Cast data to this dtype on construction.
Methods
__init__([data, dim, dtype])concat(other)Concatenate other
DenseCoordinatevalues to this one.copy([deep])Return a copy of this coordinate.
equals(other)Return
Trueif other is aDenseCoordinatewith identical values and dtype.format_index(idx[, bounds])Normalise integer index idx, handling negative indices and optional bounds checking.
from_block(start, size, step[, dim, dtype])Build a
DenseCoordinatefromstart + step * arange(size).from_dataset(dataset, name)Extract all coordinates from an xarray dataset variable name as plain arrays.
from_dict(dct)Reconstruct a coordinate from the dict returned by
to_dict().get_availabilities()Return a DataFrame containing information about the data availability.
get_discontinuities([tolerance])Return a DataFrame containing information about the discontinuities.
get_div_points([tolerance])Return sorted split-point indices where consecutive differences exceed tolerance.
get_indexer(value[, method])Return the integer index (or indices) for value.
get_sampling_interval([cast])Return the average sample spacing (end-to-end distance divided by N-1).
get_split_indices([kind, tolerance])Return integer indices where this coordinate should be split.
is_monotonic_increasing()Return
Trueif all consecutive differences in this coordinate are positive.isdefault()Return
Trueif this is aDefaultCoordinate(integer range).isdense()Return
True(this is aDenseCoordinate).isdim()Return
Trueif this coordinate is a dimensional coordinate in its parent container.isinterp()Return
Trueif this is anInterpCoordinate(piecewise-linear).issampled()Return
Trueif this is aSampledCoordinate(regularly sampled).isscalar()Return
Trueif this is aScalarCoordinate(non-dimensional).isvalid(data)Return
Trueif data converts to a 1-D non-object numpy array.simplify([tolerance])Reduce tie-point count within tolerance.
slice_indexer([start, stop, step, endpoint])Return an integer
slicefor label range [start, stop] viapandas.Index.to_dataarray()Convert this coordinate to a
DataArraywith a single dimension.to_dataset(dataset, attrs)Write this coordinate into an xarray dataset, updating attrs in place.
to_dict()Serialise to
{"dim": ..., "data": ..., "dtype": ...}.to_index(item[, method, endpoint])Convert a label-based selector to an integer index or slice.
Attributes
dtypeNumPy dtype of the underlying data array.
emptyTrueif the coordinate has zero length.A
pandas.Indexview of the underlying data array.nameThe name under which this coordinate is stored in its parent container.
ndimNumber of dimensions of the underlying data array (always 1 for dimensional coords).
parentThe parent
Coordinatescontainer, orNoneif unattached.shapeShape tuple of the underlying data array.
valuesMaterialised numpy array of coordinate values.