Skip to content

Commit

Permalink
PR updates, naming changes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxinelasp committed Feb 23, 2024
1 parent 1cf4ce9 commit c4688ea
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions imap_processing/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

import imap_processing

__logger__ = logging.getLogger(__name__)

# TODO: change how we import things and also folder
# structure may?
# From this:
Expand All @@ -38,6 +36,8 @@
from imap_processing.swe.l1a.swe_l1a import swe_l1a
from imap_processing.swe.l1b.swe_l1b import swe_l1b

logger = logging.getLogger(__name__)


def _parse_args():
"""Parse the command line arguments.
Expand Down
11 changes: 5 additions & 6 deletions imap_processing/mag/l0/decom_mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,14 @@ def export_to_xarray(l0_data: list[MagL0]):
xarray dataset for generating burst data CDFs
"""
# TODO split by mago and magi using primary sensor
# TODO split by norm and burst
norm_data = []
burst_data = []

for datapoint in l0_data:
if datapoint.ccsds_header.PKT_APID == Mode.NORMAL:
norm_data.append(datapoint)
if datapoint.ccsds_header.PKT_APID == Mode.BURST:
burst_data.append(datapoint)
for packet in l0_data:
if packet.ccsds_header.PKT_APID == Mode.NORMAL:
norm_data.append(packet)
if packet.ccsds_header.PKT_APID == Mode.BURST:
burst_data.append(packet)

norm_dataset = None
burst_dataset = None
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/mag/l1a/mag_l1a.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from imap_processing.cdf.utils import write_cdf
from imap_processing.mag.l0 import decom_mag

__logger__ = logging.getLogger(__name__)
logger = logging.getLogger(__name__)


def mag_l1a(packet_filepath, output_filepath_norm, ouptput_filepath_burst):
Expand Down
7 changes: 4 additions & 3 deletions imap_processing/tests/mag/test_mag_decom.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def test_mag_raw_xarray():
assert all([item is not None for _, item in burst_data.attrs.items()])

expected_norm_len = 17
print(norm_data.dims["Epoch"])
assert norm_data.dims["Epoch"] == expected_norm_len

expected_burst_len = 19
Expand All @@ -69,16 +68,18 @@ def test_mag_raw_cdf_generation(tmp_path):

test_data_path_norm = tmp_path / "mag_l1a_raw-normal_20210101_20210102_v01-01.cdf"

assert not test_data_path_norm.exists()
output = write_cdf(norm_data, test_data_path_norm)
assert Path.exists(test_data_path_norm)
assert test_data_path_norm.exists()

input_xarray = cdf_to_xarray(output)
assert input_xarray.attrs.keys() == norm_data.attrs.keys()

test_data_path_burst = tmp_path / "mag_l1a_raw-burst_20210101_20210102_v01-01.cdf"

assert not test_data_path_burst.exists()
output = write_cdf(burst_data, test_data_path_burst)
assert Path.exists(test_data_path_burst)
assert test_data_path_burst.exists()

input_xarray = cdf_to_xarray(output)
assert input_xarray.attrs.keys() == burst_data.attrs.keys()

0 comments on commit c4688ea

Please sign in to comment.