xdas.coordinates.InterpCoordinate#

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

Array-like object representing piecewise evenly spaced coordinates (CF convention).

The coordinate ticks are described by tie points that are interpolated when intermediate values are required. Coordinate objects provide label-based selection methods.

Parameters:
  • tie_indices (sequence of integers) – The indices of the tie points. Must include index 0 and be strictly increasing.

  • tie_values (sequence of float or datetime64) – The values of the tie points. Must be strictly increasing to enable label-based selection. The len of tie_indices and tie_values sizes must match.

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

Methods

__init__([data, dim, dtype])

concat(other)

Append other InterpCoordinate after this one, shifting its tie indices.

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 points, dim, and dtype.

format_index(idx[, bounds])

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

from_array(arr[, dim, tolerance])

Build an InterpCoordinate from a full array arr, optionally simplified.

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

Build a two-point InterpCoordinate covering [start, start + step*(size-1)].

from_dataset(dataset, name)

Read interpolated coordinates from dataset using the coordinate_interpolation 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 a label value via inverse interpolation.

get_sampling_interval([cast])

Return the median sample spacing across all tie-point segments.

get_split_indices([kind, tolerance])

Return tie-point indices where consecutive segments are discontinuous.

get_value(index)

Interpolate coordinate values at integer position(s) index.

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 (this is an InterpCoordinate).

issampled()

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

isscalar()

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

isvalid(data)

Return True if data is a dict with tie_indices and tie_values keys.

simplify([tolerance])

Reduce the number of tie points using the Douglas-Peucker algorithm.

slice_index(index_slice)

Return a new InterpCoordinate 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 tie points into an xarray dataset using CF coordinate interpolation conventions.

to_dict()

Serialise to {"dim": ..., "data": {"tie_indices": ..., "tie_values": ...}, "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 tie points have been set.

indices

Full integer index array from 0 to the last tie-point index (inclusive).

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.

shape

Shape tuple (len(self),).

tie_indices

Integer array of tie-point positions (starts at 0, strictly increasing).

tie_values

Array of tie-point values (numeric or datetime64, strictly increasing).

values

Materialised numpy array of all coordinate values via piecewise interpolation.