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/4300#issuecomment-677666962,https://api.github.com/repos/pydata/xarray/issues/4300,677666962,MDEyOklzc3VlQ29tbWVudDY3NzY2Njk2Mg==,31700619,2020-08-20T13:32:33Z,2020-08-20T13:40:07Z,CONTRIBUTOR,"> > > cheers @TomNicholas , that's helpful. :) I've started messing with the idea in [this Gist](https://gist.github.com/AndrewWilliams3142/6ea8b4f4287e0d0290f52b2fcd50a662) if you want to have a look. > > It's pretty hacky at the moment, but might be helpful as a testbed. (And a way of getting my head around how `apply_ufunc` would work in this context) @AndrewWilliams3142 I've tried to extend this to a 3d matrix (timeseries of 2d matrices) using Dask, it seems to work! Have a look here https://gist.github.com/clausmichele/8350e1f7f15e6828f29579914276de71","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,671609109 https://github.com/pydata/xarray/issues/4300#issuecomment-669065910,https://api.github.com/repos/pydata/xarray/issues/4300,669065910,MDEyOklzc3VlQ29tbWVudDY2OTA2NTkxMA==,31700619,2020-08-05T08:44:06Z,2020-08-05T08:44:06Z,CONTRIBUTOR,"I am also trying to get similar results of scipy curve_fit with xarray and dask. Is there a workaround I can use to fit a sinusoidal function with the current functions/methods? This is the function I use to fit a seasonal trend with scipy: ``` t = 365 def timeseries_function_season (x,a0,a1,a2): return a0+(a1*np.cos(2*np.pi/t*x)+a2*np.sin(2*np.pi/t*x)) timeseries_model_fit,pcov= curve_fit(timeseries_function_season,x,y) ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,671609109