home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 140457546

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/577#issuecomment-140457546 https://api.github.com/repos/pydata/xarray/issues/577 140457546 MDEyOklzc3VlQ29tbWVudDE0MDQ1NzU0Ng== 10194086 2015-09-15T16:40:53Z 2015-09-15T16:40:53Z MEMBER

I found a way, leaving this here for reference. Or is there something better?

``` def wrap360(ds, lon='lon'): """ wrap longitude coordinates to 0..360

Parameters
----------
ds : Dataset
    object with longitude coordinates
lon : string
    name of the longitude ('lon', 'longitude', ...)

Returns
-------
wrapped : Dataset
    Another dataset array wrapped around.
"""

# wrap -180..179 to 0..359    
ds.coords[lon] = np.mod(ds[lon], 360)

# sort the data
return ds.reindex({ lon : np.sort(ds[lon])})

```

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  106595746
Powered by Datasette · Queries took 80.287ms · About: xarray-datasette