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/issues/5629#issuecomment-886905635,https://api.github.com/repos/pydata/xarray/issues/5629,886905635,IC_kwDOAMm_X8403Rsj,20629530,2021-07-26T17:52:42Z,2021-07-26T17:52:42Z,CONTRIBUTOR,"> @aulemahal what do you think about how easy it might be to change polyfit to use apply_ufunc? Should be easy! The code was written without apply_ufunc for a few reasons, one being that using `apply_ufunc+vectorize` was slower than the `apply_along_axis` trick it currently uses. But, with the issue raised here, that might not be true...","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 1, ""rocket"": 0, ""eyes"": 0}",,950882492 https://github.com/pydata/xarray/issues/5629#issuecomment-885216203,https://api.github.com/repos/pydata/xarray/issues/5629,885216203,IC_kwDOAMm_X840w1PL,39069044,2021-07-22T20:37:04Z,2021-07-22T20:37:04Z,CONTRIBUTOR,"Potentially a useful comparison: here is the task graph for the same problem posed to `da.curvefit`, which uses `xr.apply_ufunc(scipy.optimize.curvefit, ..., vectorize=True)`. Looks a lot cleaner, and I think `xr.polyfit` could be re-implemented this way without much trouble. ```python import xarray as xr import dask.array as dsa def linear(x, m, b): return m * x + b da = xr.DataArray(dsa.random.random((4,6, 100), chunks=(1,2,100)), dims=['x','y', 'time']) fit = da.curvefit('time', linear).curvefit_coefficients ``` ![image](https://user-images.githubusercontent.com/39069044/126705616-4fa914a7-14f0-4727-bf3a-e916627de4e7.png) ","{""total_count"": 3, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 3, ""rocket"": 0, ""eyes"": 0}",,950882492 https://github.com/pydata/xarray/issues/5629#issuecomment-885086453,https://api.github.com/repos/pydata/xarray/issues/5629,885086453,IC_kwDOAMm_X840wVj1,14314623,2021-07-22T17:28:52Z,2021-07-22T17:28:52Z,CONTRIBUTOR,Should I close this one then?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,950882492