REC-SPb-ETU / Gpstk-old

Other
3 stars 1 forks source link

Can't read mixed observatoins in Rinex 2.11 with Rinex3ObsData #13

Closed jonyrock closed 9 years ago

jonyrock commented 9 years ago

I claim that mixed observations can't be processed with Rinex3ObsData. But it could be with RinexObsData

There are files with header which starts with 2.11 Observation M (Mixed) but it's never read with Rinex3ObsData.

So the bug looks like this: Rinex3ObsData get the first line of file instead of the first line of data.

jonyrock commented 9 years ago

Actually I get https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp#L1728

https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/FFStream.cpp#L181

@eugenyk please compare this

      else if(label == stringFirstTime)
      {
         firstObs = parseTime(line);
         valid |= validFirstTime;
      }

https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp#L1178

and this

      else if (label == firstTimeString)
      {
         firstObs = parseTime(line);
         firstSystem.system = RinexSatID::systemGPS;
         if(line.substr(48,3)=="GLO") firstSystem.system=RinexSatID::systemGlonass;
         if(line.substr(48,3)=="GAL") firstSystem.system=RinexSatID::systemGalileo;
         valid |= firstTimeValid;
      }

https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX/RinexObsHeader.cpp#L678

looks like a bug, huh ?

jonyrock commented 9 years ago

@eugenyk it is awkward btw that there are two versions of the same functionality in the lib. Obviously it's bad

jonyrock commented 9 years ago

@eugenyk I found another suspicious moment: int yy = (static_cast<CivilTime>(strm.header.firstObs)).year/100; https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX3/Rinex3ObsData.cpp#L410

but strm.header.firstObs IS CivilTime. is Rinex3ObsHeader.hpp https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX3/Rinex3ObsHeader.hpp#L252

BUT is CommonTime firstObs ; in RinexObsHeader.hpp

https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX/RinexObsHeader.hpp#L255

jonyrock commented 9 years ago

@eugenyk I checked all cases with mixed Rinex 3.0 and everywhere type is set like this 2009 9 23 0 0 0.0000000 GPS TIME OF FIRST OBS

it does work only because https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/RefTime/TimeSystem.cpp#L68

jonyrock commented 9 years ago

Ok, so I think i should add this code

if(ts == TimeSystem::Unknown) {
     ts = TimeSystem::GPS;
}

here https://github.com/jonyrock/Gpstk/blob/d2746d24c7b665ce0740a8ab7e9fb950a5a64020/dev/ext/lib/FileHandling/RINEX3/Rinex3ObsHeader.cpp#L1755