Skip to content

Hi L1C: look up geometric factor by gain state via extended cal-prod schema #3395

Description

@tmplummer

Part of #3391. Depends on #3394 for the gain_match_{field} L1B DE global attributes.

Summary

Replace the separate gain-configuration ancillary file and config_id classification (added in #3358) with a gain-state-dependent geometric factor lookup folded directly into the existing imap_hi_{sensor}-cal-prod_*.csv file, keyed on measured detector voltage differences (front/back) and the U-Can voltage, per Paul Janzen's feedback referenced in #3391.

Changes

  • hi/utils.py: extend CalibrationProductConfig with a new leading gain_config_id index level, GAIN_MATCH_FIELDS, gain_match_columns (forward-filled per gain_config_id group, placed as the final columns of the file), an extended _validate(), and match_gain_config_id().
  • Ancillary CSVs (production imap_hi_45sensor-cal-prod_*.csv and the test fixture): add the gain_config_id index column and mcp_delta_v/cem_a_delta_v/cem_b_delta_v/tof_v (+ _tol) columns. Deltas are computed as back-voltage minus front-voltage (positive), matching real flight detector voltages.
  • hi_l1c.py: rewrite pset_geometric_factor() to match the L1B DE product's gain_match_{field} attributes against CalibrationProductConfig.match_gain_config_id(), and record the geometric factor per (esa_energy_step, calibration_prod) pair — the PSET geometric_factor variable gains a calibration_prod dimension instead of summing across calibration products. Fix pset_counts()'s config_row.Index positional lookup, which shifts because of the new leading index level.
  • hi_l2.py: select a single gain_config_id before the CalibrationProductConfig DataFrame is converted to xarray and reindexed against the map dataset (also a consequence of the new index level).
  • cli.py: drop gain-configuration from the L1C PSET ancillary dependencies (2 required instead of 3).
  • imap_hi_variable_attrs.yaml: add DEPEND_2/LABL_PTR_2 (calibration_prod) to hi_pset_geometric_factor.
  • Update/add tests in test_hi_l1c.py, test_hi_l2.py, remaining parts of test_utils.py/test_cli.py.

Out of scope

Combining PSETs from different gain states into a single L2 map remains a follow-on (not addressed here).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ins: HiRelated to the IMAP-Hi instrumentLevel: L1Level 1 processing

    Type

    No type

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions