%%captureutilities.xarray
Extra functionality for xarray
Coordinates.__add__
def __add__(
other
):Adding two Coordinates objects combines their coordinates.
Define the + operator for Coordinates to combine the coordinates:
coords = Coordinates({'foo': [1, 2]}) + Coordinates({'bar': [1, 2, 3]})
coordsCoordinates:
* foo (foo) int64 16B 1 2
* bar (bar) int64 24B 1 2 3
Coordinates.complement
def complement(
other:xarray.core.coordinates.Coordinates
):Return coordinates not in other coordinates.
coords.complement(Coordinates({'bar': [1, 2, 3]}))Coordinates:
* foo (foo) int64 16B 1 2
coords.shape(2, 3)
coords.sizenp.int64(6)
Coordinates.intersection
def intersection(
other:xarray.core.coordinates.Coordinates
):Return coordinates in self and other.
coords.intersection(Coordinates({'foo': [1, 2]}))Coordinates:
* foo (foo) int64 16B 1 2
Coordinates.contain
def contain(
other:xarray.core.coordinates.Coordinates
):Return true if all coordinates in other are in self, otherwise false.
coords.contain(Coordinates({'foo': [1, 2]}))True
coords.contain(Coordinates({'foo': [1, 2], 'baz': [4, 5]}))False