source: ntrip/trunk/BNC/tests/tools/mk_eph_g39.py

Last change on this file was 11215, checked in by stuerze, 6 days ago

Upload Ephemeris: majority vote included

File size: 1.4 KB
Line 
1#!/usr/bin/env python3
2"""Test data for satellites outside BNC's range (case eph_out_of_range): the
3first 6 minutes of data/eph_vote_261118_20min.raw, where each GPS ephemeris
4(1019) of G24 from ASCG00SHN0, KERG00ATF0 and OWMG00NZL0 is followed by a copy
5with satellite ID 39 (as broadcast by the NTS-3 test signal since 30 Sep 2026).
6
7 mk_eph_g39.py data/eph_vote_261118_20min.raw data/eph_g39_261118_6min.raw
8"""
9import sys
10import bncraw
11
12STATIONS = {"ASCG00SHN0", "KERG00ATF0", "OWMG00NZL0"}
13
14
15def with_sv(payload, sv):
16 p = bytearray(payload) # satellite ID: bits 12-17 after the message number
17 p[1] = (p[1] & 0xF0) | (sv >> 2)
18 p[2] = (p[2] & 0x3F) | ((sv & 0x03) << 6)
19 return bytes(p)
20
21
22def main():
23 src, out = sys.argv[1], sys.argv[2]
24 chunks = []
25 framers = {}
26 for t, sta, fmt, data in bncraw.read_chunks(src):
27 if t >= "2026-11-18T17:49":
28 break
29 chunks.append((t, sta, fmt, data))
30 if sta not in STATIONS:
31 continue
32 extra = b""
33 for p in framers.setdefault(sta, bncraw.Rtcm3Framer()).feed(data):
34 if bncraw.msg_type(p) == "1019" and bncraw.BitReader(p).u(18) & 0x3F == 24:
35 extra += bncraw.frame(with_sv(p, 39))
36 if extra:
37 chunks.append((t, sta, fmt, extra))
38 bncraw.write_chunks(out, chunks)
39
40
41if __name__ == "__main__":
42 main()
Note: See TracBrowser for help on using the repository browser.