Skip to content

Commit

Permalink
Merge pull request #1 from IMAP-Science-Operations-Center/swe_decom
Browse files Browse the repository at this point in the history
SWE packet decom example
  • Loading branch information
tech3371 committed Jun 21, 2023
2 parents 7a96c39 + c76fd8e commit 5ce6b49
Show file tree
Hide file tree
Showing 6 changed files with 659 additions and 216 deletions.
25 changes: 25 additions & 0 deletions imap_processing/decom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from space_packet_parser import parser, xtcedef


def decom_packets(packet_file: str, xtce_packet_definition: str):
"""Unpack CCSDS data packet. In this function, we unpack and return data
as it is. Data modification will not be done at this step.
Parameters
----------
packet_file : str
Path to data packet path with filename
xtce_packet_definition : str
Path to XTCE file with filename
Returns
-------
List
List of all the unpacked data
"""
packet_definition = xtcedef.XtcePacketDefinition(xtce_packet_definition)
packet_parser = parser.PacketParser(packet_definition)

with open(packet_file, "rb") as binary_data:
packet_generator = packet_parser.generator(binary_data)
return list(packet_generator)
Loading

0 comments on commit 5ce6b49

Please sign in to comment.