html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/6852#issuecomment-1200925682,https://api.github.com/repos/pydata/xarray/issues/6852,1200925682,IC_kwDOAMm_X85HlKvy,14808389,2022-08-01T09:06:16Z,2022-08-01T09:11:52Z,MEMBER,"bisecting tells me this is a regression introduced by #6389. Looking at the code, this happens because copying the variables with `variables.copy()` makes a shallow copy of the dictionary (and not its values), which means that we're actually mutating the `Dataset` variables. If I change that line to
```python
# make a shallow copy of each variable
new_variables = {name: var.copy() for name, var in variables.items()}
```
we stop mutating the dataset.
cc @benbovy","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1323521079
https://github.com/pydata/xarray/issues/6852#issuecomment-1200463448,https://api.github.com/repos/pydata/xarray/issues/6852,1200463448,IC_kwDOAMm_X85HjZ5Y,14808389,2022-07-31T17:07:55Z,2022-07-31T17:45:05Z,MEMBER,"~can you try if setting `keep_attrs=True` helps?~
That's wrong, I can reproduce the side-effects. Not sure where that's coming from, though. And interestingly, only the first operand is mutated, `da_withoutunits == da_withunits` does not drop the units on `da_withunits`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1323521079