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])
| 1204 | |
| 1205 | |
| 1206 | def 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 | |
| 1221 | def create_coords_with_default_indexes( |
no test coverage detected
searching dependent graphs…