CoDICE l2 sw species metadata update - #3378
Conversation
There was a problem hiding this comment.
Pull request overview
Updates CoDICE LO L2 species product metadata so spectrograms use physical energy-per-charge (keV/e) on the y-axis by switching DEPEND_1/label pointers from esa_step to energy_per_charge, and introduces L1b variable-attribute YAML support for the new coordinate/label variables.
Changes:
- Add a dedicated CoDICE L1b variable-attributes YAML defining
energy_per_chargeandenergy_per_charge_label. - Update L2 LO species variable attributes to depend on
energy_per_charge(and point labels toenergy_per_charge_label) instead of ESA step indices. - Update CoDICE L1b processing to load L1b variable attrs and to create
energy_per_charge/energy_per_charge_labelusing those attrs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| imap_processing/codice/codice_l1b.py | Loads L1b variable attrs and uses them to create energy_per_charge and a new energy_per_charge_label support variable. |
| imap_processing/cdf/config/imap_codice_l2-lo-species_variable_attrs.yaml | Switches species products’ DEPEND_1/LABL_PTR_1 from esa_step(_label) to energy_per_charge(_label). |
| imap_processing/cdf/config/imap_codice_l1b_variable_attrs.yaml | New YAML file defining variable attributes for energy_per_charge and energy_per_charge_label. |
Suppressed comments (1)
imap_processing/codice/codice_l1b.py:58
- If
cdf_attrsis made optional (or any call path forgets to pass it), this block will raise when callingcdf_attrs.get_variable_attributes(...). Provide a fallback attribute dict whencdf_attrsisNoneso LO processing continues to work in callers that don’t use the CDF attribute manager.
if descriptor.startswith("lo-"):
# Calculate energy_per_charge using voltage_table and k_factor
# 1e3 is to convert eV to keV
energy_per_charge = (
dataset["voltage_table"].values * dataset["k_factor"].values * 1e-3
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
I approve. |
|
I am going to ping @jtniehof and @pleasant-menlo for impact on L3 pipeline. Appreciate their review! |
tech3371
left a comment
There was a problem hiding this comment.
The changes looks good. Thank you for doing this! I tagged L3 reviewer since our recent L2 will have more impact in L3 pipeline now.
| if cdf_attrs is not None | ||
| else {}, |
There was a problem hiding this comment.
so this is handler for I-ALiRT use case? If so, can you add note about that? I am afraid that we will loose this context in the future.
Same comment for below if check.
| # Get the L1b CDF attributes | ||
| cdf_attrs = ImapCdfAttributes() | ||
| cdf_attrs.add_instrument_global_attrs("codice") | ||
| cdf_attrs.add_instrument_variable_attrs("codice", "l1b") |
There was a problem hiding this comment.
I see. I didn't realize we are not using l1b attrs. Nice addition!
Change Summary
closes #3353
Overview
Update lo l2 species products to use energy_per_charge variable as the depend 1 variable. This required also creating energy_per_charge_label. I thought it then made sense to put these into a dedicated l1b yaml file.
File changes