CoordString

class of dascore.core.coords
inherits from: BaseCoord, RichRepr, DascoreBaseModel, pydantic.main.BaseModel, abc.ABC
source

CoordString(
    units: pint.registry.Quantity | str | None[Quantity, str, None] = None,
    step: Any = None,
    shape: tuple[int, …] = (),
    dtype: Any = None,
    values: ndarray ,
)-> None

A coordinate implementation for string/categorical values.

See ‘Coordinate Internals’ for the constraints that make string coords differ from numeric and time-like coords. Plain string selectors use exact matching unless they contain * or ?, in which case they are treated as unix-style wildcard patterns. Compiled regular expressions are also supported as explicit pattern selectors.

Methods

Name Description
align_to Align the coordinate to another coordinate.
approx_equal Return True if the coordinates are approximately equal.
change_length Adjust the length of the coordinate by changing the end value.
convert_units Convert from one unit to another. Set units if None are set.
coord_range String coordinates do not support range calculations.
empty Empty out the coordinate.
fingerprint Return a stable fingerprint whose matches imply coord equality.
get_discontinuities Return a dataframe describing discontinuities in the coordinate.
get_next_index Get the index a value would have in a coordinate.
get_sample_count Return the number of samples represented by a value.
get_slice_tuple Get a tuple with (start, stop) and perform basic checks.
check_time_units Ensure time units are s if dtype is time-like.
index Index the coordinate and return new coordinate.
max Return max value.
min Return min value.
new Update coordinate.
order Order coordinate according to array values or samples.
reduce_coord Get a reduced coordinate.
select Select by exact values, wildcard patterns, regexes, samples, or masks.
set_units Reject setting units on string coordinates.
simplify Return the simplest coordinate representing the same values.
simplify_units Simplify the coordinate units.
snap Snap the coordinates to evenly sampled grid points.
sort Sort values lexicographically.
to_summary Return a lossy summary for string coordinates.
update Update parts of the coordinate.
update_data Update the data of the coordinate.
update_limits Reject numeric limit updates on string coords.