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. None creates an empty coordinate.

  • dim (str, optional) – Dimension name.

  • dtype (dtype-like, optional) – Cast data to this dtype on construction.

__init__(data=None, dim=None, dtype=None)[source]#

Initialise the coordinate from subclass-specific data.

Methods

__init__([data, dim, dtype])

Initialise the coordinate from subclass-specific data.

copy([deep])

Return a copy of this coordinate.

equals(other)

Return True if other is the same coordinate type with identical dim and data.

from_block(start, size, step[, dim, dtype])

Construct a coordinate from a start value, element count, and step size.

get_div_points([tolerance])

Return sorted split-point indices where consecutive differences exceed tolerance.

get_sampling_interval([cast])

Return the average sample spacing (end-to-end distance divided by N-1).

isdim()

Return True if this coordinate is a dimensional coordinate.

isscalar()

Return True if this is a ScalarCoordinate.

to_dataarray()

Convert this coordinate to a DataArray with a single dimension.

to_index(item[, method, endpoint])

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

Attributes

dim

Name of the dimension this coordinate is associated with, or None.

dtype

NumPy dtype of the underlying coordinate values.

empty

True if the coordinate has zero length.

end

Value at the last element.

index

A pandas.Index view of the underlying data array.

indices

Integer array [0, 1, ..., len(self) - 1].

name

The name under which this coordinate is stored in its parent container.

ndim

Number of dimensions (always 1 for dimensional coordinates).

parent

The parent Coordinates container, or None if unattached.

shape

Shape tuple (len(self),).

size

Number of elements along this coordinate's axis.

start

Value at index 0 (first element).

values

Materialised numpy array of coordinate values.