xdas.coordinates#

Coordinates#

Constructor

Coordinates([coords, dims])

Dictionary like container for coordinates.

Methods

Coordinates.isdim(name)

Return True if name is a dimensional coordinate (i.e. its dim equals its name).

Coordinates.get_query(item)

Format a query from one or multiple indexer.

Coordinates.to_index(item[, method, endpoint])

Convert an item selector to a dict of per-dimension integer indices.

Coordinates.equals(other)

Return True if other is a Coordinates with identical coordinate values.

Coordinates.to_dict()

Convert this Coordinates object into a pure python dictionnary.

Coordinates.copy([deep])

Return a copy of this Coordinates container.

Coordinates.drop_dims(*dims)

Return a new Coordinates with dims and their associated coordinates removed.

Coordinates.drop_coords(*names)

Return a new Coordinates with the named coordinates removed.

Coordinate#

Constructor

Coordinate([data, dim, dtype])

Base class and factory for all coordinate types.

Attributes

Coordinate.dtype

NumPy dtype of the underlying data array.

Coordinate.ndim

Number of dimensions of the underlying data array (always 1 for dimensional coords).

Coordinate.shape

Shape tuple of the underlying data array.

Coordinate.values

Materialised numpy array of coordinate values.

Methods

Coordinate.to_index(item[, method, endpoint])

Convert a label-based selector to an integer index or slice.

Coordinate.isscalar()

Return True if this is a ScalarCoordinate (non-dimensional).

Coordinate.isdense()

Return True if this is a DenseCoordinate (explicit numpy array).

Coordinate.isinterp()

Return True if this is an InterpCoordinate (piecewise-linear).

ScalarCoordinate#

Constructor

ScalarCoordinate([data, dim, dtype])

Non-dimensional coordinate that carries a single scalar value.

Methods

ScalarCoordinate.isvalid(data)

Return True if data converts to a 0-d non-object numpy array.

ScalarCoordinate.equals(other)

Return True if other is a ScalarCoordinate with the same value.

ScalarCoordinate.to_index(item[, method, ...])

Not supported — raises NotImplementedError.

ScalarCoordinate.to_dict()

Serialise to {"dim": None, "data": ..., "dtype": ...}.

DenseCoordinate#

Constructor

DenseCoordinate([data, dim, dtype])

Coordinate backed by an explicit numpy array.

Methods

DenseCoordinate.isvalid(data)

Return True if data converts to a 1-D non-object numpy array.

DenseCoordinate.index

A pandas.Index view of the underlying data array.

DenseCoordinate.get_indexer(value[, method])

Return the integer index (or indices) for value.

DenseCoordinate.slice_indexer([start, stop, ...])

Return an integer slice for label range [start, stop] via pandas.Index.

DenseCoordinate.to_dict()

Serialise to {"dim": ..., "data": ..., "dtype": ...}.

InterpCoordinate#

Constructor

InterpCoordinate([data, dim, dtype])

Array-like object representing piecewise evenly spaced coordinates (CF convention).

Attributes

InterpCoordinate.tie_indices

Integer array of tie-point positions (starts at 0, strictly increasing).

InterpCoordinate.tie_values

Array of tie-point values (numeric or datetime64, strictly increasing).

InterpCoordinate.empty

True if no tie points have been set.

InterpCoordinate.dtype

Dtype of the tie values (and of all materialised coordinate values).

InterpCoordinate.ndim

Always 1.

InterpCoordinate.shape

Shape tuple (len(self),).

InterpCoordinate.indices

Full integer index array from 0 to the last tie-point index (inclusive).

InterpCoordinate.values

Materialised numpy array of all coordinate values via piecewise interpolation.

Methods

InterpCoordinate.isvalid(data)

Return True if data is a dict with tie_indices and tie_values keys.

InterpCoordinate.equals(other)

Return True if other has identical tie points, dim, and dtype.

InterpCoordinate.get_value(index)

Interpolate coordinate values at integer position(s) index.

InterpCoordinate.format_index(idx[, bounds])

Normalise integer index idx, handling negative indices and optional bounds checking.

InterpCoordinate.slice_index(index_slice)

Return a new InterpCoordinate for the integer slice index_slice.

InterpCoordinate.get_indexer(value[, method])

Return the integer index for a label value via inverse interpolation.

InterpCoordinate.slice_indexer([start, ...])

Return an integer slice corresponding to the label range [start, stop].

InterpCoordinate.decimate(q)

Return a new coordinate keeping every q-th sample (integer decimation).

InterpCoordinate.simplify([tolerance])

Reduce the number of tie points using the Douglas-Peucker algorithm.

InterpCoordinate.get_discontinuities([tolerance])

Return a DataFrame containing information about the discontinuities.

InterpCoordinate.from_array(arr[, dim, ...])

Build an InterpCoordinate from a full array arr, optionally simplified.

InterpCoordinate.to_dict()

Serialise to {"dim": ..., "data": {"tie_indices": ..., "tie_values": ...}, "dtype": ...}.

SampledCoordinate#

Constructor

SampledCoordinate([data, dim, dtype])

A coordinate that is sampled at regular intervals.

Attributes

SampledCoordinate.tie_values

Start values of each regularly-sampled segment.

SampledCoordinate.tie_lengths

Number of samples in each regularly-sampled segment.

SampledCoordinate.tie_indices

Start integer index of each segment within the full coordinate array.

SampledCoordinate.sampling_interval

Fixed step between consecutive samples (shared across all segments).

SampledCoordinate.empty

True if no segments have been set.

SampledCoordinate.dtype

Dtype of the tie values (and of all materialised coordinate values).

SampledCoordinate.ndim

Always 1.

SampledCoordinate.shape

Shape tuple (len(self),).

SampledCoordinate.indices

Full integer index array from 0 to len(self) - 1.

SampledCoordinate.values

Materialised numpy array of all coordinate values.

Methods

SampledCoordinate.concat(other)

Append other SampledCoordinate segments after this one.

SampledCoordinate.decimate(q)

Return a new coordinate keeping every q-th sample (integer decimation).

SampledCoordinate.equals(other)

Return True if other has identical tie values, lengths, sampling interval, dim, and dtype.

SampledCoordinate.from_array(arr[, dim, ...])

Not supported — raises NotImplementedError.

SampledCoordinate.from_block(start, size, step)

Build a single-segment SampledCoordinate starting at start with size samples and step step.

SampledCoordinate.get_indexer(value[, method])

Return the integer index for label value using the segment structure.

SampledCoordinate.get_sampling_interval([cast])

Return the sampling interval.

SampledCoordinate.get_split_indices([kind, ...])

Return integer indices of segment boundaries (start of each segment except the first).

SampledCoordinate.get_value(index)

Compute coordinate value(s) at integer position(s) index using the stored segments.

SampledCoordinate.isvalid(data)

Return True if data has tie_values, tie_lengths, and sampling_interval keys.

SampledCoordinate.simplify([tolerance])

Merge adjacent segments whose gap is within tolerance of the sampling interval.

SampledCoordinate.slice_index(index_slice)

Return a new SampledCoordinate for the integer slice index_slice.

SampledCoordinate.slice_indexer([start, ...])

Return an integer slice corresponding to the label range [start, stop].

SampledCoordinate.to_dict()

Serialise to {"dim": ..., "data": {"tie_values": ..., "tie_lengths": ..., "sampling_interval": ...}, "dtype": ...}.