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 outside_footprint for spherical coordinates #535

Closed
wants to merge 1 commit into from

Conversation

nden
Copy link
Collaborator

@nden nden commented Dec 16, 2024

Follow up on #498
When spherical coordinates and the footprint are around (0, 0) shift them all to be less than 180 before comparing the range.

@nden nden requested a review from a team as a code owner December 16, 2024 20:56
@nden nden requested a review from mcara December 16, 2024 20:57
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 87.48%. Comparing base (9cd8552) to head (35860b8).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
gwcs/wcs.py 81.81% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #535      +/-   ##
==========================================
+ Coverage   87.42%   87.48%   +0.05%     
==========================================
  Files          22       22              
  Lines        3874     3938      +64     
==========================================
+ Hits         3387     3445      +58     
- Misses        487      493       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +517 to +518
range = np.mod(range, 180)
coord = np.mod(coord, 180)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinates already should be in the [0, 360] and [0, 180] (or [-90, 90]) range. Taking mod at 180 does not look like the correct approach. I think there may be cases when this could fail. For example, take CRVAL at 180 and an image that spans from ra=179.8 to 180.1.

Try adding some unit tests for this.

Also a good time to replace range with something else like world_range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants