Skip to content

Commit 852deea

Browse files
authored
Simplified CoDICE I-ALiRT code to just use one module instead of splitting it up between codice-lo and codice-hi (#1830)
1 parent 446ff28 commit 852deea

File tree

5 files changed

+62
-324
lines changed

5 files changed

+62
-324
lines changed

imap_processing/ialirt/l0/process_codicelo.py renamed to imap_processing/ialirt/l0/process_codice.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Functions to support I-ALiRT CoDICE Lo processing."""
1+
"""Functions to support I-ALiRT CoDICE processing."""
22

33
import logging
44

@@ -9,7 +9,7 @@
99
logger = logging.getLogger(__name__)
1010

1111

12-
def process_codicelo(dataset: xr.Dataset) -> list[dict]:
12+
def process_codice(dataset: xr.Dataset) -> list[dict]:
1313
"""
1414
Create final data products.
1515
@@ -20,7 +20,7 @@ def process_codicelo(dataset: xr.Dataset) -> list[dict]:
2020
2121
Returns
2222
-------
23-
codicelo_data : list[dict]
23+
codice_data : list[dict]
2424
Dictionary of final data product.
2525
2626
Notes
@@ -32,10 +32,14 @@ def process_codicelo(dataset: xr.Dataset) -> list[dict]:
3232
- Calculate the public data products
3333
"""
3434
apid = dataset.pkt_apid.data[0]
35-
codicelo_data = create_ialirt_dataset(apid, dataset)
35+
codice_data = create_ialirt_dataset(apid, dataset)
3636

3737
# TODO: calculate rates
38+
# This will be done in codice.codice_l1b
39+
3840
# TODO: calculate L2 CoDICE pseudodensities
41+
# This will be done in codice.codice_l2
42+
3943
# TODO: calculate the public data products
4044

41-
return codicelo_data
45+
return codice_data

imap_processing/ialirt/l0/process_codicehi.py

Lines changed: 0 additions & 156 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""Tests for the ``process_codice`` module.
2+
3+
See tests.codice.test_codice_l1a for more unit tests related to this code.
4+
"""
5+
6+
from pathlib import Path
7+
8+
import pytest
9+
import xarray as xr
10+
11+
from imap_processing import imap_module_directory
12+
from imap_processing.codice.codice_l0 import decom_packets
13+
from imap_processing.ialirt.l0.process_codice import process_codice
14+
15+
pytestmark = pytest.mark.external_test_data
16+
17+
18+
@pytest.fixture(scope="session")
19+
def l0_test_file():
20+
return Path(
21+
imap_module_directory
22+
/ "tests"
23+
/ "codice"
24+
/ "data"
25+
/ "imap_codice_l0_raw_20241110_v001.pkts"
26+
)
27+
28+
29+
@pytest.fixture(scope="session")
30+
def test_datasets(l0_test_file):
31+
return decom_packets(l0_test_file)
32+
33+
34+
@pytest.fixture
35+
def codice_test_data(apid, test_datasets):
36+
return test_datasets[apid]
37+
38+
39+
@pytest.mark.parametrize(
40+
"apid", [1152, 1168]
41+
) # APIDs correspond to COD_LO_IAL and CO_HI_IAL
42+
def test_process_codice(apid, codice_test_data, caplog):
43+
"""Ensure that the ``process_codice`` function creates a dataset
44+
45+
Here we just need to make sure the function is returning the expected data.
46+
CoDICE I-ALiRT data products are being validated separately in the
47+
``codice.test_codice_l[1a|1b|2]`` modules.
48+
"""
49+
50+
with caplog.at_level("WARNING"):
51+
dataset = process_codice(codice_test_data)
52+
53+
assert isinstance(dataset, xr.Dataset)

imap_processing/tests/ialirt/unit/test_process_codicehi.py

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)