Repository navigation
Adding HIT l1b Science CDF Attributes - #3484
daralynnrhode merged 11 commits into
Conversation
lacoak21
left a comment
There was a problem hiding this comment.
Excellent jon!! I had a few minor comments about attribute structure. Wow there were a lot more than I thought 😆
@bryan-harter since these are not l2 attrs and dont need to be fully ISTP compliant can Daralynn skip sending them to Andriy for review or should she do that anyway?
Yup, we don't need to send them to Andriy if they are below L2 |
Per @lacoak21's review: - Add a `double_fillval` anchor for the repeated -1e+31 FILLVAL instead of writing the literal on every variable. - Add a `default_rate_attrs` anchor (FILLVAL, FORMAT, SCALEMAX, SCALEMIN, SCALETYP, UNITS, VALIDMAX, VALIDMIN, VAR_TYPE) for the Standard Rates block, merged into each of the 12 rate variables and their 24 plus/minus uncertainty variables via `<<:`. - Give each standard-rate variable's LABLAXIS the rate name (e.g. "sngrates Count Rate" instead of the generic, repeated "Count Rate"), per Andriy's preference for these to be unique. - Add `default_energy_attrs`/`default_energy_delta_attrs` anchors for the same kind of repetition across the 17 *_energy_mean coordinates and 18 *_energy_delta_plus/minus variables. This also fixes he_energy_mean's SCALETYP, which was blank in the spreadsheet (a gap, like the missing he_energy_delta rows already called out in a NOTE comment) and so was previously emitted with no SCALETYP key at all -- every other energy variable uses "log" and there's no reason "he" should differ, so it's now filled in correctly via the shared default. No variable's resolved attribute values changed other than the two fixes above (unique LABLAXIS, he_energy_mean's SCALETYP) -- verified by loading old and new YAML with PyYAML and diffing every variable's fully-resolved (anchors expanded) attribute dict. Verified: `pytest imap_processing/tests/cdf/ imap_processing/tests/hit/` (86 passed). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYCHuh2ycXurU83FKN6pLf
There was a problem hiding this comment.
🟡 Changes recommended
Several attributes have incorrect dependencies, data types, descriptions, or product semantics, and the new metadata path lacks validation coverage.
11 open findings
Remove incompatible int8 pseudo-attribute · New Add product-specific metadata for sectored attributes · New Fix he dependency on he_energy_mean · New Fix uncertainty dependency on he_energy_mean · New Fix uncertainty dependency on he_energy_mean · New Correct energy coordinate mean descriptions or calculations · New Add DELTA pointers to he_energy_mean · New Correct mislabeled minus uncertainty · New Add metadata and strict CDF validation coverage · New Correct misspelled published description · New Mark optional parameter type entry · New
What changed in this PR
Adds CDF metadata to HIT L1B science products and applies it during dataset construction.
Changes:
- Defines standard, summed, and sectored rate attributes.
- Applies attributes to science variables and summed-rate energy coordinates.
- Extends HIT helpers to accept an optional attribute manager.
| File | Description |
|---|---|
imap_processing/hit/l1b/hit_l1b.py |
Integrates attributes into L1B processing. |
imap_processing/hit/hit_utils.py |
Adds attribute support for generated energy coordinates. |
imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml |
Defines HIT L1B science metadata. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # <=== Summed & Sectored Rates - Particle Variable Attributes | ||
| # Rate/uncertainty variables are shared by both products under the same | ||
| # bare name; see the comment above emit_particle_sheet() in the | ||
| # generator for why (and note DEPEND_2/DEPEND_3 are intentionally | ||
| # omitted for those shared variables). ===> |
…entry' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Okay, after fixing the suggestions there are 3 things that still need to be addressed:
The new test t
|
OK thanks for this summary
then in the code, when grabbing the attrs we can tack on summed or sectored. Is that easy to do?
3.Ah good catch. Each variable needs to have a unique axis label. |
|
OK yeah from what I could find from the latest hit alg document it says geometric mean. |
lacoak21
left a comment
There was a problem hiding this comment.
After you fix number 1 and 2 in the last comment its good to go!
|
energy_mean issue #3562 |
65c64f5
into
IMAP-Science-Operations-Center:dev



Added the L1b Science Attributes for HIT
Overview
Adds complete, ISTP-compliant CDF variable attributes for HIT L1B science data products (standard-rates, summed-rates, sectored-rates). Previously only housekeeping attributes existed in
imap_hit_l1b_variable_attrs.yaml; science variables had no CDF metadata at all.All attribute values are sourced directly from the HIT CDF Product Definitions spreadsheet .
The spreadsheet has no row for
he_energy_delta_plus/he_energy_delta_minus(every other summed-rates particle has one). Flagged with a comment in the YAML; Will need to be confirmed/corrected.closes #3070
File changes
imap_processing/cdf/config/imap_hit_l1b_variable_attrs.yaml— full science attribute section added/rebuilt from the spreadsheet, replacing the placeholder/HK-only content. Includesdynamic_threshold_state, all standard-rates rate/uncertainty variables, and all summed/sectored-rates particle rate/uncertainty/energy-coordinate variables.imap_processing/hit/l1b/hit_l1b.py— wires the attribute dictionary into.attrsfor every L1B science dataset (process_science_data()), for all data vars and forepoch.imap_processing/hit/hit_utils.py—add_energy_variables()andadd_summed_particle_data_to_dataset()now accept an optionalattr_mgrso the per-particle energy coordinates created fresh during summed-rates processing (which the shared attrs loop can't reach, since it only iteratesdata_vars, notcoords) get real CDF attributes instead of none. Kept optional so L1A's existing call site (which sets attrs separately, later) isn't broken.Testing
NA