When merging DataArrays, a known issue (pydata/xarray#5436) is that xarray will promote DataArray-level attributes to Dataset-level ones:
>>> a = xr.DataArray(0, name="a", attrs={"x": "y"})
>>> b = xr.DataArray(0, name="b", attrs={"m": "n"})
>>> xr.merge([a, b])
<xarray.Dataset>
Dimensions: ()
Data variables:
a int64 0
b int64 0
Attributes:
x: y
This is generally not correct, and leads to distracting Dataset-level attributes on the results of xtorch_harmonics.roundtrip_filter. A suggested workaround is to convert DataArrays to Datasets prior to passing to merge: https://github.com/pydata/xarray/issues/5436#issuecomment-1255120923. This PR implements this suggestion and tests that DataArray-level attributes are no longer added at the Dataset level.
When merging DataArrays, a known issue (pydata/xarray#5436) is that xarray will promote DataArray-level attributes to Dataset-level ones:
This is generally not correct, and leads to distracting Dataset-level attributes on the results of
xtorch_harmonics.roundtrip_filter
. A suggested workaround is to convert DataArrays to Datasets prior to passing tomerge
: https://github.com/pydata/xarray/issues/5436#issuecomment-1255120923. This PR implements this suggestion and tests that DataArray-level attributes are no longer added at the Dataset level.Coverage reports (updated automatically):