-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
roll doesn't handle periodic boundary conditions well #1875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I like the option 1. Another option could be to add a circular cooredinate class after #1603 is implemented? |
Yes, it would be nice to change this to behavior (1) above. There are a few options here:
I am loathe to loose the name |
Option 2 sounds good; I'll try putting together a pull request sometime, hopefully within a week! |
DataArray.roll() currently rolls both data variables and coordinates:
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:
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():
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.
The text was updated successfully, but these errors were encountered: