2838-bug---hi-l2---combined-maps-filled-with-nans#2839
Merged
subagonsouth merged 2 commits intoIMAP-Science-Operations-Center:devfrom Mar 12, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes HI L2 full-spin heliospheric combined-map NaN propagation when merging ram/anti-ram intensity maps (Issue #2838).
Changes:
- Update
combine_mapsto prevent NaN propagation during the weighted intensity summation. - Add a unit test intended to validate NaN-handling behavior in
combine_maps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
imap_processing/hi/hi_l2.py |
Adjusts weighted intensity combination to handle NaNs during summation. |
imap_processing/tests/hi/test_hi_l2.py |
Adds a new test case covering NaN intensity behavior in map combination. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+600
to
+602
| ram_valid_mask = np.logical_and( | ||
| ram_ds["ena_intensity_stat_uncert"] > 0, np.isfinite(ram_ds["ena_intensity"]) | ||
| ) |
Collaborator
There was a problem hiding this comment.
Nice use of masking here. I haven't used logical_and before. This is super useful!
52aa402
into
IMAP-Science-Operations-Center:dev
14 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quick bugfix.
When combining intensities from ram/anti maps, I forgot to handle NaN values in the sum. This fix treats NaN values like zeros in the summation. NaNs are returned in the appropriate pixels when dividing by the total weight because total_weight is zero where both maps have NaN intensities.
Closes: #2838