add rinjoin tool that parses rinex files and emits a joined up CVS file of af0 parameters

eph-store
bert hubert 2020-07-21 11:18:31 +02:00
parent 2fcee90254
commit 85377da7c7
2 changed files with 55 additions and 2 deletions

View File

@ -25,7 +25,7 @@ endif
CHEAT_ARG := $(shell ./update-git-hash-if-necessary)
PROGRAMS = navparse ubxtool navnexus navcat navrecv navdump testrunner navdisplay tlecatch reporter sp3feed \
galmonmon rinreport rtcmtool gndate
galmonmon rinreport rinjoin rtcmtool gndate
all: navmon.pb.cc $(PROGRAMS)
@ -117,6 +117,10 @@ tlecatch: tlecatch.o $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) gith
rinreport: rinreport.o rinex.o githash.o navmon.o ext/fmt-6.1.2/src/format.o ephemeris.o osen.o
$(CXX) -std=gnu++17 $^ -o $@ -lz -pthread
rinjoin: rinjoin.o rinex.o githash.o navmon.o ext/fmt-6.1.2/src/format.o ephemeris.o osen.o
$(CXX) -std=gnu++17 $^ -o $@ -lz -pthread
rtcmtool: rtcmtool.o navmon.pb.o githash.o ext/fmt-6.1.2/src/format.o bits.o nmmsender.o $(SIMPLESOCKETS) navmon.o rtcm.o zstdwrap.o
$(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib -lz -pthread -lprotobuf -lzstd
@ -129,7 +133,6 @@ testrunner: navmon.pb.o testrunner.o ubx.o bits.o ext/fmt-6.1.2/src/format.o gal
gndate: gndate.o githash.o ext/fmt-6.1.2/src/format.o navmon.o
$(CXX) -std=gnu++17 $^ -o $@ -L/usr/local/lib
check: testrunner
./testrunner

50
rinjoin.cc 100644
View File

@ -0,0 +1,50 @@
#include <iostream>
#include "rinex.hh"
#include <map>
#include <optional>
using namespace std;
struct Value
{
optional<int> af0Inav;
optional<int> af0Fnav;
int af1;
optional<int> BGDE1E5a;
optional<int> BGDE1E5b;
};
map<pair<time_t, int>, Value> satmap;
int main(int argc, char** argv)
{
for(int n = 1; n < argc; ++n) {
RINEXReader rr(argv[n]);
RINEXEntry e;
while(rr.get(e)) {
if(e.gnss != 2)
continue;
// cout << e.t <<" " << e.sv <<" " << (int64_t)(rint(ldexp(e.af0,34))) <<" " << (int64_t)(rint(ldexp(e.BGDE1E5a,32)))<<" " << (int64_t)(rint(ldexp(e.BGDE1E5b,32))) <<" "<<e.clkflags <<endl;
auto& s=satmap[{e.t, e.sv}];
if(((unsigned int)e.clkflags) & 512) { // I/NAV
s.af0Inav = rint(ldexp(e.af0,34));
s.af1 = rint(ldexp(e.af1,46));
s.BGDE1E5a = rint(ldexp(e.BGDE1E5a,32));
s.BGDE1E5b = rint(ldexp(e.BGDE1E5b,32));
}
else {
s.af0Fnav = rint(ldexp(e.af0,34));
s.af1 = rint(ldexp(e.af1,46));
s.BGDE1E5a = rint(ldexp(e.BGDE1E5a,32));
// E1E5b unreliable on F/NAV somehow
}
}
}
cout<<"timestamp sv af0fnav af0inav af1 bgde1e5a bgde1e5b\n";
for(const auto& s : satmap) {
if(s.second.af0Fnav.has_value() && s.second.af0Inav.has_value() && s.second.BGDE1E5a.has_value() && s.second.BGDE1E5b.has_value())
cout << s.first.first<<" " <<s.first.second<<" " <<
*s.second.af0Fnav << " " << *s.second.af0Inav <<" " << s.second.af1<<" " <<*s.second.BGDE1E5a <<" " << *s.second.BGDE1E5b << "\n";
}
}