id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 293345254,MDU6SXNzdWUyOTMzNDUyNTQ=,1875,roll doesn't handle periodic boundary conditions well,1217238,closed,0,,,5,2018-01-31T23:07:42Z,2018-08-15T08:11:29Z,2018-08-15T08:11:29Z,MEMBER,,,,"DataArray.roll() currently rolls both data variables and coordinates: ``` >>> arr = xr.DataArray(range(4), [('x', range(0, 360, 90))]) >>> arr.roll(x=2) array([2, 3, 0, 1]) Coordinates: * x (x) int64 180 270 0 90 ``` This is sort of makes sense, but the labels are now all non-monotonic, so you can't even plot the data with xarray. In my experience, you probably want coordinate labels that either look like: 1. The unrolled original coordinates: [0, 90, 180, 270] 2. Shifted coordinates: [-180, -90, 0, 90] It should be easier to accomplish this is in xarray. I currently resort to using roll and manually fixing up coordinates after the fact. I'm actually not sure if there are any use-cases for the current behavior. Choice (1) would have the virtue of being consistent with shift(): ``` >>> arr.shift(x=2) array([nan, nan, 0., 1.]) Coordinates: * x (x) int64 0 90 180 270 ``` We could potentially add optional another argument for shifting labels, too, or requiring fixing that up by subtraction. Note: you might argue that this is overly geoscience specific, and it would be, if this was only for handling a longitude coordinate. But periodic boundary conditions are common in many areas of the physical sciences.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/1875/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue