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/6548#issuecomment-1118960785,https://api.github.com/repos/pydata/xarray/issues/6548,1118960785,IC_kwDOAMm_X85CsfyR,2448579,2022-05-05T19:17:24Z,2022-05-05T19:17:24Z,MEMBER,"Forcing the user to be explicit reduces bugs and user support requests :) so we like to do that. Thanks again @headtr1ck this is a great PR!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1221848774 https://github.com/pydata/xarray/pull/6548#issuecomment-1115117344,https://api.github.com/repos/pydata/xarray/issues/6548,1115117344,IC_kwDOAMm_X85Cd1cg,2448579,2022-05-02T16:52:59Z,2022-05-02T16:52:59Z,MEMBER,"Nice this looks like an improvement for everything other than dask arrays with only 100 elements, which is not a good use-case for dask. I was slightly concerned that the recrusive algorithm wouldn't work well with dask but it does seem to work better. ``` python def other_polyval(coord, coeffs, degree_dim=""degree""): x = coord.data deg_coord = coeffs[degree_dim] N = int(deg_coord.max()) + 1 lhs = xr.DataArray( np.stack([x ** (N - 1 - i) for i in range(N)], axis=1), dims=(coord.name, degree_dim), coords={ coord.name: coord.data, degree_dim: np.arange(deg_coord.max() + 1)[::-1], }, ) return xr.dot(lhs, coeffs, dims=degree_dim) coeffs = xr.DataArray(np.random.randn(2), dims=""degree"") da = xr.DataArray(dask.array.random.random((10**6), chunks=(10000)), dims=(""x"")) print(len(da.data.dask)) print(len(xr.polyval(da, coeffs).data.dask)) print(len(other_polyval(da, coeffs).data.dask)) ``` ``` 100 502 1005 ``` ","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 1, ""eyes"": 0}",,1221848774