xdas.coordinates.DenseCoordinate#

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

Coordinate backed by an explicit numpy array.

Suitable for irregularly-spaced or small axes where every value must be stored. Look-up is performed via a pandas.Index.

Parameters:
  • data (array-like or None, optional) – 1-D array of coordinate values. None creates an empty coordinate.

  • dim (str, optional) – Dimension name.

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

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

Methods

__init__([data, dim, dtype])

concat(other)

Concatenate other DenseCoordinate values to this one.

copy([deep])

Return a copy of this coordinate.

equals(other)

Return True if other is a DenseCoordinate with identical values and dtype.

format_index(idx[, bounds])

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

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

Build a DenseCoordinate from start + step * arange(size).

from_dataset(dataset, name)

Extract all coordinates from an xarray dataset variable name as plain arrays.

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_div_points([tolerance])

Return sorted split-point indices where consecutive differences exceed tolerance.

get_indexer(value[, method])

Return the integer index (or indices) for value.

get_sampling_interval([cast])

Return the average sample spacing (end-to-end distance divided by N-1).

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

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 if this is a ScalarCoordinate (non-dimensional).

isvalid(data)

Return True if data converts to a 1-D non-object numpy array.

simplify([tolerance])

Reduce tie-point count within tolerance.

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

Return an integer slice for label range [start, stop] via pandas.Index.

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": ..., "data": ..., "dtype": ...}.

to_index(item[, method, endpoint])

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

Attributes

dtype

NumPy dtype of the underlying data array.

empty

True if the coordinate has zero length.

index

A pandas.Index view of the underlying data array.

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.