Merge variables/indexes from coordinates without automatic alignments. This function is used for merging coordinate from pre-existing xarray objects.
(
objects: list[Coordinates],
prioritized: Mapping[Any, MergeElement] | None = None,
exclude_dims: AbstractSet = frozenset(),
combine_attrs: CombineAttrsOptions = "override",
compat: CompatOptions | CombineKwargDefault = "minimal",
)
| 434 | |
| 435 | |
| 436 | def merge_coordinates_without_align( |
| 437 | objects: list[Coordinates], |
| 438 | prioritized: Mapping[Any, MergeElement] | None = None, |
| 439 | exclude_dims: AbstractSet = frozenset(), |
| 440 | combine_attrs: CombineAttrsOptions = "override", |
| 441 | compat: CompatOptions | CombineKwargDefault = "minimal", |
| 442 | ) -> tuple[dict[Hashable, Variable], dict[Hashable, Index]]: |
| 443 | """Merge variables/indexes from coordinates without automatic alignments. |
| 444 | |
| 445 | This function is used for merging coordinate from pre-existing xarray |
| 446 | objects. |
| 447 | """ |
| 448 | collected = collect_from_coordinates(objects) |
| 449 | |
| 450 | if exclude_dims: |
| 451 | filtered: dict[Hashable, list[MergeElement]] = {} |
| 452 | for name, elements in collected.items(): |
| 453 | new_elements = [ |
| 454 | (variable, index) |
| 455 | for variable, index in elements |
| 456 | if exclude_dims.isdisjoint(variable.dims) |
| 457 | ] |
| 458 | if new_elements: |
| 459 | filtered[name] = new_elements |
| 460 | else: |
| 461 | filtered = collected |
| 462 | |
| 463 | # TODO: indexes should probably be filtered in collected elements |
| 464 | # before merging them |
| 465 | merged_coords, merged_indexes = merge_collected( |
| 466 | filtered, prioritized, compat=compat, combine_attrs=combine_attrs |
| 467 | ) |
| 468 | merged_indexes = filter_indexes_from_coords(merged_indexes, set(merged_coords)) |
| 469 | |
| 470 | return merged_coords, merged_indexes |
| 471 | |
| 472 | |
| 473 | def determine_coords( |
no test coverage detected
searching dependent graphs…