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/5847#issuecomment-948958184,https://api.github.com/repos/pydata/xarray/issues/5847,948958184,IC_kwDOAMm_X844j_Po,31376402,2021-10-21T19:59:18Z,2021-10-21T20:00:04Z,CONTRIBUTOR,"Hi @Illviljan @keewis,
I have added tests and marked them as xfail
Accoriding to pytest docs
> A skip means that you expect your test to pass only if some conditions are met, otherwise pytest should skip running the test altogether. Common examples are skipping windows-only tests on non-windows platforms, or skipping tests that depend on an external resource which is not available at the moment (for example a database).
> An xfail means that you expect a test to fail for some reason. A common example is a test for a feature not yet implemented, or a bug not yet fixed. When a test passes despite being expected to fail (marked with pytest.mark.xfail), itβs an xpass and will be reported in the test summary.
This case seems exactly what xfail is meant for. But feel free to change this.
---
> Do the slice plots work with non-dimension coordinates? If so, we should maybe add a test with pint for that, too: units in non-dimension coordinates are not stripped.
It seems so, but it raises a `pint` warning despite the code producing the intended figure:
```python
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import pytest
pint = pytest.importorskip(""pint"")
unit_registry = pint.UnitRegistry(force_ndarray=True)
coord_unit, coord_attrs = (unit_registry.m, {})
def test_units_in_slice_line_plot_labels_isel():
arr = xr.DataArray(
name=""var_a"",
data=np.array([[1, 2], [3, 4]]),
coords=dict(
a=(""x"", np.array([5, 6]) * coord_unit, coord_attrs),
b=(""y"", np.array([7, 8])),
),
dims=(""x"", ""y""),
)
arr.isel(x=0).plot(marker=""o"")
assert plt.gca().get_title() == ""a = 5 [meter]""
return arr
test_units_in_slice_line_plot_labels_isel()
```

