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 2041076267,I_kwDOAMm_X855qFor,8551,Make _obj_repr public,12115839,closed,0,,,4,2023-12-14T07:19:16Z,2023-12-21T16:00:52Z,2023-12-21T16:00:52Z,NONE,,,,"### What is your issue? We are using https://github.com/pydata/xarray/blob/2971994ef1dd67f44fe59e846c62b47e1e5b240b/xarray/core/formatting_html.py#L278 in the html representation of `AreaDefinitions` in https://github.com/pytroll/pyresample and don't like to import private functions. Would it be OK to make `_obj_repr` public?","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8551/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 1512708767,I_kwDOAMm_X85aKhqf,7405,"Test for variable name in coords True after xr.merge with compat=""minimal""",12115839,closed,0,,,2,2022-12-28T11:39:48Z,2023-08-30T07:57:37Z,2023-08-30T07:57:37Z,NONE,,,,"### What happened? Merging two `DataArray`s with `compat=""minimal""` drops the conflicting variable from coords but the test if that variable is in coords results to `True` even though the variable gets dropped. ### What did you expect to happen? The test should be `False` ### Minimal Complete Verifiable Example ```Python import numpy as np import xarray as xr da1 = xr.DataArray(np.zeros((2, 2)), dims=(""y"", ""x""), name=""1"") c1 = (""y"", [""1"", ""2""]) da1[""c1""] = c1 da2 = xr.DataArray(np.zeros((2, 2)), dims=(""y"", ""x""), name=""2"") c2 = (""y"", [""3"", ""4""]) da2[""c1""] = c2 xrds = xr.merge([da1, da2], compat=""minimal"") ""c1"" in xrds.coords # results to True but should be False ``` ### MVCE confirmation - [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [X] Complete example — the example is self-contained, including all data and the text of any traceback. - [X] Verifiable example — the example copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result. - [X] New issue — a search of GitHub Issues suggests this is not a duplicate. ### Relevant log output _No response_ ### Anything else we need to know? _No response_ ### Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:06:46) [GCC 10.3.0] python-bits: 64 OS: Linux OS-release: 5.10.0-1049-oem machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.1 libnetcdf: 4.8.1 xarray: 2022.12.0 pandas: 1.4.2 numpy: 1.22.3 scipy: 1.8.0 netCDF4: 1.5.8 pydap: None h5netcdf: 1.0.0 h5py: 3.6.0 Nio: None zarr: 2.11.3 cftime: 1.6.0 nc_time_axis: None PseudoNetCDF: None rasterio: 1.2.10 cfgrib: None iris: None bottleneck: 1.3.5 dask: 2022.05.0 distributed: 2022.5.0 matplotlib: 3.5.2 cartopy: 0.20.2 seaborn: None numbagg: None fsspec: 2022.8.2 cupy: None pint: 0.19.2 sparse: None flox: 0.6.5 numpy_groupies: 0.9.20 setuptools: 62.2.0 pip: 22.1 conda: None pytest: 7.1.2 mypy: None IPython: 8.3.0 sphinx: 4.5.0
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7405/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 762385879,MDU6SXNzdWU3NjIzODU4Nzk=,4682,xr.where not preserving attributes,12115839,closed,0,,,2,2020-12-11T14:20:20Z,2022-01-19T19:35:41Z,2022-01-19T19:35:41Z,NONE,,,," **What happened**: Using `xr.where` on a DataArray with attributes results in a new DataArray without attributes. **What you expected to happen**: Attributes should be preserved or at least there should be a choice (e.g. pass kwargs to `apply_ufunc` so `keep_attrs=True` can be passed). **Minimal Complete Verifiable Example**: ```python import numpy as np import xarray as xr data = xr.DataArray(np.ones([10,10], dtype=np.int8)) data.attrs[""attr_1""] = ""test1"" data.attrs[""attr_2""] = ""test2"" data2 = xr.where(data == 1, 5, 0) ``` **Anything else we need to know?**: Apart from loosing attributes the dtype is not conserved. In the example the resulting DataArray has dtype np.int64 instead of np.int8. As far as I can see this might not be an xarray but a numpy problem. **Environment**:
Output of xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.7.8 | packaged by conda-forge | (default, Jul 31 2020, 02:25:08) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 4.14.11-041411-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.16.0 pandas: 1.1.2 numpy: 1.19.1 scipy: 1.5.2 netCDF4: 1.5.4 pydap: None h5netcdf: 0.8.1 h5py: 2.10.0 Nio: None zarr: 2.4.0 cftime: 1.2.1 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.5 cfgrib: None iris: None bottleneck: None dask: 2.25.0 distributed: 2.25.0 matplotlib: 3.3.1 cartopy: 0.18.0 seaborn: None numbagg: None pint: None setuptools: 49.6.0.post20200814 pip: 20.2.3 conda: None pytest: 6.0.1 IPython: 7.18.1 sphinx: 3.2.1
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4682/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue