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/1288#issuecomment-359534363,https://api.github.com/repos/pydata/xarray/issues/1288,359534363,MDEyOklzc3VlQ29tbWVudDM1OTUzNDM2Mw==,1386642,2018-01-22T19:19:25Z,2018-01-22T19:19:25Z,CONTRIBUTOR,"I would also be very interested in seeing your codes @lamorton. Overall, I think the xarray community could really benefit from some kind of centralized `contrib` package which has a low barrier to entry for these kinds of functions. So far, I suspect there has been a large amount of code duplication for routine tasks like the fft, since I have also written a function for that. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,210704949 https://github.com/pydata/xarray/issues/1288#issuecomment-287768014,https://api.github.com/repos/pydata/xarray/issues/1288,287768014,MDEyOklzc3VlQ29tbWVudDI4Nzc2ODAxNA==,1386642,2017-03-20T14:03:10Z,2017-03-20T14:03:10Z,CONTRIBUTOR,"I usually agree that using too many (or any) switches within functions is not ideal. However, I think this is more important for low level or internal routines. For user facing interfaces, I think it is okay. After all, many numpy and scipy functions have convenient switches that control the return values. By the way, the cumtrapz implementation I pasted above matches the scipy version when initial=0, which I also think would be a more sane default for integration. As far as implementation is concerned. Is there any performance downside to using xarrays shift operators versus delving deeper into dask with map_blocks, etc? I looked into using dasks cumreduction function, but am not sure it is possible to implement the trapezoid method in that way without changing dask. On Mon, Mar 20, 2017 at 8:48 AM Fabien Maussion wrote: > An argument against a single function is that the shape of the returned > array is different in each case. Also, cumtrapz > > has an inital keyword which changes the shape of the returned array. It > is currently set to None per default, but should be set to 0 per default > IMO. > > I this is not a problem, I also like to have one single function for > integration (simpler from a user perspective). > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > , or mute > the thread > > . > ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,210704949 https://github.com/pydata/xarray/issues/1288#issuecomment-287673906,https://api.github.com/repos/pydata/xarray/issues/1288,287673906,MDEyOklzc3VlQ29tbWVudDI4NzY3MzkwNg==,1386642,2017-03-20T03:45:18Z,2017-03-20T03:45:18Z,CONTRIBUTOR,"I would also like to see an `integrate` function. I have had one monkey patched in my own xarray routines for a while now. Also wanted: `cumtrapz` and friends. Maybe this could be implemented by adding an optional `cumulative` flag. This shouldn't be too hard to do. For example, in the following cumtrapz implementation all that would need to be changed is the final `cumsum` call. ```python def cumtrapz(A, dim): """"""Cumulative Simpson's rule (aka Tai's method) Notes ----- Simpson rule is given by int f (x) = sum (f_i+f_i+1) dx / 2 """""" x = A[dim] dx = x - x.shift(**{dim:1}) dx = dx.fillna(0.0) return ((A.shift(**{dim:1}) + A)*dx/2.0)\ .fillna(0.0)\ .cumsum(dim) ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,210704949