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/4682#issuecomment-745155086,https://api.github.com/repos/pydata/xarray/issues/4682,745155086,MDEyOklzc3VlQ29tbWVudDc0NTE1NTA4Ng==,12115839,2020-12-15T09:08:52Z,2020-12-15T09:08:52Z,NONE,"Yes in this case I need the functionality to be able to specify an alternative value similar to `np.where` so `DataArray.where` does not help me in this instance. But nevertheless this is a helpful insight. Actually I am probably not really qualified to answer your question about adding kwargs or getting the value from the options since I am not really familiar with xarray code. While searching for the reason/solution to my problem I also came across the issues you mentioned and then just had a quick glance at the code why `xr.where` does not keep the attributes. Anyway as far as I can see if `xr.where` would just have a **kwargs argument not `keep_attrs` specifically this would not directly break anything but would allow to pass any keyword argument of `apply_ufunc` and it would just be ""handed"" down. On the other side I can see the advantage of the options since this would keep the handling of keeping attributes consistent with existing code. Long story short; it would be nice for users to at least be able to have a choice to keep attributes with this kind of operations (I guess there are other operations which have the same problem) regardless of how it is implemented.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,762385879 https://github.com/pydata/xarray/issues/4682#issuecomment-743452370,https://api.github.com/repos/pydata/xarray/issues/4682,743452370,MDEyOklzc3VlQ29tbWVudDc0MzQ1MjM3MA==,14808389,2020-12-11T22:08:29Z,2020-12-12T23:09:11Z,MEMBER,"this also came up in #4141, where we proposed to work around this by using `DataArray.where` (as far as I can tell this doesn't work for you, though). There are two issues here: first of all, by default `DataArray.__eq__` removes the attributes, so without calling `xr.set_options(keep_attrs=True)` `data == 1` won't keep the attributes (see also #3891). However, even if we pass a `xarray` object with attributes, `xr.where` does not pass `keep_attrs` to `apply_ufunc`. Once it does the attributes will be propagated, but simply adding `keep_attrs=True` seems like a breaking change. Do we need to add a `keep_attrs` kwarg or get the value from `OPTIONS[""keep_attrs""]`?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,762385879