---
I would appreciate a lot if we keep the scope of this PR to what I have contributed so far, I am running out of bandwidth in the project I am involved and won't be able to add much more to this PR.
Kind regards,
Victor","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1021396447
https://github.com/pydata/xarray/pull/5847#issuecomment-944278576,https://api.github.com/repos/pydata/xarray/issues/5847,944278576,IC_kwDOAMm_X844SIww,31376402,2021-10-15T13:01:32Z,2021-10-15T13:02:24Z,CONTRIBUTOR,"Just checked and this cannot be tested for pint units, there is already a comment in there explaining this:
```python
# TODO make coord a Quantity once unit-aware indexes supported""
```
Since the slice units come from a coordinate these units can't be pint units (at least not yet).
I added a new test for the units in the title of a slice line plot, also added the same comment about pint units.
Who should I ping for the PR approval?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1021396447
https://github.com/pydata/xarray/pull/5847#issuecomment-944208315,https://api.github.com/repos/pydata/xarray/issues/5847,944208315,IC_kwDOAMm_X844R3m7,31376402,2021-10-15T11:01:17Z,2021-10-15T11:01:17Z,CONTRIBUTOR,"> This is great, thanks @caenrigen !
>
> It just needs a couple of tests - ideally one for basic behaviour like you've shown in your example (which [should probably live here](https://github.com/pydata/xarray/blob/5499949b5937277dcd599a182201d0e2fc5e818e/xarray/tests/test_plot.py#L166)), and another [checking that it works with pint units](https://github.com/pydata/xarray/blob/5499949b5937277dcd599a182201d0e2fc5e818e/xarray/tests/test_units.py#L5601) like we added in #5561.
Hi @TomNicholas!
Thank you for the input and guidance, will work on adding the tests π
Cheers","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1021396447
https://github.com/pydata/xarray/issues/5436#issuecomment-872210975,https://api.github.com/repos/pydata/xarray/issues/5436,872210975,MDEyOklzc3VlQ29tbWVudDg3MjIxMDk3NQ==,31376402,2021-07-01T12:37:52Z,2021-07-01T12:37:52Z,CONTRIBUTOR,"@keewis thank you for the reply
> To fix this, I would vote for not using `promote_attrs=True` in `merge` (low confidence vote, though, I'm sure there was a reason for that). We could also try to allow specifying separate strategies for main object and variables, but that looks somewhat complicated (_and_ I'm still not sure what syntax we could use for that).
Does this mean that my workaround is not fully working as I would like it to? (I want it to basically do nothing to the attrs)
Is it possible at the moment to pass `promote_attrs=False` to `xr.merge()`?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,911513701
https://github.com/pydata/xarray/issues/5436#issuecomment-871681764,https://api.github.com/repos/pydata/xarray/issues/5436,871681764,MDEyOklzc3VlQ29tbWVudDg3MTY4MTc2NA==,31376402,2021-06-30T19:49:24Z,2021-06-30T19:49:24Z,CONTRIBUTOR,"Hey guys! First of all thank you for the work on maintaining this package π
I am running into the same issue and it is partially blocking an [open-source package](https://gitlab.com/quantify-os/quantify-core) (used in experimental quantum computing) from adopting the latest version of xarray.
For our typical dataset this happens:
```python
import xarray as xr
import numpy as np
x0 = xr.DataArray(data=np.ones(5), name=""x0"", attrs={
'name': 'x', 'long_name': 'X position', 'units': 'm', 'batched': False})
y0 = xr.DataArray(data=np.ones(5), name=""y0"", attrs={
'name': 'y', 'long_name': 'Y position', 'units': 'm', 'batched': True})
ds = xr.merge([x0, y0])
print(ds)
```
```bash
Dimensions: (dim_0: 5)
Dimensions without coordinates: dim_0
Data variables:
x0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0
y0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0
Attributes:
name: x
long_name: X position
units: m
batched: False
```
As default behavior this is totally unexpected because the variables attributes have nothing to do with the dataset itself. I am just trying to put all my data in a single container. (Am i using the wrong function for this?)
And second, `combine_attrs` has no option for ""do nothing"" which was the behavior in xarray `0.17.0`. I noticed the current master brach allows passing a function but not sure if that solves the problem. The `""drop""` option indeed acts in very weird way, I tried it in the hope that it will drop `attrs` on the resulting dataset instead of affecting the attributes of the variables.
My suggestion is to do nothing by default, i.e. `combine_attrs = None`, simply does not try to combine the attribute in any way.
I understand there might be cases where combining the attributes makes sense, so maybe my suggestion only applies when **only** `DataArray`s objects are merged into a `Dataset` (If i recall correctly the ""what's new"" list, this will be already enforced in `0.18.3`).
Hope my use case helps this discussion.
---
In the meantime the workaround seems to be: `combine_attrs = ""override""` (because it will not (?) affect the attributes of the variables) + and wipe attrs afterwards with `dataset.attrs = dict()`:
```python
import xarray as xr
import numpy as np
x0 = xr.DataArray(data=np.ones(5), name=""x0"", attrs={
'name': 'x', 'long_name': 'X position', 'units': 'm', 'batched': False})
y0 = xr.DataArray(data=np.ones(5), name=""y0"", attrs={
'name': 'y', 'long_name': 'Y position', 'units': 'm', 'batched': True})
ds = xr.merge([x0, y0])
ds.attrs = dict()
print(ds)
print(""==="")
print(ds.x0)
```
```bash
Dimensions: (dim_0: 5)
Dimensions without coordinates: dim_0
Data variables:
x0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0
y0 (dim_0) float64 1.0 1.0 1.0 1.0 1.0
===
array([1., 1., 1., 1., 1.])
Dimensions without coordinates: dim_0
Attributes:
name: x
long_name: X position
units: m
batched: False
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,911513701
https://github.com/pydata/xarray/issues/4985#issuecomment-806479491,https://api.github.com/repos/pydata/xarray/issues/4985,806479491,MDEyOklzc3VlQ29tbWVudDgwNjQ3OTQ5MQ==,31376402,2021-03-25T08:58:17Z,2021-03-25T08:58:17Z,CONTRIBUTOR,"> @caenrigen thanks for the issue. Would you be up for fixing this with a PR?
Unfortunately out of bandwidth currently, this came out when addressing #4981 so I reported it as suggested.
For anyone facing the issue, installing `netcdf4` solves the issue as a temporary fix","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,819937730
https://github.com/pydata/xarray/issues/4981#issuecomment-791375996,https://api.github.com/repos/pydata/xarray/issues/4981,791375996,MDEyOklzc3VlQ29tbWVudDc5MTM3NTk5Ng==,31376402,2021-03-05T12:01:35Z,2021-03-05T12:01:35Z,CONTRIBUTOR,"Hey, guys!!
Does any of you have backends expertise? A review of PR #4986 from someone with knowledge on the topic would be appreciated so much π₯Ί One collaborator already approves the hotfix but is waiting for an additional approval
Kind regards","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,819379617
https://github.com/pydata/xarray/issues/4981#issuecomment-788872922,https://api.github.com/repos/pydata/xarray/issues/4981,788872922,MDEyOklzc3VlQ29tbWVudDc4ODg3MjkyMg==,31376402,2021-03-02T12:27:33Z,2021-03-05T12:00:23Z,CONTRIBUTOR,"> Very cool to hear you're using xarray in your quantum computing framework!
>
> This sounds like a reasonable change to me. A PR would indeed be very welcome!
PR created https://github.com/pydata/xarray/pull/4986","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,819379617
https://github.com/pydata/xarray/pull/4986#issuecomment-789263557,https://api.github.com/repos/pydata/xarray/issues/4986,789263557,MDEyOklzc3VlQ29tbWVudDc4OTI2MzU1Nw==,31376402,2021-03-02T22:23:27Z,2021-03-02T22:23:27Z,CONTRIBUTOR,"@keewis thank you for the guidance! changes applied β
Looking forward to the merge π€©","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,819967505
https://github.com/pydata/xarray/issues/4981#issuecomment-788846940,https://api.github.com/repos/pydata/xarray/issues/4981,788846940,MDEyOklzc3VlQ29tbWVudDc4ODg0Njk0MA==,31376402,2021-03-02T11:42:43Z,2021-03-02T11:42:43Z,CONTRIBUTOR,"> > but the tests (without any changes to the code) fail on my local clone of the repo so it would be more difficult to go through a PR for this.
>
> Can you post an issue about that with an error message?
>
> You can always make your change, and open a PR, and have the CI check it :) . PRs are very welcome!
Done https://github.com/pydata/xarray/issues/4985","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,819379617