Skip to content

Conversation

@lacoak21
Copy link
Contributor

Change Summary

Overview

We should NOT be using the HALF_SPIN_LUT from the constants file. We should be getting those values from the sci lut. Joey requested that these be written to l1a products that use them in l2.

Updated Files

  • imap_processing/codice/codice_l1a_lo_angular.py and imap_processing/codice/codice_l1a_lo_species.py
    • Write half_spin_per_esa step to CDF because those products at l2 will use that variable to compute intensities.
  • imap_processing/codice/codice_l2.py
    • Update geometric calc function to use half spin values from the dataset carried through
  • imap_processing/codice/constants.py
    • remove LUT from constants file. Those should NEVER be hardcoded.

Testing

Ensure geometric factor calculations are using the half spin values from the given dataset.

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

This PR removes the hardcoded HALF_SPIN_LUT from the constants file and replaces it with a dynamic approach where half_spin_per_esa_step values are retrieved from the science lookup table (LUT) and saved in L1A products. These values are then used in L2 processing for geometric factor calculations.

Changes:

  • Added half_spin_per_esa_step variable to L1A angular and species products, sourced from lo_stepping_tab["row_number"] in the science LUT
  • Updated L2 compute_geometric_factors to use half_spin_per_esa_step from the dataset instead of the hardcoded HALF_SPIN_LUT
  • Removed hardcoded HALF_SPIN_LUT dictionary from constants.py

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
imap_processing/codice/constants.py Removed hardcoded HALF_SPIN_LUT dictionary
imap_processing/codice/codice_l1a_lo_angular.py Added half_spin_per_esa_step coordinate from science LUT
imap_processing/codice/codice_l1a_lo_species.py Added half_spin_per_esa_step coordinate from science LUT
imap_processing/codice/codice_l2.py Updated compute_geometric_factors to use half_spin_per_esa_step from dataset; removed HALF_SPIN_LUT import
imap_processing/tests/codice/test_codice_l2.py Updated tests to use new fixture and add half_spin_per_esa_step to test datasets
imap_processing/cdf/config/imap_codice_l1a_variable_attrs.yaml Added CDF metadata for half_spin_per_esa_step variable
Comments suppressed due to low confidence (1)

imap_processing/tests/codice/test_codice_l2.py:150

  • The comment incorrectly describes the logic. For ESA steps 0-63 with half_spin=1, the comparison should be 1 > 1 (False) → full mode → 0. For ESA steps 64-127 with half_spin=2, the comparison should be 2 > 1 (True) → reduced mode → 1. The expected values in the test are correct, but the comment has the comparisons and results swapped.
    # ESA steps 0-63 (half_spin=1) -> 2 > 1 → mode=full → 1
    # ESA steps 64-127 (half_spin=2) -> 1 !>1 → mode=reduced → 0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@tech3371 tech3371 left a comment

Choose a reason for hiding this comment

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

This changes looks good.

@tech3371
Copy link
Contributor

I am going to merge this PR to be able to use this change in our codice_prod branch validation. Thank you for getting this in quick!

@tech3371 tech3371 merged commit 69a05dd into IMAP-Science-Operations-Center:dev Jan 15, 2026
14 checks passed
@github-project-automation github-project-automation bot moved this to Done in IMAP Jan 15, 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.

2 participants