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]#

Methods

__init__([data, dim, dtype])

concat(other)

Concatenate other coordinate to this one.

copy([deep])

Return a copy of this coordinate.

equals(other)

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

format_index(idx[, bounds])

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

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

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

from_dataset(dataset, name)

Read coordinates named name from an xarray dataset via each registered subclass.

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

Return None — scalar coordinates have no sample spacing.

get_split_indices([kind, tolerance])

Return integer indices where this coordinate should be split.

is_monotonic_increasing()

Return True if all consecutive differences in this coordinate are positive.

isdefault()

Return True if this is a DefaultCoordinate (integer range).

isdense()

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

isdim()

Return True if this coordinate is a dimensional coordinate in its parent container.

isinterp()

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

issampled()

Return True if this is a SampledCoordinate (regularly sampled).

isscalar()

Return True (this is a ScalarCoordinate).

isvalid(data)

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

simplify([tolerance])

Reduce tie-point count within tolerance.

slice_indexer([start, stop, step, endpoint])

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

to_dataarray()

Convert this coordinate to a DataArray with a single dimension.

to_dataset(dataset, attrs)

Write this coordinate into an xarray dataset, updating attrs in place.

to_dict()

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

to_index(item[, method, endpoint])

Not supported — raises NotImplementedError.

Attributes

dim

Always None — scalar coordinates have no associated dimension.

dtype

NumPy dtype of the underlying data array.

empty

True if the coordinate has zero length.

name

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

ndim

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

parent

The parent Coordinates container, or None if unattached.

shape

Shape tuple of the underlying data array.

values

Materialised numpy array of coordinate values.