Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWE packet decom example #1

Merged
merged 8 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
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):
tech3371 marked this conversation as resolved.
Show resolved Hide resolved
"""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)
my_parser = parser.PacketParser(packet_definition)

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