xdas.coordinates.SampledCoordinate#

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

A coordinate that is sampled at regular intervals.

Parameters:
  • data (dict-like) – The data of the coordinate.

  • dim (str, optional) – The dimension name of the coordinate, by default None.

  • dtype (str or numpy.dtype, optional) – The data type of the coordinate, by default None.

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

Methods

__init__([data, dim, dtype])

concat(other)

Append other SampledCoordinate segments after this one.

copy([deep])

Return a copy of this coordinate.

decimate(q)

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

equals(other)

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

format_index(idx[, bounds])

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

from_array(arr[, dim, sampling_interval])

Not supported — raises NotImplementedError.

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

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

from_dataset(dataset, name)

Read sampled coordinates from dataset using the coordinate_sampling attribute.

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_indexer(value[, method])

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

get_sampling_interval([cast])

Return the sampling interval.

get_split_indices([kind, tolerance])

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

get_value(index)

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

is_monotonic_increasing()

Return True if no segment starts before the end of the previous one.

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 (this is a SampledCoordinate).

isscalar()

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

isvalid(data)

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

simplify([tolerance])

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

slice_index(index_slice)

Return a new SampledCoordinate for the integer slice index_slice.

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 sampling metadata into an xarray dataset using CF tie-point conventions.

to_dict()

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

to_index(item[, method, endpoint])

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

Attributes

dtype

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

empty

True if no segments have been set.

end

Value one step past the last sample (exclusive upper bound).

indices

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

name

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

ndim

Always 1.

parent

The parent Coordinates container, or None if unattached.

sampling_interval

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

shape

Shape tuple (len(self),).

start

Value at index 0 (first tie value).

tie_indices

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

tie_lengths

Number of samples in each regularly-sampled segment.

tie_values

Start values of each regularly-sampled segment.

values

Materialised numpy array of all coordinate values.