SGL-UT / GPSTk

ATTENTION: This repository has been moved and is for archival purposes only. GPSTk toolkit has been renamed to GNSSTK and has been split into two new separate repositories. GNSSTK now only contains libraries while the other repository GNSSTK-APPS contains only applications. The rename and split into libraries and applications started with version v12.0.0 on September 2021. GPSTk --> GNSSTK at https://gitlab.com/sgl-ut/gnsstk --> GNSSTK-APPS at https://gitlab.com/sgl-ut/gnsstk-apps
Other
342 stars 185 forks source link

Cors Broadcast Ephemeris fails to load #9

Closed craighanna closed 3 years ago

craighanna commented 8 years ago

Running RinNav --nav brdc1030.16n --navpath . using NOAA's broadcast ephemeris file located at ftp://geodesy.noaa.gov/cors/rinex/2016/103 fails. It fails on most brdc files, and it's caused by a test located at GNSSEph/OrbitEphStore.cpp:231 I don't know who's code is right, Cors' brdc generating code or your error checking code, but I'm surprised they don't agree on what's valid.

rommar commented 8 years ago

I probably faced with the same problem while trying to load Rinex3NavData records into GPSEphemerisStore. The reason for me seems to be related not only to OrbitEphStore, but also to GPSEphemeris::adjustValidity function. OrbitEphStore keeps track on ephemeris data using beginValid value as a key for a map. When ephemeris data passed into OrbitEphStore::addEphemeris has the same beginValid time as already existing (previously added data) then OrbitEphStore::addEphemeris assumes it should be a duplicate and checks for ctToe fields to ensure. Non equal 'ctToe's with equal 'beginValid's are considered to be a situation that "shouldn't happen". Two OrbitEph objects passed into OrbitEphStore::addEphemeris may have equal beginValid times because of GPSEphemeris::adjustValidity function adjust them with a tricky way. I don't know how to fix this absolutely correctly, probably OrbitEphStore::addEphemeris should account for possibly equal beginValid times with non-equal ctToe.

For myself I use the following workaround in OrbitEphStore::addEphemeris:

// is a duplicate found in the table?
if(it->second->ctToe == eph->ctToe) {
   message = string("duplicate Toe");
   return ret;
}
//--- Workaround begin
else if (eph->ctToe > it->second->ctToe) {
    // Replace existing
    ret = eph->clone();
    toet[eph->beginValid] = ret;
    updateTimeLimits(ret);
    return ret;
} 
//--- Workaround end
else {
    // Found matching beginValid but different Toe - This shouldn't happen
    string str = "Unexpected matching beginValid time but not Toe, for "
        + asString(eph->satID)
        + ", beginValid= " + printTime(eph->beginValid, fmt)
        + ", Toe(map)= " + printTime(it->second->ctToe, fmt)
        + ", Toe(candidate)= " + printTime(eph->ctToe, fmt);
    InvalidParameter ir(str);
    GPSTK_THROW(ir);                
}
htyeim commented 7 years ago

I face the same problem.... brdc0670.16n download from ftp://cddis.gsfc.nasa.gov. The error track to the the if-else begin in line 219 of OrbitEphStore.cpp. The error str is Unexpected matching beginValid time but not Toe, for GPS 30, beginValid= 2016/03/07 00:00:00 GPS, Toe(map)= 2016/03/07 00:00:00 GPS, Toe(candidate)= 2016/03/07 01:59:44 GPS

Add the code provided by @rommar, the problem is solved.... Thank you!

malliwi88 commented 6 years ago

Hellow, an excuse for open this issue again.

but I have some related issue image

additional details

I have used the master version 2.5 from this repo and I have compiled it together with python bindings at the time. My problem would be solved with a later release to the merge mentioned above, which version would be the most indicated and that has support for bindings python? There is no longer python support for GPSTk?

Thanks, any help is appreciated

rommar commented 5 years ago

Hello. I can't comment anything about python support, but according to your error message this doesn't seem to be the same issue. "Ephemeris not found" most likely mean you request an ephemeris for a combination of time and satellite id that isn't present in the store. Ensure you fill the store with needed data.

UT-dave commented 3 years ago

Closing as stale, as there were numerous RINEX fixes and upgrades by the last release, and an upcoming release later this summer addresses several more.