id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 630062936,MDU6SXNzdWU2MzAwNjI5MzY=,4120,coarsen deletes attrs on original object,2448579,closed,0,,,13,2020-06-03T14:50:16Z,2020-09-09T19:30:42Z,2020-09-09T18:56:36Z,MEMBER,,,," #### MCVE Code Sample ```python # Your code here import xarray as xr ds = xr.tutorial.load_dataset(""air_temperature"") ds2 = xr.tutorial.load_dataset(""air_temperature"") xr.testing.assert_identical(ds, ds2) # passes ds.coarsen(lat=5).mean() xr.testing.assert_identical(ds, ds2) # fails ``` Bug: `coarsen` reductions are modifying the original dataset by deleting all attributes ``` AssertionErrorTraceback (most recent call last) in 48 xr.testing.assert_identical(ds, ds2) 49 ds.coarsen(lat=5).mean() ---> 50 xr.testing.assert_identical(ds, ds2) ~/work/python/xarray/xarray/testing.py in assert_identical(a, b) 87 assert a.identical(b), formatting.diff_array_repr(a, b, ""identical"") 88 elif isinstance(a, (Dataset, Variable)): ---> 89 assert a.identical(b), formatting.diff_dataset_repr(a, b, ""identical"") 90 else: 91 raise TypeError(""{} not supported by assertion comparison"".format(type(a))) AssertionError: Left and right Dataset objects are not identical Differing coordinates: L * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0 R * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0 standard_name: latitude long_name: Latitude units: degrees_north axis: Y Differing data variables: L air (time, lat, lon) float32 241.2 242.5 243.5 ... 296.49 296.19 295.69 R air (time, lat, lon) float32 241.2 242.5 243.5 ... 296.49 296.19 295.69 long_name: 4xDaily Air temperature at sigma level 995 units: degK precision: 2 GRIB_id: 11 GRIB_name: TMP var_desc: Air temperature dataset: NMC Reanalysis level_desc: Surface statistic: Individual Obs parent_stat: Other actual_range: [185.16 322.1 ] ``` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4120/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue