Skip to content

Commit

Permalink
Merge pull request IMAP-Science-Operations-Center#1 from IMAP-Science…
Browse files Browse the repository at this point in the history
…-Operations-Center/swe_decom

SWE packet decom example
  • Loading branch information
tech3371 authored Jun 21, 2023
2 parents fade92a + 04788e1 commit 54f5f05
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 54f5f05

Please sign in to comment.