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
ScalarCoordinateis not tied to an array axis and has no length. Typical use: metadata attached to aDataArray(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-Nonevalue raisesValueError.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
Trueif 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
Trueif this coordinate is a dimensional coordinate.isscalar()Return
Trueif this is aScalarCoordinate.to_dataarray()Convert this coordinate to a
DataArraywith a single dimension.to_index(item[, method, endpoint])Convert a label-based selector to an integer index or slice.
Attributes
dimAlways
None— scalar coordinates have no associated dimension.dtypeNumPy dtype of the underlying coordinate values.
emptyTrueif the coordinate has zero length.endValue at the last element.
indicesInteger array
[0, 1, ..., len(self) - 1].nameThe name under which this coordinate is stored in its parent container.
ndimNumber of dimensions (always 1 for dimensional coordinates).
parentThe parent
Coordinatescontainer, orNoneif unattached.shapeShape tuple
(len(self),).sizeNumber of elements along this coordinate's axis.
startValue at index 0 (first element).
valuesMaterialised numpy array of coordinate values.