imap_processing.codice.codice_l1a.create_direct_event_dataset#

imap_processing.codice.codice_l1a.create_direct_event_dataset(apid: int, unpacked_dataset: Dataset) Dataset#

Create dataset for direct event data.

For direct event data, the raw data from the spacecraft is organized first by epoch, then by priority, then by events. For example, for a CoDICE-Lo dataset with 10 epochs, we expect the length of the event_data field to be (10 epochs * 8 priorities) = 80 items, with each item being a compressed byte object representing a variable number of events (up to 10000 events). Each compressed byte object is comprised of several fields with specific bit lengths/positions, described by the constants.[LO|HI]_DE_BIT_STRUCTURE dictionary. Padding is added to any fields that have less than 10000 events.

In order to process these data, we must take the decommed raw data, group the unpacked_dataset appropriately based on their seq_flgs, decompress the data, then arrange the data into CDF data variables for each priority and bit field. For example, P2_SpinAngle represents the spin angles for the 2nd priority data.

Parameters:
  • apid (int) – The APID of the packet.

  • unpacked_dataset (xarray.Dataset) – The unpacked dataset to process.

Returns:

dataset – Xarray dataset containing the direct event data.

Return type:

xarray.Dataset