Skip to content

Commit 7d82163

Browse files
authored
remove error handling test and TODO. Greg fixed the issue (IMAP-Science-Operations-Center#2678)
1 parent 521b05c commit 7d82163

2 files changed

Lines changed: 4 additions & 45 deletions

File tree

imap_processing/tests/ultra/unit/test_ultra_l1a.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""Test ULTRA L1a CDFs."""
22

3-
import logging
4-
from unittest import mock
5-
63
import numpy as np
74
import pytest
85
import xarray as xr
@@ -522,33 +519,3 @@ def test_get_event_id():
522519
counters_for_met.append(event_id & np.int64(0x7FFFFFFF))
523520

524521
assert counters_for_met == [0, 0, 0, 1]
525-
526-
527-
def test_tof_decompression_error_handling(ccsds_path_tof_high_angular, caplog):
528-
"""Test that ultra_l1a handles TOF decom errors gracefully."""
529-
530-
caplog.set_level(logging.ERROR)
531-
532-
# Create side effect function to simulate IndexError
533-
def mock_process_ultra_tof(*args):
534-
raise IndexError(
535-
"Attempted to read past the end of binary string. "
536-
"Current position: 32648, Requested bits: 4, String length: 32648"
537-
)
538-
539-
# Use monkeypatch to replace process_ultra_tof
540-
with mock.patch(
541-
"imap_processing.ultra.l1a.ultra_l1a.process_ultra_tof"
542-
) as mocked_tof:
543-
mocked_tof.side_effect = mock_process_ultra_tof
544-
545-
# Should NOT raise an exception - should catch and log
546-
result = ultra_l1a(
547-
ccsds_path_tof_high_angular, apid_input=ULTRA_PHXTOF_HIGH_ANGULAR.apid[0]
548-
)
549-
550-
# Test that the result is still returned
551-
assert isinstance(result, list)
552-
553-
# Verify error was logged
554-
assert "Error processing TOF data" in caplog.text

imap_processing/ultra/l1a/ultra_l1a.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,10 @@ def ultra_l1a( # noqa: PLR0912
129129
gattr_key = ULTRA_AUX.logical_source[ULTRA_AUX.apid.index(apid)]
130130
elif apid in all_l1a_image_apids:
131131
packet_props = all_l1a_image_apids[apid]
132-
# TODO there is a known issue with the decom of some tof packets.
133-
# This is being tracked in issue #2557.
134-
try:
135-
decom_ultra_dataset = process_ultra_tof(
136-
datasets_by_apid[apid], packet_props
137-
)
138-
gattr_key = packet_props.logical_source[
139-
packet_props.apid.index(apid)
140-
]
141-
except IndexError as e:
142-
logger.error(f"Error processing TOF data for APID {apid}: {e}")
143-
continue
132+
decom_ultra_dataset = process_ultra_tof(
133+
datasets_by_apid[apid], packet_props
134+
)
135+
gattr_key = packet_props.logical_source[packet_props.apid.index(apid)]
144136
elif apid in ULTRA_RATES.apid:
145137
decom_ultra_dataset = process_ultra_rates(datasets_by_apid[apid])
146138
decom_ultra_dataset = decom_ultra_dataset.drop_vars("fastdata_00")

0 commit comments

Comments
 (0)