About a year ago I wrote a small script that tries to find downlinked chunks of images in JPEG2000 format from a satellite called PAINANI-1. In August 2020 the first images were downloaded and also forwarded by a lot of contributors into SatNOGS-DB. A hint from a contributor of the original team around the satellite gave some hints on how images are downloaded from the satellite. If the satellite was commanded to make an image, the image itself and a, much lower in resolution, thumbnail is stored. The team then tries to download the thumbnail first to see if the shot went well or, at least, is promising.
First time I ran the script there were a few images found in SatNOGS-DB, showing some clouds and nice view of the earth. Additionally there were some super blurred images I couldn’t make a guess of what it is. A bunch of time passed…
A few days ago I decided to check SatNOGS-DB for new images taken by PAINANI-1 - and guess what? There are a few more. Again some clouds and really nice images of the earth, including one blurred image probably showing some mountains (see images below). Also the blurred images turn out to be images from a PCB component inside the cubesat, looking nearly like an X-ray scan of a BGA or a PCB with a BGA footprint. Maybe someone around the cubesat team is reading these lines and could throw some light…
Thumbnails found in DB:
The images looking similar to “aurora” are the ones where I think this is a component of the camera PCB.
Images found in DB:
There seem to be more but actually they appear to be all black. Probably there are a bunch of chunks missing or they are somehow corrupted. If someone wants to give it a try himself you may want to follow the instructions below:
- register in our SatNOGS ecosystem (generate an account and login)
- visit the data tab of PAINANi-1
- in the “Data Export (frames)” panel click on “Everything”
- edit the following script to match your paths and run it
- view the generated files with a JPEG2000 capable viewer
The Script:
#%%
#
# PAINANI-1 image extractor
# Extracts the images taken by the satellite PAINANI-1 (NORAD-ID: 44365)
# stored in the SatNOGS-DB. Log in to the DB, select PAINANI-1, switch to the
# data tab and select "Everything" from the "Data Export (frames)" pane. Then
# download the file once you got the announcement email and run the following
# code at the proper location.
# August 2020, with the kind help of fredy and deckbsd, DL4PD
#
import glob
import binascii
# DB dumps in hexlified ASCII
files = glob.glob("../sampledata/painani-1/WBJA-*.csv")
mode = 'r'
images = {}
chunks = []
image_chunks = {}
for file in files:
with open(file, mode) as f:
# DB dump
lines = f.readlines()
for line in lines:
payload = bytearray(binascii.unhexlify(line[20:-1]))
magic = bytearray([0x03, 0xf0, 0xcc, 0xcc])
magic_id = payload[14:18]
offset = 37
if magic_id == magic:
image_id = int.from_bytes(payload[25:28], 'big')
if image_id not in images.keys():
images[image_id] = {}
chunk_id = int.from_bytes(payload[28:30], 'big')
chunk_size = payload[36]
chunk = payload[offset:offset + chunk_size]
if len(chunk) == chunk_size:
images[image_id][chunk_id] = chunk
for image_key, chunk in sorted(images.items()):
image_name = "../sampledata/painani-1/images/aug2021/image_" + str(image_key) + ".j2c"
print("writing image:", image_name)
img_sz = 0
chunks = 0
f = open(image_name, 'w+b')
for ch_key, ch_value in sorted(chunk.items()):
chunks += 1
binary_data = []
binary_data = bytearray(ch_value)
f.write(binary_data)
img_sz += len(binary_data)
print("Image", image_key, "size:", chunks, "chunks,", img_sz, "bytes")
f.close()
# %%
If you find anything just answer to this post