MCPcopy Index your code
hub / github.com/pydata/xarray / reindex_like

Function reindex_like

xarray/structure/alignment.py:1088–1120  ·  view source on GitHub ↗

Re-index either a Dataset or a DataArray like another Dataset/DataArray. Not public API.

(
    obj: T_Alignable,
    other: Dataset | DataArray,
    method: str | None = None,
    tolerance: float | Iterable[float] | str | None = None,
    copy: bool = True,
    fill_value: Any = dtypes.NA,
)

Source from the content-addressed store, hash-verified

1086
1087
1088def reindex_like(
1089 obj: T_Alignable,
1090 other: Dataset | DataArray,
1091 method: str | None = None,
1092 tolerance: float | Iterable[float] | str | None = None,
1093 copy: bool = True,
1094 fill_value: Any = dtypes.NA,
1095) -> T_Alignable:
1096 """Re-index either a Dataset or a DataArray like another Dataset/DataArray.
1097
1098 Not public API.
1099
1100 """
1101 if not other._indexes:
1102 # This check is not performed in Aligner.
1103 for dim in other.dims:
1104 if dim in obj.dims:
1105 other_size = other.sizes[dim]
1106 obj_size = obj.sizes[dim]
1107 if other_size != obj_size:
1108 raise ValueError(
1109 "different size for unlabeled "
1110 f"dimension on argument {dim!r}: {other_size!r} vs {obj_size!r}"
1111 )
1112
1113 return reindex(
1114 obj,
1115 indexers=other.xindexes,
1116 method=method,
1117 tolerance=tolerance,
1118 copy=copy,
1119 fill_value=fill_value,
1120 )
1121
1122
1123def _get_broadcast_dims_map_common_coords(args, exclude):

Callers

nothing calls this directly

Calls 1

reindexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…