Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Decom example using SWE packet #7

Closed
wants to merge 2 commits into from
Closed

Decom example using SWE packet #7

wants to merge 2 commits into from

Conversation

tech3371
Copy link
Contributor

Change Summary

Overview

Creating an example of how to unpacket CCSDS packet( aka L0 data) using Space Packet Parser and XTCE. Used SWE sample data and packet definition to demonstrate it.

New Dependencies

None

New Files

  • Docker-compose.yml
    • Better way to build, run, and manage docker image.
    • In the file, there is one service defined. We can add more service as needed.
    • imap_processing_dev could be used as local development environment. It ensures everyone has same development environment. Please read README.docker.md for more information and benefits.
  • Dockerfile
    • This was taken from our other repo and added comments and space packet parser library. Although, most of libraries in the Dockerfile are not used right now, I left it because we will need to add those library later when we need to develop CDK code.
  • README.docker.md
    • Documentation on how to use docker for local development.
  • swe_decom.py
    • Initial code to unpack SWE's sample data packet using SWE's packet definition.
  • swe_packet_definition.xml
    • XTCE definiton to unpack SWE's CCSDS packet.

Deleted Files

  • None

Updated Files

None

Testing

None

@tech3371 tech3371 changed the base branch from main to dev June 16, 2023 15:20
Copy link
Collaborator

@greglucas greglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should try and clarify how we want this to work in practice. Because I see this is actually 2 separate items in the PR?

  1. The packet parsing example for SWE
  2. The Docker setup

For (1) I think we should make this a pip installable package, and start adding the dependencies rather than requiring the dockerfile (i.e. I don't like developing in a docker container locally if I don't have to)

For (2) I don't think this repository should be dependent on CDK, but it looks like there is a lot of AWS extras in there. I think we should look at slimming that image down or starting from a different base layer image. Possibly creating our own base image with a few requirements that we will then deploy later.

All that being said, I think (1) making it a pip installable package will solve a lot of the development issues.

@@ -0,0 +1,20 @@
from pathlib import Path
from space_packet_parser import xtcedef, parser
import bitstring
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import bitstring

Comment on lines +5 to +7
packet_file = Path('science_block_20221116_163611Z_idle.bin')
with packet_file.open(mode='rb') as fh:
binary_data = bitstring.ConstBitStream(fh)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can ignore bitstring details according to the space_packet_parser docs: https://space-packet-parser.readthedocs.io/en/latest/users.html#examples

Suggested change
packet_file = Path('science_block_20221116_163611Z_idle.bin')
with packet_file.open(mode='rb') as fh:
binary_data = bitstring.ConstBitStream(fh)
packet_file = Path('science_block_20221116_163611Z_idle.bin')
with packet_file.open(mode='rb') as binary_data:
packet_generator = my_parser.generator(binary_data)
with packet_file.open() as binary_data:
    packet_generator = my_parser.generator(binary_data)

    for packet in packet_generator:
        # Do something with the packet data
        print(packet.header['PKT_APID'])
        print(packet.data)


for packet in packet_generator:
# Do something with the packet data
print(packet.header)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding, would the next step here be to put each field into a CDF?

Copy link
Contributor Author

@tech3371 tech3371 Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @sdhoyt . This PR has moved to IMAP-Science-Operations-Center/imap_processing#1.

But to answer your questions. That's my understanding too. I envision we unpack data using packet parser. In that step we don't do any modification to data. We just unpack data.

Then we perform additional changes as needed for each instrument. Some like to leave data as it is, some like to decompress data and format it to their requirements, and some may just dump data based on flags. And write it into a CDF.

@tech3371
Copy link
Contributor Author

This PR has moved to IMAP-Science-Operations-Center/imap_processing#1

@tech3371 tech3371 closed this Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants