issue_comments: 447043519
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/1005#issuecomment-447043519 | https://api.github.com/repos/pydata/xarray/issues/1005 | 447043519 | MDEyOklzc3VlQ29tbWVudDQ0NzA0MzUxOQ== | 1217238 | 2018-12-13T16:59:55Z | 2018-12-13T16:59:55Z | MEMBER | Something like this might work for you: ```python import xarray import numpy as np def add_cyclic_point(xarray_obj, dim, period=None): if period is None: period = xarray_obj.sizes[dim] / xarray_obj.coords[dim][:2].diff(dim).item() first_point = xarray_obj.isel({dim: slice(1)}) first_point.coords[dim] = first_point.coords[dim]+period return xarray.concat([xarray_obj, first_point], dim=dim) ``` Example usage: ```
It would also make sense to add a more generic |
{ "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
177484162 |