imap_processing.swapi.l1.swapi_l1.process_sweep_data#

imap_processing.swapi.l1.swapi_l1.process_sweep_data(full_sweep_sci: Dataset, cem_prefix: str) Dataset#

Group full sweep data into correct sequence order.

Data from each packet comes like this:

SEQ_NUMBER
.
PCEM_RNG_ST0
SCEM_RNG_ST0
COIN_RNG_ST0
PCEM_RNG_ST1
SCEM_RNG_ST1
COIN_RNG_ST1
PCEM_RNG_ST2
SCEM_RNG_ST2
COIN_RNG_ST2
PCEM_RNG_ST3
SCEM_RNG_ST3
COIN_RNG_ST3
PCEM_RNG_ST4
SCEM_RNG_ST4
COIN_RNG_ST4
PCEM_RNG_ST5
SCEM_RNG_ST5
COIN_RNG_ST5
PCEM_CNT0
SCEM_CNT0
COIN_CNT0
PCEM_CNT1
SCEM_CNT1
COIN_CNT1
PCEM_CNT2
SCEM_CNT2
COIN_CNT2
PCEM_CNT3
SCEM_CNT3
COIN_CNT3
PCEM_CNT4
SCEM_CNT4
COIN_CNT4
PCEM_CNT5
SCEM_CNT5
COIN_CNT5

When we read all packets and store data for above fields, it looks like this:

SEQ_NUMBER -> [0, 1, 2, 3, 4,…, 11, 1, 2, ……, 9, 10, 11]
PCEM_RNG_ST0 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
SCEM_RNG_ST0 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
COIN_RNG_ST0 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
PCEM_RNG_ST1 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
SCEM_RNG_ST1 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
COIN_RNG_ST1 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
….
PCEM_RNG_ST5 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
SCEM_RNG_ST5 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
PCEM_CNT_0 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
SCEM_CNT_0 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
COIN_CNT_0 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
….
PCEM_CNT_5 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
SCEM_CNT_5 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]
COIN_CNT_5 -> [x, x, x, x, x,…, x, x, x, …, x, x, x]

This function reads each sweep data in this order:

PCEM_CNT0 –> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
PCEM_CNT1 –> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
PCEM_CNT2 –> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
PCEM_CNT3 –> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
PCEM_CNT4 –> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
PCEM_CNT5 –> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

This example show for PCEM_CNT but same logic applies to SCEM_CNT, COIN_CNT, PCEM_RNG, SCEM_RNG, and COIN_RNG.

In the final L1A product of (total_number_of_sweep x 72) array where we store final PCEM, SCEM, COIN counts or compression indicator such as PCEM_RNG, SCEM_RNG, COIN_RNG, we want data in this order. Transpose of above layout

0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3,
….,
11, 11, 11, 11, 11, 11.

Reordering in this order is reordering all data of sequence 0 first, then sequence 1, then sequence 2, and so on until sequence 11.

Parameters:
  • full_sweep_sci (xarray.Dataset) – Full dataset.

  • cem_prefix (str) –

    Indicate which CEM or its flag we are processing. Options are:

    PCEM_CNT
    SCEM_CNT
    COIN_CNT
    PCEM_RNG_ST
    SCEM_RNG_ST
    COIN_RNG_ST.

Returns:

all_cem_data – Correctly order dataset.

Return type:

xarray.Dataset