60 const string Rinex3ObsHeader::hsVersion =
"RINEX VERSION / TYPE";
61 const string Rinex3ObsHeader::hsRunBy =
"PGM / RUN BY / DATE";
62 const string Rinex3ObsHeader::hsComment =
"COMMENT";
63 const string Rinex3ObsHeader::hsMarkerName =
"MARKER NAME";
64 const string Rinex3ObsHeader::hsMarkerNumber =
"MARKER NUMBER";
65 const string Rinex3ObsHeader::hsMarkerType =
"MARKER TYPE";
66 const string Rinex3ObsHeader::hsObserver =
"OBSERVER / AGENCY";
67 const string Rinex3ObsHeader::hsReceiver =
"REC # / TYPE / VERS";
68 const string Rinex3ObsHeader::hsAntennaType =
"ANT # / TYPE";
69 const string Rinex3ObsHeader::hsAntennaPosition =
"APPROX POSITION XYZ";
70 const string Rinex3ObsHeader::hsAntennaDeltaHEN =
"ANTENNA: DELTA H/E/N";
71 const string Rinex3ObsHeader::hsAntennaDeltaXYZ =
"ANTENNA: DELTA X/Y/Z";
72 const string Rinex3ObsHeader::hsAntennaPhaseCtr =
"ANTENNA: PHASECENTER";
73 const string Rinex3ObsHeader::hsAntennaBsightXYZ =
"ANTENNA: B.SIGHT XYZ";
74 const string Rinex3ObsHeader::hsAntennaZeroDirAzi =
"ANTENNA: ZERODIR AZI";
75 const string Rinex3ObsHeader::hsAntennaZeroDirXYZ =
"ANTENNA: ZERODIR XYZ";
76 const string Rinex3ObsHeader::hsCenterOfMass =
"CENTER OF MASS: XYZ";
77 const string Rinex3ObsHeader::hsNumObs =
"# / TYPES OF OBSERV";
78 const string Rinex3ObsHeader::hsSystemNumObs =
"SYS / # / OBS TYPES";
79 const string Rinex3ObsHeader::hsWaveFact =
"WAVELENGTH FACT L1/2";
80 const string Rinex3ObsHeader::hsSigStrengthUnit =
"SIGNAL STRENGTH UNIT";
81 const string Rinex3ObsHeader::hsInterval =
"INTERVAL";
82 const string Rinex3ObsHeader::hsFirstTime =
"TIME OF FIRST OBS";
83 const string Rinex3ObsHeader::hsLastTime =
"TIME OF LAST OBS";
84 const string Rinex3ObsHeader::hsReceiverOffset =
"RCV CLOCK OFFS APPL";
85 const string Rinex3ObsHeader::hsSystemDCBSapplied =
"SYS / DCBS APPLIED";
86 const string Rinex3ObsHeader::hsSystemPCVSapplied =
"SYS / PCVS APPLIED";
87 const string Rinex3ObsHeader::hsSystemScaleFac =
"SYS / SCALE FACTOR";
88 const string Rinex3ObsHeader::hsSystemPhaseShift =
"SYS / PHASE SHIFT";
89 const string Rinex3ObsHeader::hsGlonassSlotFreqNo =
"GLONASS SLOT / FRQ #";
90 const string Rinex3ObsHeader::hsGlonassCodPhsBias =
"GLONASS COD/PHS/BIS";
91 const string Rinex3ObsHeader::hsLeapSeconds =
"LEAP SECONDS";
92 const string Rinex3ObsHeader::hsNumSats =
"# OF SATELLITES";
93 const string Rinex3ObsHeader::hsPrnObs =
"PRN / # OF OBS";
94 const string Rinex3ObsHeader::hsEoH =
"END OF HEADER";
97 const string Rinex3ObsHeader::hsAntennaStandard =
"TRANSMITTER STANDARD";
98 const string Rinex3ObsHeader::hsAntennaRegional =
"TRANSMITTER REGIONAL";
102 const Rinex3ObsHeader::Fields Rinex3ObsHeader::allValid2({
103 Rinex3ObsHeader::validVersion,
104 Rinex3ObsHeader::validRunBy,
105 Rinex3ObsHeader::validMarkerName,
106 Rinex3ObsHeader::validObserver,
107 Rinex3ObsHeader::validReceiver,
108 Rinex3ObsHeader::validAntennaType,
109 Rinex3ObsHeader::validAntennaPosition,
110 Rinex3ObsHeader::validAntennaDeltaHEN,
111 Rinex3ObsHeader::validNumObs,
112 Rinex3ObsHeader::validFirstTime
114 const Rinex3ObsHeader::Fields Rinex3ObsHeader::allValid30({
115 Rinex3ObsHeader::validVersion,
116 Rinex3ObsHeader::validRunBy,
117 Rinex3ObsHeader::validMarkerName,
122 Rinex3ObsHeader::validObserver,
123 Rinex3ObsHeader::validReceiver,
124 Rinex3ObsHeader::validAntennaType,
125 Rinex3ObsHeader::validAntennaPosition,
126 Rinex3ObsHeader::validAntennaDeltaHEN,
127 Rinex3ObsHeader::validSystemNumObs,
128 Rinex3ObsHeader::validFirstTime
130 const Rinex3ObsHeader::Fields Rinex3ObsHeader::allValid301({
131 Rinex3ObsHeader::validVersion,
132 Rinex3ObsHeader::validRunBy,
133 Rinex3ObsHeader::validMarkerName,
135 Rinex3ObsHeader::validObserver,
136 Rinex3ObsHeader::validReceiver,
137 Rinex3ObsHeader::validAntennaType,
138 Rinex3ObsHeader::validAntennaPosition,
139 Rinex3ObsHeader::validAntennaDeltaHEN,
140 Rinex3ObsHeader::validSystemNumObs,
141 Rinex3ObsHeader::validFirstTime,
142 Rinex3ObsHeader::validSystemPhaseShift
144 const Rinex3ObsHeader::Fields Rinex3ObsHeader::allValid302({
145 Rinex3ObsHeader::validVersion,
146 Rinex3ObsHeader::validRunBy,
147 Rinex3ObsHeader::validMarkerName,
149 Rinex3ObsHeader::validObserver,
150 Rinex3ObsHeader::validReceiver,
151 Rinex3ObsHeader::validAntennaType,
152 Rinex3ObsHeader::validAntennaPosition,
153 Rinex3ObsHeader::validAntennaDeltaHEN,
154 Rinex3ObsHeader::validSystemNumObs,
155 Rinex3ObsHeader::validFirstTime,
156 Rinex3ObsHeader::validSystemPhaseShift
158 const Rinex3ObsHeader::Fields Rinex3ObsHeader::allValid303({
159 Rinex3ObsHeader::validVersion,
160 Rinex3ObsHeader::validRunBy,
161 Rinex3ObsHeader::validMarkerName,
163 Rinex3ObsHeader::validObserver,
164 Rinex3ObsHeader::validReceiver,
165 Rinex3ObsHeader::validAntennaType,
166 Rinex3ObsHeader::validAntennaPosition,
167 Rinex3ObsHeader::validAntennaDeltaHEN,
168 Rinex3ObsHeader::validSystemNumObs,
169 Rinex3ObsHeader::validFirstTime,
170 Rinex3ObsHeader::validSystemPhaseShift
173 Rinex3ObsHeader::Rinex3ObsHeader()
257 if (allValid.
empty())
259 FFStreamError
err(
"Unknown RINEX version: " +
261 err.addText(
"Make sure to set the version correctly.");
265 if((
valid & allValid) != allValid)
267 FFStreamError
err(
"Incomplete or invalid header.");
268 err.addText(
"Make sure you set all header valid bits for all of the"
270 allValid.describeMissing(
valid,
err);
278 catch(FFStreamError& e)
282 catch(StringException& e)
297 if(
valid & validVersion ) n++;
298 if(
valid & validRunBy ) n++;
299 if(
valid & validComment ) n += commentList.size();
300 if(
valid & validMarkerName ) n++;
301 if(
valid & validMarkerNumber ) n++;
303 if(
valid & validObserver ) n++;
304 if(
valid & validReceiver ) n++;
305 if(
valid & validAntennaType ) n++;
306 if(
valid & validAntennaPosition ) n++;
307 if(
valid & validAntennaDeltaHEN ) n++;
310 if(
version >= 3 && (
valid & validAntennaBsightXYZ)) n++;
311 if(
version >= 3 && (
valid & validAntennaZeroDirAzi)) n++;
312 if(
version >= 3 && (
valid & validAntennaZeroDirXYZ)) n++;
314 if(
version < 3 && (
valid & validNumObs) && R2ObsTypes.size() != 0)
315 n += 1 + (R2ObsTypes.size()-1)/9;
316 if(
version >= 3 && (
valid & validSystemNumObs) && numObs != 0)
317 n += 1 + (numObs-1)/9;
321 if(extraWaveFactList.size() != 0) n += extraWaveFactList.size();
324 if(
valid & validInterval ) n++;
325 if(
valid & validFirstTime ) n++;
326 if(
valid & validLastTime ) n++;
327 if(
valid & validReceiverOffset ) n++;
328 if(
version >= 3 && (
valid & validSystemDCBSapplied)) n++;
329 if(
version >= 3 && (
valid & validSystemPCVSapplied)) n++;
331 if(
version >= 3.01 && (
valid & validSystemPhaseShift)) n++;
332 if(
version >= 3.01 && (
valid & validGlonassSlotFreqNo)) n++;
333 if(
version >= 3.02 && (
valid & validGlonassCodPhsBias)) n++;
334 if(
valid & validLeapSeconds ) n++;
335 if(
valid & validNumSats ) n++;
336 if(
valid & validPrnObs )
337 n += numObsForSat.size() * (1+numObsForSat.begin()->second.size()/9);
354 line += string(11,
' ');
358 FFStreamError
err(
"File type is not Observation: " +
fileType);
371 FFStreamError
err(
"Invalid satellite system");
375 line +=
leftJustify(
string(
"OBSERVATION DATA"), 20);
388 strm << line << endl;
403 curDate =
printTime(sysTime,
"%04Y%02m%02d %02H%02M%02S %P");
407 strm << line << endl;
412 vector<string>::const_iterator itr =
commentList.begin();
417 strm << line << endl;
427 line =
leftJustify(itr->first.substr(0,1) +
" Obs Type " + itr->first.substr(1) +
" originated from " + itr->second, 60);
429 strm << line << endl;
438 strm << line << endl;
444 line += string(40,
' ');
446 strm << line << endl;
452 line += string(40,
' ');
454 strm << line << endl;
462 strm << line << endl;
471 strm << line << endl;
478 line += string(20,
' ');
480 strm << line << endl;
488 line += string(18,
' ');
490 strm << line << endl;
498 line += string(18,
' ');
500 strm << line << endl;
508 line += string(18,
' ');
510 strm << line << endl;
516 line += string(1,
' ');
521 line += string(18,
' ');
523 strm << line << endl;
531 line += string(18,
' ');
533 strm << line << endl;
539 line += string(46,
' ');
541 strm << line << endl;
549 line += string(18,
' ');
551 strm << line << endl;
559 line += string(18,
' ');
561 strm << line << endl;
568 InvalidRequest er(
"Header contains no R2ObsTypes. "
569 "You must run prepareVer2Write before outputting an R2 file");
573 const int maxObsPerLine = 9;
584 else if((obsWritten % maxObsPerLine) == 0)
587 strm << line << endl;
589 line = string(6,
' ');
596 line += string(60 - line.size(),
' ');
598 strm << line << endl;
603 static const int maxObsPerLine = 13;
605 map<string,vector<RinexObsID> >::const_iterator mapIter;
610 map<string,unsigned> obsCount;
617 bool addedChannel =
false;
618 std::set<CarrierBand> addedIono;
622 vector<RinexObsID> ObsTypeList = mapIter->second;
624 for(
size_t i = 0; i < ObsTypeList.size(); i++)
628 if (addedIono.count(ObsTypeList[i].band) > 0)
630 addedIono.insert(ObsTypeList[i].band);
642 line += string(2,
' ');
646 else if((obsWritten % maxObsPerLine) == 0)
648 line += string(2,
' ');
650 strm << line << endl;
652 line = string(6,
' ');
654 line += string(1,
' ');
658 line += string(60 - line.size(),
' ');
660 strm << line << endl;
669 line += string(48,
' ');
671 strm << line << endl;
681 const int maxSatsPerLine = 7;
682 short satsWritten = 0, satsLeft = (*itr).satList.size(), satsThisLine;
683 vector<SatID>::const_iterator vecItr = (*itr).satList.begin();
685 while ((vecItr != (*itr).satList.end()))
689 line =
rightJustify(asString<short>((*itr).wavelengthFactor[0]),6);
690 line +=
rightJustify(asString<short>((*itr).wavelengthFactor[1]),6);
691 satsThisLine = (satsLeft > maxSatsPerLine ? maxSatsPerLine : satsLeft);
700 FFStreamError ffse(e);
705 if(satsWritten==maxSatsPerLine || satsLeft==0)
708 line += string(60 - line.size(),
' ');
710 strm << line << endl;
723 line += string(40,
' ');
725 strm << line << endl;
731 line += string(50,
' ');
733 strm << line << endl;
739 line += string(60 - line.size(),
' ');
741 strm << line << endl;
747 line += string(60 - line.size(),
' ');
749 strm << line << endl;
755 line += string(54,
' ');
757 strm << line << endl;
762 for(
size_t i = 0; i <
infoDCBS.size(); i++)
765 line += string(1,
' ');
767 line += string(1,
' ');
770 strm << line << endl;
776 for(
size_t i = 0; i <
infoPCVS.size(); i++)
779 line += string(1,
' ');
781 line += string(1,
' ');
784 strm << line << endl;
790 static const int maxObsPerLine = 12;
792 static const int size = 4;
793 static const int factors[size] = {1,10,100,1000};
794 vector<string> obsTypes;
797 map<string, ScaleFacMap>::const_iterator mapIter;
800 map<RinexObsID, int>::const_iterator iter;
802 for(
int i = 0; i < size; i++)
807 for(iter = mapIter->second.begin();
808 iter != mapIter->second.end(); iter++)
810 if(iter->second == factors[i] )
813 obsTypes.push_back(iter->first.asString(
version));
817 if(count == 0 )
continue;
820 line += string(1,
' ');
822 line += string(2,
' ');
825 for(
int j = 0; j < count; j++)
827 if(j > maxObsPerLine-1 && (j % maxObsPerLine) == 0 )
830 line += string(2,
' ');
832 strm << line << endl;
834 line = string(10,
' ');
836 line += string(1,
' ');
839 int space = 60 - 10 - 4*(count % maxObsPerLine);
840 line += string(space,
' ');
842 strm << line << endl;
850 map<string, map<RinexObsID, map<RinexSatID,double> > >::const_iterator it;
853 string sys(it->first);
854 map<RinexObsID, map<RinexSatID,double> >::const_iterator jt(it->second.begin());
855 if(jt == it->second.end())
858 line += string(60-line.length(),
' ');
860 strm << line << endl;
865 for( ; jt!=it->second.end(); ++jt)
868 double corr(jt->second.begin()->second);
879 line += string(60-line.length(),
' ');
881 strm << line << endl;
892 map<RinexSatID,double>::const_iterator kt,lt;
893 for(kt=jt->second.begin(); kt!=jt->second.end(); ++kt)
895 line += string(
" ") + kt->first.toString();
896 if(++n == 10 || ++(lt=kt) == jt->second.end())
899 line += string(60-line.length(),
' ');
901 strm << line << endl;
905 if(lt != jt->second.end())
906 line = string(18,
' ');
920 GLOFreqNumMap::const_iterator it, kt;
922 line += it->first.toString();
926 line += string(60 - line.length(),
' ');
928 strm << line << endl;
933 line = string(4,
' ');
939 FFStreamError
err(
"Glonass Slot Freq No required for files containing Glonass Observations ");
948 GLOCodPhsBias::const_iterator it;
949 const string labs[4] = {
"C1C",
"C1P",
"C2C",
"C2P"};
950 for (
int i = 0; i < 4; i++) {
958 line += string(60 - line.length(),
' ');
960 strm << line << endl;
965 FFStreamError
err(
"Glonass Code Phase Bias required for files containing Glonass Observations ");
972 line += string(54,
' ');
974 strm << line << endl;
980 line += string(54,
' ');
982 strm << line << endl;
987 static const int maxObsPerLine = 9;
988 map<RinexSatID, vector<int> >::const_iterator itr(
numObsForSat.begin());
992 int numObsWritten = 0;
994 const vector<int>&
numObs(itr->second);
1005 map<string, map<string, RinexObsID> >::const_iterator jt(
mapSysR2toR3ObsID.find(sys));
1006 const map<string, RinexObsID> mapVec(jt->second);
1007 map<string, RinexObsID>::const_iterator kt;
1011 string obsid(kt->second.asString(
version));
1012 if(obsid ==
string(
" ")) vec.push_back(0.0);
1013 else vec.push_back(
numObs[j++]);
1017 vector<int>::const_iterator vecItr(vec.begin());
1018 while (vecItr != vec.end())
1020 if(numObsWritten == 0)
1025 line = string(3,
' ') + sat.
toString();
1029 FFStreamError ffse(e);
1033 else if((numObsWritten % maxObsPerLine) == 0)
1037 strm << line << endl;
1039 line = string(6,
' ');
1048 line += string(60 - line.size(),
' ');
1050 strm << line << endl;
1057 line = string(60,
' ');
1059 strm << line << endl;
1069 string label(line, 60, 20);
1088 FFStreamError e(
"This isn't a RINEX 3 Obs file.");
1103 std::string comment =
strip(line.substr(0,60));
1209 FFStreamError e(
"RINEX 2 record in RINEX 3 file: " + label);
1220 const int maxObsPerLine = 9;
1222 R2ObsTypes.push_back(line.substr(i * 6 + 10, 2));
1228 FFStreamError e(
"RINEX 3 record in RINEX 2 file: " + label);
1232 string satSys =
strip(line.substr(0,1));
1244 const int maxObsPerLine = 13;
1248 string obstype(line.substr(4 * i + 7, 3));
1253 catch(InvalidParameter& ip)
1255 FFStreamError fse(
"InvalidParameter: "+ip.what());
1271 const int maxSatsPerLine = 7;
1276 Nsats =
asInt(line.substr(12,6));
1278 if(Nsats > maxSatsPerLine)
1280 FFStreamError e(
"Invalid number of Sats for " +
hsWaveFact);
1284 for(i = 0; i < Nsats; i++)
1293 FFStreamError ffse(e);
1331 tempInfo.
name =
strip(line.substr( 2,17));
1340 tempInfo.
name =
strip(line.substr( 2,17));
1347 static const int maxObsPerLine = 12;
1353 int startPosition = 0;
1371 for(i = startPosition;
1372 (i <
numObs) && ((i % maxObsPerLine) < maxObsPerLine); i++)
1374 int position = 4*(i % maxObsPerLine) + 10 + 1;
1377 tempSfacMap.insert(make_pair(tempType,
factor));
1381 ScaleFacMap::const_iterator iter;
1417 string str =
strip(line.substr(19+4*i,3));
1418 if(str.empty())
break;
1420 satcorrmap.insert(make_pair(sat,cor));
1429 map<RinexObsID, map<RinexSatID, double> > obssatcormap;
1434 string str =
strip(line.substr(2,3));
1445 map<RinexSatID,double> satcorrmap;
1446 for(i=0; i<(nsat < 10 ? nsat : 10); i++)
1449 satcorrmap.insert(make_pair(sat,cor));
1458 map<RinexSatID,double> satcorrmap;
1459 satcorrmap.insert(make_pair(sat,cor));
1475 string str(
strip(line.substr(0,3)));
1479 str =
strip(line.substr(4+i*7,3));
1480 if(str.empty())
break;
1482 str =
strip(line.substr(8+i*7,2));
1495 string str(
strip(line.substr(i*13+1,3)));
1496 if(str.empty())
continue;
1520 string(
"Warning - can't read PRN/OBS in auxHeader: no"
1525 static const int maxObsPerLine = 9;
1530 vector<int> numObsList;
1532 prn =
strip(line.substr(3,3));
1552 for(j=0,i=numObsList.size(); j<maxObsPerLine && i<otmax; i++,j++)
1553 numObsList.push_back(
asInt(line.substr(6*j+6,6)));
1573 for(i=0; i<maxObsPerLine && i<otmax; i++)
1574 numObsList.push_back(
asInt(line.substr(6*i+6,6)));
1583 else if(label ==
hsEoH)
1589 FFStreamError e(
"Unidentified label: >" + label +
"<");
1618 if(line.length() == 0)
1620 FFStreamError e(
"No data read");
1623 else if(line.length() < 60 || line.length() > 80)
1625 FFStreamError e(
"Invalid line length");
1633 catch(FFStreamError& e)
1639 FFStreamError fse(
"Exception: "+e.
what());
1652 vector<string> syss;
1656 map<RinexSatID, vector<int> >::const_iterator it;
1659 string sys(
string(1,(it->first).systemChar()));
1660 if(find(syss.begin(),syss.end(),sys) == syss.end())
1661 syss.push_back(sys);
1672 syss.push_back(
"G");
1673 syss.push_back(
"R");
1674 syss.push_back(
"S");
1675 syss.push_back(
"E");
1681 for(
size_t i=0; i<syss.size(); i++)
1683 const string s(syss[i]);
1684 vector<RinexObsID> obsids;
1697 catch(FFStreamError fse)
1709 map<RinexSatID, vector<int> >::const_iterator it(
numObsForSat.begin());
1721 vec.push_back(it->second[i]);
1734 map<string,vector<RinexObsID> >::const_iterator iter;
1737 string sys(iter->first);
1740 map<RinexObsID, map<RinexSatID, double> > dummy;
1749 if (allValid.
empty())
1751 FFStreamError e(
"Unknown or unsupported RINEX version " +
1756 if((
valid & allValid) != allValid)
1758 FFStreamError e(
"Incomplete or invalid header");
1759 allValid.describeMissing(
valid, e);
1811 FFStreamError e(
"Unknown file system type");
1823 vector<RinexObsID> obsids;
1838 string code1P =
"W";
1882 string code2P =
"X";
1902 if (ot ==
"C1") obsid +=
"C1C";
1903 else if (ot ==
"P1") obsid +=
"C1" + code1P;
1904 else if (ot ==
"L1") obsid +=
"L1" + code1;
1905 else if (ot ==
"D1") obsid +=
"D1" + code1;
1906 else if (ot ==
"S1") obsid +=
"S1" + code1;
1908 else if (ot ==
"C2") obsid +=
"C2X";
1909 else if (ot ==
"P2") obsid +=
"C2" + code2P;
1910 else if (ot ==
"L2") obsid +=
"L2" + code2;
1911 else if (ot ==
"D2") obsid +=
"D2" + code2;
1912 else if (ot ==
"S2") obsid +=
"S2" + code2;
1914 else if (ot ==
"C5") obsid +=
"C5X";
1915 else if (ot ==
"L5") obsid +=
"L5X";
1916 else if (ot ==
"D5") obsid +=
"D5X";
1917 else if (ot ==
"S5") obsid +=
"S5X";
1925 obsids.push_back(OT);
1928 catch(InvalidParameter& ip)
1930 FFStreamError fse(
"InvalidParameter: "+ip.what());
1942 vector<RinexObsID> obsids;
1961 if (ot ==
"C1") obsid +=
"C1C";
1962 else if (ot ==
"P1") obsid +=
"C1P";
1963 else if (ot ==
"L1") obsid +=
"L1" + code1;
1964 else if (ot ==
"D1") obsid +=
"D1" + code1;
1965 else if (ot ==
"S1") obsid +=
"S1" + code1;
1967 else if (ot ==
"C2") obsid +=
"C2C";
1968 else if (ot ==
"P2") obsid +=
"C2P";
1969 else if (ot ==
"L2") obsid +=
"L2" + code2;
1970 else if (ot ==
"D2") obsid +=
"D2" + code2;
1971 else if (ot ==
"S2") obsid +=
"S2" + code2;
1979 obsids.push_back(OT);
1982 catch(InvalidParameter& ip)
1984 FFStreamError fse(
"InvalidParameter: "+ip.what());
2001 vector<RinexObsID> obsids;
2014 if (ot ==
"C1") obsid +=
"C1" + code1;
2015 else if (ot ==
"L1") obsid +=
"L1" + code1;
2016 else if (ot ==
"D1") obsid +=
"D1" + code1;
2017 else if (ot ==
"S1") obsid +=
"S1" + code1;
2019 else if (ot ==
"C5") obsid +=
"C5" + code5;
2020 else if (ot ==
"L5") obsid +=
"L5" + code5;
2021 else if (ot ==
"D5") obsid +=
"D5" + code5;
2022 else if (ot ==
"S5") obsid +=
"S5" + code5;
2024 else if (ot ==
"C6") obsid +=
"C6" + code6;
2025 else if (ot ==
"L6") obsid +=
"L6" + code6;
2026 else if (ot ==
"D6") obsid +=
"D6" + code6;
2027 else if (ot ==
"S6") obsid +=
"S6" + code6;
2029 else if (ot ==
"C7") obsid +=
"C7" + code7;
2030 else if (ot ==
"L7") obsid +=
"L7" + code7;
2031 else if (ot ==
"D7") obsid +=
"D7" + code7;
2032 else if (ot ==
"S7") obsid +=
"S7" + code7;
2034 else if (ot ==
"C8") obsid +=
"C8" + code8;
2035 else if (ot ==
"L8") obsid +=
"L8" + code8;
2036 else if (ot ==
"D8") obsid +=
"D8" + code8;
2037 else if (ot ==
"S8") obsid +=
"S8" + code8;
2045 obsids.push_back(OT);
2048 catch(InvalidParameter& ip)
2050 FFStreamError fse(
"InvalidParameter: "+ip.what());
2063 vector<RinexObsID> obsids;
2073 if (ot ==
"C1") obsid +=
"C1" + code1;
2074 else if (ot ==
"L1") obsid +=
"L1" + code1;
2075 else if (ot ==
"D1") obsid +=
"D1" + code1;
2076 else if (ot ==
"S1") obsid +=
"S1" + code1;
2078 else if (ot ==
"C5") obsid +=
"C5" + code5;
2079 else if (ot ==
"L5") obsid +=
"L5" + code5;
2080 else if (ot ==
"D5") obsid +=
"D5" + code5;
2081 else if (ot ==
"S5") obsid +=
"S5" + code5;
2089 obsids.push_back(OT);
2092 catch(InvalidParameter& ip)
2094 FFStreamError fse(
"InvalidParameter: "+ip.what());
2114 sec =
asDouble(line.substr(30, 13));
2115 tsys = line.substr(48, 3) ;
2159 map<string,vector<RinexObsID> >::const_iterator mit;
2162 string sysString = mit->first;
2166 if ((sysString ==
"I") || (sysString ==
"J") || (sysString ==
"C") ||
2172 if(sysString!=
"G" && sysString!=
"R" && sysString!=
"E" &&
2176 "Invalid system char string in header.mapObsTypes: "+sysString);
2180 map<string, RinexObsID> mapR2toR3ObsID;
2182 vector<string> uniqueCheck;
2184 for(
size_t i=0; i<mit->second.size(); i++)
2186 string R2ot, lab(mit->second[i].asString(
version));
2191 if (lab ==
string(
"C1C"))
2192 R2ot = string(
"C1");
2193 else if (lab ==
string(
"C2X") && mit->first ==
"G")
2194 R2ot = string(
"C2");
2195 else if (lab ==
string(
"C2C") && mit->first ==
"R")
2196 R2ot = string(
"C2");
2198 else if (lab.substr(0,2) ==
"C5")
2199 R2ot = string(
"C5");
2200 else if (lab[0] ==
'C')
2201 R2ot = string(
"P")+string(1,lab[1]);
2203 R2ot = lab.substr(0,2);
2205 vector<string>::iterator it;
2211 mapR2toR3ObsID[R2ot] = mit->second[i];
2216 if (mapR2toR3ObsID.find(R2ot) == mapR2toR3ObsID.end())
2219 mapR2toR3ObsID[R2ot] = mit->second[i];
2225 string::size_type posold,posnew;
2227 posnew = allCodes.find(lab[2]);
2231 mapR2toR3ObsID[R2ot] = mit->second[i];
2237 std::pair<string,string>(
2268 s <<
"---------------------------------- REQUIRED "
2269 <<
"----------------------------------" << endl;
2270 s <<
"Rinex Version " << fixed << setw(5) << setprecision(2) << dumpVersion
2271 <<
", File type " <<
fileType <<
", System " << str <<
"." << endl;
2275 s <<
"Marker type: " <<
markerType <<
"." << endl;
2276 s <<
"Observer : " <<
observer <<
", Agency: " <<
agency << endl;
2278 <<
", Vers: " <<
recVers << endl;
2279 s <<
"Antenna # : " <<
antNo <<
", Type : " <<
antType << endl;
2284 map<string,vector<RinexObsID> >::const_iterator iter;
2290 << iter->second.size() <<
"):" << endl;
2291 for(i = 0; i < iter->second.size(); i++)
2293 s <<
" Type #" << setw(2) << setfill(
'0') << i+1 << setfill(
' ')
2294 <<
" (" << iter->second[i].asString(dumpVersion) <<
") "
2299 s <<
"R2ObsTypes: ";
2305 s <<
"mapSysR2toR3ObsID[" << i->first <<
"] ";
2306 for (ObsIDMap::const_iterator j = i->second.begin(); j != i->second.end(); j++)
2307 s << j->first <<
":" << j->second.asString(dumpVersion) <<
" ";
2311 s <<
"Time of first obs "
2314 s <<
"(This header is ";
2316 s <<
"VALID)" << endl;
2320 s <<
" RINEX " << setprecision(2) << dumpVersion <<
")" << endl;
2321 s <<
"valid = " <<
valid << endl;
2323 s <<
"allValid = " << required << endl;
2325 s <<
"Invalid or missing header records:" << endl;
2327 for (
const auto& reqi : required.
fieldsSet)
2331 s <<
" " << setw(2) << reqi <<
" "
2335 s <<
"END Invalid header records." << endl;
2338 s <<
"---------------------------------- OPTIONAL "
2339 <<
"----------------------------------" << endl;
2345 s <<
"Antenna Delta (XYZ,m) : "
2348 s <<
"Antenna PhaseCtr (XYZ,m) : "
2351 s <<
"Antenna B.sight (XYZ,m) : "
2354 s <<
"Antenna ZeroDir (deg) : "
2357 s <<
"Antenna ZeroDir (XYZ,m) : "
2360 s <<
"Center of Mass (XYZ,m) : "
2366 << fixed << setw(7) << setprecision(3) <<
interval << endl;
2368 s <<
"Time of Last Obs "
2371 s <<
"Clock offset record is present and offsets "
2378 for(i = 0; i <
infoDCBS.size(); i++)
2382 s <<
"System DCBS Correction Applied to " << rsid.
systemString()
2383 <<
" data using program " <<
infoDCBS[i].name << endl;
2384 s <<
" from source " <<
infoDCBS[i].source <<
"." << endl;
2389 for(i = 0; i <
infoPCVS.size(); i++)
2393 s <<
"System PCVS Correction Applied to " << rsid.
systemString()
2394 <<
" data using program " <<
infoPCVS[i].name << endl;
2395 s <<
" from source " <<
infoPCVS[i].source <<
"." << endl;
2400 map<string, ScaleFacMap>::const_iterator mapIter;
2406 s << rsid.
systemString() <<
" scale factors applied:" << endl;
2407 map<RinexObsID,int>::const_iterator iter;
2409 for(iter = mapIter->second.begin(); iter != mapIter->second.end(); iter++)
2410 s <<
" " << iter->first.asString(dumpVersion) <<
" " << iter->second << endl;
2415 map<string, map<RinexObsID, map<RinexSatID,double> > >::const_iterator it;
2418 string sys(it->first);
2419 map<RinexObsID, map<RinexSatID, double> >::const_iterator jt;
2420 jt = it->second.begin();
2421 if(jt == it->second.end())
2422 s <<
"Phase shift correction for system " << sys <<
" is empty." << endl;
2423 for( ; jt!=it->second.end(); ++jt)
2425 map<RinexSatID,double>::const_iterator kt;
2426 for(kt=jt->second.begin(); kt!=jt->second.end(); ++kt)
2427 s <<
"Phase shift correction for system " << sys <<
": "
2428 << fixed << setprecision(5)
2429 << setw(8) << kt->second <<
" cycles applied to obs type "
2430 << jt->first.asString(dumpVersion) <<
" "
2438 map<RinexSatID,int>::const_iterator it;
2439 s <<
"GLONASS frequency channels:\n";
2442 s <<
" " << it->first.toString() <<
" " << setw(2) << it->second;
2443 if(++n > 1 && (n%8)==0) s << endl;
2445 if((n%8) != 0) s << endl;
2449 map<RinexObsID,double>::const_iterator it;
2450 s <<
"GLONASS Code-phase biases:\n" << fixed << setprecision(3);
2452 s <<
" " << it->first.asString(dumpVersion) <<
" " << setw(8) << it->second;
2458 s <<
"Number of Satellites with data : " <<
numSVs << endl;
2462 s <<
" PRN and number of observations for each obs type:" << endl;
2463 map<RinexSatID, vector<int> >::const_iterator it =
numObsForSat.begin();
2472 const vector<RinexObsID>& vec(iter->second);
2473 for(i=0; i<vec.size(); i++)
2474 s << setw(7) << vec[i].asString(dumpVersion);
2478 vector<int> obsvec = it->second;
2480 for(i = 0; i < obsvec.size(); i++)
2481 s <<
" " << setw(6) << obsvec[i];
2489 s <<
"Comments (" <<
commentList.size() <<
") :" << endl;
2493 s <<
"-------------------------------- END OF HEADER "
2494 <<
"--------------------------------" << endl;
2504 string newType(type);
2507 if( newType.size() == 2 )
2509 if( newType ==
"C1" ) newType =
"C1C";
2510 else if( newType ==
"P1" ) newType =
"C1P";
2511 else if( newType ==
"L1" ) newType =
"L1P";
2512 else if( newType ==
"D1" ) newType =
"D1P";
2513 else if( newType ==
"S1" ) newType =
"S1P";
2514 else if( newType ==
"C2" ) newType =
"C2C";
2515 else if( newType ==
"P2" ) newType =
"C2P";
2516 else if( newType ==
"L2" ) newType =
"L2P";
2517 else if( newType ==
"D2" ) newType =
"D2P";
2518 else if( newType ==
"S2" ) newType =
"S2P";
2521 InvalidRequest exc(
"Invalid type.");
2527 if( newType.size() == 3 )
2529 newType =
"G" + newType;
2535 InvalidRequest ir(newType +
" is not a valid RinexObsID!.");
2540 string sys( newType, 0, 1 );
2554 std::map<std::string,unsigned> obsCount;
2556 RinexObsMap::const_iterator it = remapped.find(sys);
2558 if (it == remapped.end())
2560 InvalidRequest ir(
"GNSS system " + sys +
" not stored.");
2565 for (
size_t i=0; i<rov.size(); i++)
2567 if (rov[i].equalIndex(obsID))
2571 InvalidRequest ir(obsID.
asString(
version) +
" is not stored in system " + sys +
".");
2578 std::vector<std::string>& diffs,
2579 const std::vector<std::string>& inclExclList,
2583 std::map<std::string,bool> lineMap;
2584 std::map<std::string,bool>::const_iterator lmi;
2587 std::set<std::string>
2590 std::set<RinexObsID>
2606 lineMap[
hsComment] = (lcomments == rcomments);
2635 lineMap[
hsNumObs] = (lobs == robs);
2658 std::map<std::string,bool> oldLineMap(lineMap);
2659 std::map<std::string,bool>::const_iterator olmi;
2661 for (
unsigned i = 0; i < inclExclList.size(); i++)
2663 if ((olmi = oldLineMap.find(inclExclList[i])) != oldLineMap.end())
2665 lineMap[olmi->first] = olmi->second;
2672 for (
unsigned i = 0; i < inclExclList.size(); i++)
2674 lineMap.erase(inclExclList[i]);
2679 for (lmi = lineMap.begin(); lmi != lineMap.end(); lmi++)
2683 diffs.push_back(lmi->first);
2709 set_intersection(fieldsSet.begin(), fieldsSet.end(),
2711 inserter(results, results.begin()));
2719 set_union(fieldsSet.begin(), fieldsSet.end(),
2721 inserter(results, results.begin()));
2729 if (fieldsSet.count(rhs))
2739 set_difference(fieldsSet.begin(), fieldsSet.end(),
2741 inserter(results, results.begin()));
2742 return results.empty();
2750 for (
const auto& f : fieldsSet)
2799 default:
return "???";
2846 Rinex3ObsHeader::FieldSet::const_iterator i;
2866 bool addedChannel =
false;
2867 std::set<CarrierBand> addedIono;
2868 for(
size_t i = 0; i < mapIter.second.size(); i++)
2872 if (addedIono.count(mapIter.second[i].band) > 0)
2874 addedIono.insert(mapIter.second[i].band);
2880 addedChannel =
true;
2882 remapped[mapIter.first].push_back(mapIter.second[i]);
2883 obsCount[mapIter.first]++;