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/490#issuecomment-124192448,https://api.github.com/repos/pydata/xarray/issues/490,124192448,MDEyOklzc3VlQ29tbWVudDEyNDE5MjQ0OA==,1217238,2015-07-23T18:16:06Z,2015-07-23T18:16:06Z,MEMBER,"I agree, this would be useful. Probably should take a `dim` argument that specifies the dimension along which to take the differences. I guess `x.diff('x')` would do something like the following? ``` python In [28]: x = xray.Dataset({'foo': ('x', [5, 5, 6, 6])}) In [29]: start = x.isel(x=slice(None, -1)) In [30]: end = x.isel(x=slice(1, None)) In [31]: start.coords['x'] = end.coords['x'] In [32]: end - start Out[32]: Dimensions: (x: 3) Coordinates: * x (x) int64 1 2 3 Data variables: foo (x) int64 0 1 0 ``` Since this logic is the same for Dataset and DataArray objects, it could live as a method on `BaseDataObject` in `xray/core/common.py`: https://github.com/xray/xray/blob/v0.5.2/xray/core/common.py#L147 If you find yourself needing to write dataset or dataarray specific logic, write it as a Dataset method and follow the example of DataArray.swap to extend it to dataarrays: https://github.com/xray/xray/blob/v0.5.2/xray/core/dataarray.py#L659 ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,96844263 https://github.com/pydata/xarray/issues/490#issuecomment-124147990,https://api.github.com/repos/pydata/xarray/issues/490,124147990,MDEyOklzc3VlQ29tbWVudDEyNDE0Nzk5MA==,358378,2015-07-23T15:47:27Z,2015-07-23T15:47:27Z,CONTRIBUTOR,"If you can give me a pointer where in the code this would have to be implemented, I could give it a try myself ... ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,96844263