coordax.Coordinate¶
- class coordax.Coordinate¶
Abstract class for coordinate objects.
Coordinate subclasses are expected to obey several invariants: 1. Dimension names may not be repeated:
len(set(dims)) == len(dims)2. All dimensions must be named:len(shape) == len(dims)Every non-abstract Coordinate subclass must be registered as a “static” pytree node, e.g., by decorating the class with
@jax.tree_util.register_static. Static pytrees nodes must implement__hash__and__eq__according to the requirements of keys in Python dictionaries. This is easiest to acheive with frozen dataclasses, but care must be taken when working with np.ndarray attributes.- __init__()¶
Methods
__init__()from_xarray(dims, coords)Construct a matching Coordax coordinate from xarray, if possible.
isel([indexers])Returns a new coordinate with the given integer indexers applied.
map_indexers(indexers[, method])Maps label-based indexers to integer-based indexers (indices/slices).
sel([indexers, method])Returns a new coordinate with the given selection applied.
to_xarray()Convert this coordinate into xarray variables.
Attributes
axesTuple of one-dimensional Coordinate objects for each dimension.
dimsDimension names of the coordinate.
fieldsOptional dict that maps from field names to their values.
ndimDimensionality of the coordinate.
shapeShape of the coordinate.
sizesSizes of all dimensions on this coordinate.