kng / geoscan-tools

Process frames from satellite Geoscan-Edelveis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stratosat address calculation is broken

encse opened this issue · comments

I have attached a tgz with a kss file and expected vs actual outputs when running

python3 stratosat_simple.py input.kss

broken.tgz

I see that the issue is around the address calculation, I just dont have a 'high resolution' kss file to make a proper fix. If you have a sample input I can make a PR for this issue.

Here is a patch that works.

diff --git a/stratosat_simple.py b/stratosat_simple.py
index c45bd5d..9beb40b 100755
--- a/stratosat_simple.py
+++ b/stratosat_simple.py
@@ -55,15 +55,12 @@ def parse_frames(data):
     hr = False
     for row in data:
         if row[16:22].upper() == 'FFD8FF':
-            offset = int((row[12:14] + row[10:12]), 16)
+            offset = int((row[14:16]+ row[12:14] + row[10:12]), 16)
             hr = row[6:10].upper() == '2098'
             break
     for row in data:
         cmd = row[0:4]
-        if hr:
-            addr = int((row[14:16] + row[12:14] + row[10:12]), 16)
-        else:
-            addr = int((row[12:14] + row[10:12]), 16) - offset
+        addr = int((row[14:16] + row[12:14] + row[10:12]), 16) - offset
         dlen = (int(row[4:6], 16) + 2) * 2
         payload = row[16:dlen]
         if cmd == '0200' and addr >= 0:

Hi and thanks for the patch, I have basically the same code in the imagedecode as well. I don't think I have any hr images to test with. I don't want to drop support for hr, so adding 24bit address on two lines is preferred. perhaps doing some other mechanism with hr not using the offset.

I made a commit based on your suggestions, if they work, feel free to close this issue (:

I'll try to find some inputs in satnogs db during the weekend and check if it works.

Ok, I couldn't check it (no time), but your commit is fine. Thanks for the help! We can close this now.