xdas.coordinates.ScalarCoordinate#

class xdas.coordinates.ScalarCoordinate(data=None, dim=None, dtype=None)[source]#

Non-dimensional coordinate that carries a single scalar value.

Unlike dimensional coordinates, a ScalarCoordinate is not tied to an array axis and has no length. Typical use: metadata attached to a DataArray (e.g. an instrument identifier or a shot time).

Parameters:
  • data (scalar-like) – The scalar value. Cannot be None.

  • dim (must be None) – Passing a non-None value raises ValueError.

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

__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_sampling_interval([cast])

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

Always None — scalar coordinates have no associated dimension.

dtype

NumPy dtype of the underlying coordinate values.

empty

True if the coordinate has zero length.

end

Value at the last element.

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.