Skip to content

GLOWS L2 night flags#2930

Open
laspsandoval wants to merge 2 commits intoIMAP-Science-Operations-Center:devfrom
laspsandoval:glows_updates
Open

GLOWS L2 night flags#2930
laspsandoval wants to merge 2 commits intoIMAP-Science-Operations-Center:devfrom
laspsandoval:glows_updates

Conversation

@laspsandoval
Copy link
Copy Markdown
Contributor

This pull request introduces logic to adjust the "is_night" flag in the GLows L2 processing pipeline, allowing sunrise and sunset offsets to be applied when determining valid (good) data blocks. This change ensures that the night region can be flexibly extended or shortened around sunrise and sunset transitions, as specified in the algorithm documentation. Comprehensive tests are also added to validate the new offset functionality.

Night flag offset logic:

  • Added a new static method apply_is_night_offsets to HistogramL2 that adjusts the is_night flag in the flags array based on configurable sunrise_offset and sunset_offset parameters, allowing for flexible extension or shortening of the night region at both transitions.
  • Integrated the new offset logic into the L2 processing pipeline by applying offsets before selecting good data blocks, ensuring the selection honors the adjusted night/day boundaries.

Testing enhancements:

  • Added a parameterized test test_apply_is_night_offsets that verifies the offset logic for various combinations of sunrise and sunset offsets, ensuring the is_night flag is correctly adjusted in all cases.
  • Updated the test fixture l1b_dataset_full and related comments to clarify that all flags are good and both epochs are daytime, aligning with the new logic and improving test clarity. [1] [2] [3]

@laspsandoval laspsandoval requested a review from maxinelasp April 7, 2026 20:34
@laspsandoval laspsandoval self-assigned this Apr 7, 2026
@laspsandoval laspsandoval added this to IMAP Apr 7, 2026
@laspsandoval laspsandoval added the Ins: GLOWS Related to the GLOWS instrument label Apr 7, 2026
Comment thread imap_processing/glows/l2/glows_l2_data.py Outdated
Comment thread imap_processing/glows/l2/glows_l2_data.py Outdated
Comment thread imap_processing/tests/glows/test_glows_l2_data.py
Copy link
Copy Markdown
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 job on this!

Comment thread imap_processing/glows/l2/glows_l2_data.py Outdated
Algorithm doc v4.4.7, Sec. 3.9.1, item 2
is_night: 1 = daytime (good), 0 = night (bad)
"""
flags_with_offsets = flags.copy()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not sure how big this array is but copy will have memory implications. If you can avoid it without creating ugly side effects to the parent data set, consider modifying it in place.

Comment thread imap_processing/glows/l2/glows_l2_data.py Outdated
Comment thread imap_processing/glows/l2/glows_l2_data.py Outdated
Comment thread imap_processing/glows/l2/glows_l2_data.py Outdated
Comment thread imap_processing/tests/glows/test_glows_l2_data.py
@laspsandoval laspsandoval force-pushed the glows_updates branch 2 times, most recently from 737b248 to 6508b63 Compare April 15, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ins: GLOWS Related to the GLOWS instrument

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

ENH - GLOWS L2 Apply sunrise/sunset offsets to is_night flag transitions

3 participants