-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fix x ranges upon projection #722
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this. I can't quite decide if it's the right fix, though; would be good to have e.g. @philippjfr think about it.
My other three thoughts about approaches to fixing this is:
This PR's fix only updates two integers (the x_range), which is basically "free" I don't think this can be patched in HoloViews either because the logic here https://github.com/holoviz/holoviews/blob/main/holoviews/operation/resample.py#L139-L140 is correct although I don't know what the difference between x0 and ex0 |
Maybe this can possibly also fix #593? |
Maybe! If it uses lat/lon, then there's a chance. |
Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
def _set_unwrap_lons(self, element): | ||
if isinstance(self.geographic, _CylindricalProjection): | ||
x1, x2 = element.range(0) | ||
self._unwrap_lons = 0 <= x1 <= 360 and 0 <= x2 <= 360 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is too eager, specifically it should check that it's actually in the 0-360 range rather than merely all being east of Greenwich, so something like:
self._unwrap_lons = 0 <= x1 <= 360 and 180 <= x2 <= 360
@@ -64,6 +64,10 @@ def project_ranges(cb, msg, attributes): | |||
extents = x0, y0, x1, y1 | |||
x0, y0, x1, y1 = project_extents(extents, plot.projection, | |||
plot.current_frame.crs) | |||
if plot._unwrap_lons and -180 <= x0 < 0 or -180 <= x1 < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be:
if plot._unwrap_lons and (-180 <= x0 < 0 or -180 <= x1 < 0):
Data no longer disappears upon zoom as described in #673 (comment).
Closes #673
Screen.Recording.2024-04-12.at.10.01.04.AM.mov