Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions imap_processing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,6 @@
logger = logging.getLogger(__name__)


def sort_by_time(packets: list, time_key: str) -> list:
"""
Sort packets by specified key.

Parameters
----------
packets : list
Decom data packets.
time_key : str
Key to sort by. Must be a key in the packets data dictionary.
e.g. "SHCOARSE" or "MET_TIME" or "ACQ_START_COARSE".

Returns
-------
sorted_packets : list
Sorted packets.
"""
sorted_packets = sorted(packets, key=lambda x: x[time_key])
return sorted_packets


def group_by_apid(packets: list) -> dict:
"""
Group data by apid.

Parameters
----------
packets : list
Packet list.

Returns
-------
grouped_packets : dict
Grouped data by apid.
"""
grouped_packets: dict[list] = collections.defaultdict(list)
for packet in packets:
apid = packet["PKT_APID"]
grouped_packets.setdefault(apid, []).append(packet)
return grouped_packets


def convert_raw_to_eu(
dataset: xr.Dataset,
conversion_table_path: str,
Expand Down