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

Function assert_coordinate_consistent

xarray/core/coordinates.py:1206–1218  ·  view source on GitHub ↗

Make sure the dimension coordinate of obj is consistent with coords. obj: DataArray or Dataset coords: Dict-like of variables

(obj: T_Xarray, coords: Mapping[Any, Variable])

Source from the content-addressed store, hash-verified

1204
1205
1206def assert_coordinate_consistent(obj: T_Xarray, coords: Mapping[Any, Variable]) -> None:
1207 """Make sure the dimension coordinate of obj is consistent with coords.
1208
1209 obj: DataArray or Dataset
1210 coords: Dict-like of variables
1211 """
1212 for k in obj.dims:
1213 # make sure there are no conflict in dimension coordinates
1214 if k in coords and k in obj.coords and not coords[k].equals(obj[k].variable):
1215 raise IndexError(
1216 f"dimension coordinate {k!r} conflicts between "
1217 f"indexed and indexing objects:\n{obj[k]}\nvs.\n{coords[k]}"
1218 )
1219
1220
1221def create_coords_with_default_indexes(

Callers 2

__setitem__Method · 0.90

Calls 1

equalsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…