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 1046990273,PR_kwDOAMm_X84uNA5a,5950,"Generate reductions for DataArray, Dataset, GroupBy and Resample",2448579,closed,0,,,13,2021-11-08T04:02:18Z,2022-03-18T04:17:30Z,2022-03-12T08:17:48Z,MEMBER,,0,pydata/xarray/pulls/5950,"- Closes #5898 - Closes #1050 - xref #5816 This is an improvement to #5871. I now use classes to make the generators extensible. This allows us to generate DataArray and Dataset reductions pretty easily. It *should* be easy to extend to Rolling, Coarsen. Another nice feature is that we can explicitly add custom kwargs to the signature like `ddof` for `var` and `std`.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5950/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 630062936,MDU6SXNzdWU2MzAwNjI5MzY=,4120,coarsen deletes attrs on original object,2448579,closed,0,,,13,2020-06-03T14:50:16Z,2020-09-09T19:30:42Z,2020-09-09T18:56:36Z,MEMBER,,,," #### MCVE Code Sample ```python # Your code here import xarray as xr ds = xr.tutorial.load_dataset(""air_temperature"") ds2 = xr.tutorial.load_dataset(""air_temperature"") xr.testing.assert_identical(ds, ds2) # passes ds.coarsen(lat=5).mean() xr.testing.assert_identical(ds, ds2) # fails ``` Bug: `coarsen` reductions are modifying the original dataset by deleting all attributes ``` AssertionErrorTraceback (most recent call last) in 48 xr.testing.assert_identical(ds, ds2) 49 ds.coarsen(lat=5).mean() ---> 50 xr.testing.assert_identical(ds, ds2) ~/work/python/xarray/xarray/testing.py in assert_identical(a, b) 87 assert a.identical(b), formatting.diff_array_repr(a, b, ""identical"") 88 elif isinstance(a, (Dataset, Variable)): ---> 89 assert a.identical(b), formatting.diff_dataset_repr(a, b, ""identical"") 90 else: 91 raise TypeError(""{} not supported by assertion comparison"".format(type(a))) AssertionError: Left and right Dataset objects are not identical Differing coordinates: L * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0 R * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 25.0 22.5 20.0 17.5 15.0 standard_name: latitude long_name: Latitude units: degrees_north axis: Y Differing data variables: L air (time, lat, lon) float32 241.2 242.5 243.5 ... 296.49 296.19 295.69 R air (time, lat, lon) float32 241.2 242.5 243.5 ... 296.49 296.19 295.69 long_name: 4xDaily Air temperature at sigma level 995 units: degK precision: 2 GRIB_id: 11 GRIB_name: TMP var_desc: Air temperature dataset: NMC Reanalysis level_desc: Surface statistic: Individual Obs parent_stat: Other actual_range: [185.16 322.1 ] ``` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4120/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 282339218,MDExOlB1bGxSZXF1ZXN0MTU4NTM3MTI2,1785,plot.line(): Draw multiple lines for 2D DataArrays.,2448579,closed,0,,,13,2017-12-15T07:14:25Z,2018-05-10T05:12:16Z,2017-12-31T17:16:17Z,MEMBER,,0,pydata/xarray/pulls/1785," - [x] Tests added (for all bug fixes or enhancements) - [x] Tests passed (for all non-documentation changes) - [x] Passes ``git diff upstream/master **/*py | flake8 --diff`` (remove if you did not edit any Python files) - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later) Adds support for plotting multiple lines if `plot.line()` is provided with a 2D dataarray. kwarg `x` lets you specify co-ordinate for x-axis. Example: ![xarray-multiple-line](https://user-images.githubusercontent.com/2448579/34031085-96dfbaee-e124-11e7-8578-e97586257b7a.png) ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/1785/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull