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

Method update_dicts

xarray/structure/alignment.py:404–424  ·  view source on GitHub ↗
(
            key: MatchingIndexKey,
            idx: Index,
            idx_vars: dict[Hashable, Variable],
            need_reindex: bool,
        )

Source from the content-addressed store, hash-verified

402 new_index_vars: dict[Hashable, Variable] = {}
403
404 def update_dicts(
405 key: MatchingIndexKey,
406 idx: Index,
407 idx_vars: dict[Hashable, Variable],
408 need_reindex: bool,
409 ):
410 reindex[key] = need_reindex
411 aligned_indexes[key] = idx
412 aligned_index_vars[key] = idx_vars
413
414 for name, var in idx_vars.items():
415 if name in new_indexes:
416 other_idx = new_indexes[name]
417 other_var = new_index_vars[name]
418 raise AlignmentError(
419 f"cannot align objects on coordinate {name!r} because of conflicting indexes\n"
420 f"first index: {idx!r}\nsecond index: {other_idx!r}\n"
421 f"first variable: {var!r}\nsecond variable: {other_var!r}\n"
422 )
423 new_indexes[name] = idx
424 new_index_vars[name] = var
425
426 for key, matching_indexes in self.all_indexes.items():
427 matching_index_vars = self.all_index_vars[key]

Callers

nothing calls this directly

Calls 2

AlignmentErrorClass · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected