Skip to content
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 inequality sign and var name in outside bbox test #540

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions gwcs/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,19 +508,19 @@ def outside_footprint(self, world_arrays):
axis_range = footprint[:, idim]
else:
axis_range = footprint
range = [axis_range.min(), axis_range.max()]
min_ax = axis_range.min()
max_ax = axis_range.max()

if (axtyp == 'SPATIAL' and str(phys).endswith((".ra", ".lon"))
and range[1] - range[0] > 180):
and (max_ax - min_ax) > 180):
# most likely this coordinate is wrapped at 360
d = np.mean(range)
range = [
axis_range[axis_range < d].max(),
axis_range[axis_range > d].min()
]
outside = (coord >= range[0]) & (coord < range[1])
d = 0.5 * (min_ax + max_ax)
m = (axis_range <= d)
min_ax = axis_range[m].max()
max_ax = axis_range[~m].min()
outside = (coord > min_ax) & (coord < max_ax)
else:
outside = (coord < range[0]) | (coord > range[1])
outside = (coord < min_ax) | (coord > max_ax)
if np.any(outside):
if np.isscalar(coord):
coord = np.nan
Expand Down
Loading