diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 992531d2e32..505db7e86db 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -4915,3 +4915,5 @@ v0.1 (2 May 2014) ----------------- Initial release. +- Fixed bug where merge(combine_attrs='override') was not copying attrs but instead referencing attrs from the first object. (:issue:) +- Fixed bug where ``merge(combine_attrs='override')`` was not copying attrs but instead referencing attrs from the first object. (:issue:`4629`) diff --git a/xarray/core/merge.py b/xarray/core/merge.py index ca4e29b600d..dff00804f8f 100644 --- a/xarray/core/merge.py +++ b/xarray/core/merge.py @@ -501,7 +501,7 @@ def merge_attrs(variable_attrs, combine_attrs): if combine_attrs == "drop": return {} elif combine_attrs == "override": - return variable_attrs[0] + return dict(variable_attrs[0]) elif combine_attrs == "no_conflicts": result = dict(variable_attrs[0]) for attrs in variable_attrs[1:]: