MCPcopy
hub / github.com/pydata/xarray / concat

Method concat

xarray/tests/indexes.py:49–66  ·  view source on GitHub ↗
(
        cls,
        indexes: Sequence[Self],
        dim: Hashable,
        positions: Iterable[Iterable[int]] | None = None,
    )

Source from the content-addressed store, hash-verified

47
48 @classmethod
49 def concat(
50 cls,
51 indexes: Sequence[Self],
52 dim: Hashable,
53 positions: Iterable[Iterable[int]] | None = None,
54 ) -> Self:
55 first = next(iter(indexes))
56 if dim == "x":
57 newx = PandasIndex.concat(
58 tuple(i.x for i in indexes), dim=dim, positions=positions
59 )
60 newy = first.y
61 elif dim == "y":
62 newx = first.x
63 newy = PandasIndex.concat(
64 tuple(i.y for i in indexes), dim=dim, positions=positions
65 )
66 return cls(x=newx, y=newy)
67
68 def isel(self, indexers: Mapping[Any, int | slice | np.ndarray | Variable]) -> Self:
69 newx = self.x.isel({"x": indexers.get("x", slice(None))})

Calls

no outgoing calls