MCPcopy
hub / github.com/pydata/xarray / merge

Method merge

xarray/core/dataset.py:5678–5775  ·  view source on GitHub ↗

Merge the arrays of two datasets into a single dataset. This method generally does not allow for overriding data, with the exception of attributes, which are ignored on the second dataset. Variables with the same name are checked for conflicts via the equals or ident

(
        self,
        other: CoercibleMapping | DataArray,
        overwrite_vars: Hashable | Iterable[Hashable] = frozenset(),
        compat: CompatOptions | CombineKwargDefault = _COMPAT_DEFAULT,
        join: JoinOptions | CombineKwargDefault = _JOIN_DEFAULT,
        fill_value: Any = xrdtypes.NA,
        combine_attrs: CombineAttrsOptions = "override",
    )

Source from the content-addressed store, hash-verified

5676 self._replace(inplace=True, **merge_result._asdict())
5677
5678 def merge(
5679 self,
5680 other: CoercibleMapping | DataArray,
5681 overwrite_vars: Hashable | Iterable[Hashable] = frozenset(),
5682 compat: CompatOptions | CombineKwargDefault = _COMPAT_DEFAULT,
5683 join: JoinOptions | CombineKwargDefault = _JOIN_DEFAULT,
5684 fill_value: Any = xrdtypes.NA,
5685 combine_attrs: CombineAttrsOptions = "override",
5686 ) -> Self:
5687 """Merge the arrays of two datasets into a single dataset.
5688
5689 This method generally does not allow for overriding data, with the
5690 exception of attributes, which are ignored on the second dataset.
5691 Variables with the same name are checked for conflicts via the equals
5692 or identical methods.
5693
5694 Parameters
5695 ----------
5696 other : Dataset or mapping
5697 Dataset or variables to merge with this dataset.
5698 overwrite_vars : hashable or iterable of hashable, optional
5699 If provided, update variables of these name(s) without checking for
5700 conflicts in this dataset.
5701 compat : {"identical", "equals", "broadcast_equals", \
5702 "no_conflicts", "override", "minimal"}, default: "no_conflicts"
5703 String indicating how to compare variables of the same name for
5704 potential conflicts:
5705
5706 - 'identical': all values, dimensions and attributes must be the
5707 same.
5708 - 'equals': all values and dimensions must be the same.
5709 - 'broadcast_equals': all values must be equal when variables are
5710 broadcast against each other to ensure common dimensions.
5711 - 'no_conflicts': only values which are not null in both datasets
5712 must be equal. The returned dataset then contains the combination
5713 of all non-null values.
5714 - 'override': skip comparing and pick variable from first dataset
5715 - 'minimal': drop conflicting coordinates
5716
5717 join : {"outer", "inner", "left", "right", "exact", "override"}, \
5718 default: "outer"
5719 Method for joining ``self`` and ``other`` along shared dimensions:
5720
5721 - 'outer': use the union of the indexes
5722 - 'inner': use the intersection of the indexes
5723 - 'left': use indexes from ``self``
5724 - 'right': use indexes from ``other``
5725 - 'exact': error instead of aligning non-equal indexes
5726 - 'override': use indexes from ``self`` that are the same size
5727 as those of ``other`` in that dimension
5728
5729 fill_value : scalar or dict-like, optional
5730 Value to use for newly missing values. If a dict-like, maps
5731 variable names (including coordinates) to fill values.
5732 combine_attrs : {"drop", "identical", "no_conflicts", "drop_conflicts", \
5733 "override"} or callable, default: "override"
5734 A callable or a string indicating how to combine attrs of the objects being
5735 merged:

Calls 3

_replaceMethod · 0.95
dataset_merge_methodFunction · 0.90
to_datasetMethod · 0.45