forked from IMAP-Science-Operations-Center/imap_processing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request IMAP-Science-Operations-Center#1 from IMAP-Science…
…-Operations-Center/swe_decom SWE packet decom example
- Loading branch information
Showing
6 changed files
with
659 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.