Glows l2 spin angle#2852
Merged
maxinelasp merged 5 commits intoIMAP-Science-Operations-Center:devfrom Mar 24, 2026
Merged
Conversation
vmartinez-cu
approved these changes
Mar 19, 2026
Collaborator
vmartinez-cu
left a comment
There was a problem hiding this comment.
Nice job! Some of this will be helpful for the ticket I'm working on
subagonsouth
approved these changes
Mar 23, 2026
Contributor
subagonsouth
left a comment
There was a problem hiding this comment.
A couple of suggestions, but looks good to me.
0fce0fb
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.
Overview
Implements spin angle and position angle offset calculations in the GLOWS L2 histogram processing pipeline. The IMAP spin angle (ψ) stored at L1B is converted to the GLOWS position angle (ψPA, Eq. 29 of the algorithm document), which measures rotation from the northernmost point of the GLOWS scanning circle. All bin-dimensioned lightcurve arrays are rolled so that bin 0 corresponds to the northernmost point.
This also includes some fixes for bin number management.
File changes
glows/l2/glows_l2_data.py: Adds compute_position_angle() to HistogramL2, which implements Eq. 30 (ψG,eff = (360 − ψGLOWS) % 360) using the GLOWS boresight azimuth from the SPICE frames kernel. Updates DailyLightcurve to accept position_angle as an InitVar, apply the ψ → ψPA conversion (Eq. 29), and roll all bin arrays to north-first order. Corrects position_angle_offset_average and position_angle_offset_std_dev to scalar values (one per L2 file, not per L1B block), consistent with the algorithm document's statement that std_dev is always zero and the offset is a fixed instrument property.
glows/l2/glows_l2.py: Minor fixes carried in from prior work — uses GlowsConstants.STANDARD_BIN_COUNT for the bins coordinate and pads bin arrays to standard length with CDF FILLVALs before writing to the output dataset.
Some comments and unit tests were updated with Claude. The unit tests were generated against the validation code provided by GLOWS.
Testing
3 new unit tests added for spin angle and position angle behavior: test_spin_angle_offset_formula, test_spin_angle_starts_at_minimum, and test_compute_position_angle. 1 existing test (test_position_angle_offset_average) updated to reflect the corrected scalar type. Other tests updated to fix SPICE issues.
Completes #2720 and #2719