home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 287673906

This data as json

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-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
Powered by Datasette · Queries took 0.669ms · About: xarray-datasette