diff --git a/imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml b/imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml index 8765d2e6a..a95396315 100644 --- a/imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml +++ b/imap_processing/cdf/config/imap_idex_l1a_variable_attrs.yaml @@ -214,7 +214,7 @@ checksum: FIELDNAM: Checksum UNITS: " " -idx__sci0aid: +aid: <<: *trigger_base CATDESC: Accountability identifier for this event FIELDNAM: Accountability identifier diff --git a/imap_processing/idex/idex_l1a.py b/imap_processing/idex/idex_l1a.py index c3d735d46..518684d8d 100644 --- a/imap_processing/idex/idex_l1a.py +++ b/imap_processing/idex/idex_l1a.py @@ -651,8 +651,15 @@ def process(self) -> Dataset | None: # Gather the huge amount of metadata info trigger_vars = {} for var, value in self.telemetry_items.items(): - trigger_vars[var] = xr.DataArray( - name=var, + # SCI0AID is not updated properly. To this end, TXHDRFSWAIDCOPY must be + # used as the proper AID. + if var == "idx__sci0aid": + continue + # rename idx__txhdrfswaidcopy to aid for better readability in the final + # dataset + var_name = "aid" if var == "idx__txhdrfswaidcopy" else var + trigger_vars[var_name] = xr.DataArray( + name=var_name, data=[value], dims=("epoch"), attrs=idex_attrs.get_variable_attributes(var), diff --git a/imap_processing/idex/idex_l1b.py b/imap_processing/idex/idex_l1b.py index 5824d134a..c271af1f8 100644 --- a/imap_processing/idex/idex_l1b.py +++ b/imap_processing/idex/idex_l1b.py @@ -146,7 +146,7 @@ def idex_l1b(l1a_dataset: xr.Dataset) -> xr.Dataset: l1a_dataset["idx__txhdrtrigid"].data, idex_attrs ) # Create l1b Dataset - prefixes = ["shcoarse", "shfine", "time_high_sample", "time_low_sample"] + prefixes = ["shcoarse", "shfine", "time_high_sample", "time_low_sample", "aid"] data_vars = ( processed_vars | waveforms_converted diff --git a/imap_processing/tests/idex/test_idex_l0.py b/imap_processing/tests/idex/test_idex_l0.py index 736c0565d..ea4ebf12a 100644 --- a/imap_processing/tests/idex/test_idex_l0.py +++ b/imap_processing/tests/idex/test_idex_l0.py @@ -14,7 +14,7 @@ def test_idex_decom_length(decom_test_data_sci: xr.Dataset): decom_test_data_sci : xarray.Dataset The dataset to test with """ - assert len(decom_test_data_sci) == 110 + assert len(decom_test_data_sci) == 109 def test_idex_decom_event_num(decom_test_data_sci: xr.Dataset): diff --git a/imap_processing/tests/idex/test_idex_l1a.py b/imap_processing/tests/idex/test_idex_l1a.py index b80e960a6..2ef70be8e 100644 --- a/imap_processing/tests/idex/test_idex_l1a.py +++ b/imap_processing/tests/idex/test_idex_l1a.py @@ -156,6 +156,7 @@ def test_validate_l1a_idex_data_variables( "Ion Grid": "Ion_Grid", "Time (high sampling)": "time_high_sample_rate", "Time (low sampling)": "time_low_sample_rate", + "idx__txhdrfswaidcopy": "aid", } # The Engineering data is converting to UTC, and the SDC is converting to J2000, # for 'epoch' and 'Timestamp' so this test is using the raw time value 'SCHOARSE' to @@ -168,6 +169,8 @@ def test_validate_l1a_idex_data_variables( "event", "Time (high sampling)", "Time (low sampling)", + "IDX__SCI0AID", # This is dropped because it is invalid + "IDX__TXHDRFSWAIDCOPY", # this is renamed to aid ] # loop through all keys from the l1a example dict diff --git a/imap_processing/tests/idex/test_idex_l1b.py b/imap_processing/tests/idex/test_idex_l1b.py index f113b595a..2b95b28dc 100644 --- a/imap_processing/tests/idex/test_idex_l1b.py +++ b/imap_processing/tests/idex/test_idex_l1b.py @@ -325,6 +325,8 @@ def test_validate_l1b_idex_data_variables( "FIFODelay_M", "HSPosttriggerBlocks", ] + # assert that "aid" is in l1b + assert "aid" in l1b_dataset, "The array 'aid' is missing from the l1b dataset." # select only the first n events l1b_example_data = l1b_example_data.isel( event=np.arange(l1b_dataset.sizes["epoch"])