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/pull/5984#issuecomment-1012384997,https://api.github.com/repos/pydata/xarray/issues/5984,1012384997,IC_kwDOAMm_X848V8Tl,19226431,2022-01-13T18:10:57Z,2022-01-13T18:10:57Z,CONTRIBUTOR,It was a pleasure!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-1012330030,https://api.github.com/repos/pydata/xarray/issues/5984,1012330030,IC_kwDOAMm_X848Vu4u,14371165,2022-01-13T17:03:07Z,2022-01-13T17:03:07Z,MEMBER,"Thank you, @FabianHofmann !","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-983858467,https://api.github.com/repos/pydata/xarray/issues/5984,983858467,IC_kwDOAMm_X846pH0j,2448579,2021-12-01T17:19:12Z,2021-12-01T17:19:12Z,MEMBER,"> (Just for completeness - xr.DataArray(da, **kwargs) does a good job at erroring if the kwargs are not compatible with da.)
Sounds good to me then!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-983747745,https://api.github.com/repos/pydata/xarray/issues/5984,983747745,IC_kwDOAMm_X846osyh,10194086,2021-12-01T15:22:27Z,2021-12-01T15:22:27Z,MEMBER,"Any objections to merging this as is? If we don't disallow `xr.DataArray(da)` this is a clear advantage over the current version.
However,
```python
xr.DataArray(da).data is da.data # True
xr.DataArray(da.data).data is da.data # True
# while
da.copy().data is da.data # False (deep=True is the default)
```
might just be surprising in some situations.
(Just for completeness - `xr.DataArray(da, **kwargs)` does a good job at erroring if the `kwargs` are not compatible with `da`.)","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-979413036,https://api.github.com/repos/pydata/xarray/issues/5984,979413036,IC_kwDOAMm_X846YKgs,5635139,2021-11-25T18:24:04Z,2021-11-25T18:24:04Z,MEMBER,"> In contrast to that, I think we _can_ keep `xr.DataArray(da)` working, but _only_ if it's the only argument (i.e. I don't think we should allow `xr.DataArray(da, dims=(""x"", ""y""))` or something similar – those might still be useful, but I'd make them separate methods instead of overloading the constructor).
Perfect, very much agree, thank you for the clear description @keewis !","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-979283695,https://api.github.com/repos/pydata/xarray/issues/5984,979283695,IC_kwDOAMm_X846Xq7v,14808389,2021-11-25T15:00:59Z,2021-11-25T15:00:59Z,MEMBER,"for reference, the situation we already deprecated and removed was passing `([""x"", ""y""], da)` to `as_variable` (for example, when passed to the `coords` parameter of `DataArray`), which would create a new variable with new dimension names, but drop the old attrs and the name / coords *and* it would convert `var` to `numpy`, which could trigger a computation if the data was a `dask` array (or raise / emit a warning for other array types).
In contrast to that, I think we *can* keep `xr.DataArray(da)` working, but *only* if it's the only argument (i.e. I don't think we should allow `xr.DataArray(da, dims=(""x"", ""y""))` or something similar – those might still be useful, but I'd make them separate methods instead of overloading the constructor).
However, this might make the constructor a bit more difficult to understand so if we don't think that's worth the (minor) inconvenience:
```python
da if isinstance(da, xr.DataArray) else xr.DataArray(da)
```
we can go ahead with the deprecation.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-979262832,https://api.github.com/repos/pydata/xarray/issues/5984,979262832,IC_kwDOAMm_X846Xl1w,5635139,2021-11-25T14:31:53Z,2021-11-25T14:31:53Z,MEMBER,"> How about we raise DeprecationWarning for now asking the user to pass in `.data` instead.
Does this mean `xr.DataArray(da)` would be deprecated? That seems like a very common case. Sorry for joining late but could I ask why this is necessary, if my assumption is right? I had been thinking that is broadly equivalent to a copy.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-979096277,https://api.github.com/repos/pydata/xarray/issues/5984,979096277,IC_kwDOAMm_X846W9LV,10194086,2021-11-25T11:02:18Z,2021-11-25T11:02:18Z,MEMBER,"> How about we raise DeprecationWarning for now asking the user to pass in `.data` instead.
Makes sense - how about:
```python
msg = (
""Passing a `DataArray` object to the `DataArray` constructor is ambiguous.\n""
""Pass `da.data`, or use `da.copy(deep=True)`, or one of the `xarray.*_like` (e.g. ""
""`xarray.zeros_like`) functions instead,\n""
""depending on your use case.""
)
warnings.warn(msg, FutureWarning)
```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-978014946,https://api.github.com/repos/pydata/xarray/issues/5984,978014946,IC_kwDOAMm_X846S1Li,2448579,2021-11-24T16:04:01Z,2021-11-24T16:04:01Z,MEMBER,How about we raise DeprecationWarning for now asking the user to pass in `.data` instead.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367
https://github.com/pydata/xarray/pull/5984#issuecomment-977689446,https://api.github.com/repos/pydata/xarray/issues/5984,977689446,IC_kwDOAMm_X846Rltm,10194086,2021-11-24T09:23:14Z,2021-11-24T09:23:14Z,MEMBER,@dcherian you had an opinion on this in #5983 - would you rather raise a `ValueError` here and advise to pass `da.data`? ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1052740367