Skip to content

2838-bug---hi-l2---combined-maps-filled-with-nans#2839

Merged
subagonsouth merged 2 commits intoIMAP-Science-Operations-Center:devfrom
subagonsouth:2838-bug---hi-l2---combined-maps-filled-with-nans
Mar 12, 2026
Merged

2838-bug---hi-l2---combined-maps-filled-with-nans#2839
subagonsouth merged 2 commits intoIMAP-Science-Operations-Center:devfrom
subagonsouth:2838-bug---hi-l2---combined-maps-filled-with-nans

Conversation

@subagonsouth
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_maps to 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.

@subagonsouth subagonsouth changed the title 2838-bug---hi-l2---combined-maps-filled-with-nans?expand=1 2838-bug---hi-l2---combined-maps-filled-with-nans Mar 12, 2026
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"])
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of masking here. I haven't used logical_and before. This is super useful!

Copy link
Collaborator

@vmartinez-cu vmartinez-cu left a comment

Choose a reason for hiding this comment

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

Nice work!

@subagonsouth subagonsouth merged commit 52aa402 into IMAP-Science-Operations-Center:dev Mar 12, 2026
14 checks passed
@github-project-automation github-project-automation bot moved this to Done in IMAP Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

BUG - Hi L2 - combined maps filled with NaNs

3 participants