- Timestamp:
- Sep 29, 2015, 9:29:30 AM (9 years ago)
- Location:
- trunk/BNC/src/rinex
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/rinex/reqcedit.cpp
r7280 r7474 35 35 * Created: 11-Apr-2012 36 36 * 37 * Changes: 37 * Changes: 38 38 * 39 39 * -----------------------------------------------------------------------*/ … … 88 88 } 89 89 90 // 90 // 91 91 //////////////////////////////////////////////////////////////////////////// 92 92 void t_reqcEdit::run() { 93 93 94 94 // Open Log File 95 95 // ------------- … … 120 120 << _samplingRate << endl; 121 121 *_log << QByteArray("Start time").leftJustified(15) << ": " 122 << _begTime.datestr().c_str() << ' ' 122 << _begTime.datestr().c_str() << ' ' 123 123 << _begTime.timestr(0).c_str() << endl; 124 124 *_log << QByteArray("End time").leftJustified(15) << ": " 125 << _endTime.datestr().c_str() << ' ' 125 << _endTime.datestr().c_str() << ' ' 126 126 << _endTime.timestr(0).c_str() << endl; 127 127 *_log << QByteArray("Input Obs Files").leftJustified(15) << ": " … … 159 159 // Initialize input observation files, sort them according to start time 160 160 //////////////////////////////////////////////////////////////////////////// 161 void t_reqcEdit::initRnxObsFiles(const QStringList& obsFileNames, 161 void t_reqcEdit::initRnxObsFiles(const QStringList& obsFileNames, 162 162 QVector<t_rnxObsFile*>& rnxObsFiles, 163 163 QTextStream* log) { … … 172 172 QListIterator<QFileInfo> it(dir.entryInfoList(filters)); 173 173 while (it.hasNext()) { 174 QString filePath = it.next().filePath(); 174 QString filePath = it.next().filePath(); 175 175 t_rnxObsFile* rnxObsFile = 0; 176 176 try { … … 199 199 } 200 200 } 201 qStableSort(rnxObsFiles.begin(), rnxObsFiles.end(), 201 qStableSort(rnxObsFiles.begin(), rnxObsFiles.end(), 202 202 t_rnxObsFile::earlierStartTime); 203 203 } 204 204 205 // 205 // 206 206 //////////////////////////////////////////////////////////////////////////// 207 207 void t_reqcEdit::editObservations() { … … 218 218 // ---------------------------------- 219 219 t_rnxObsFile outObsFile(_outObsFileName, t_rnxObsFile::output); 220 220 221 221 // Select observation types 222 222 // ------------------------ … … 296 296 t_rnxObsFile* obsFile = _rnxObsFiles[ii]; 297 297 if (_log) { 298 *_log << "Processing File: " << obsFile->fileName() << " start: " 299 << obsFile->startTime().datestr().c_str() << ' ' 298 *_log << "Processing File: " << obsFile->fileName() << " start: " 299 << obsFile->startTime().datestr().c_str() << ' ' 300 300 << obsFile->startTime().timestr(0).c_str() << endl; 301 301 } … … 320 320 txtMap["COMMENT"] = comment; 321 321 } 322 if (int(_rnxVersion) < int(obsFile->header().version())) { 323 addRnxConversionDetails(obsFile, txtMap); 324 } 322 325 outObsFile.header().write(outObsFile.stream(), &txtMap); 323 326 } … … 331 334 break; 332 335 } 333 334 if (_samplingRate == 0 || 336 337 if (_samplingRate == 0 || 335 338 fmod(round(epo->tt.gpssec()), _samplingRate) == 0) { 336 339 applyLLI(obsFile, epo); … … 347 350 } 348 351 else { 349 qDebug() << str; 352 qDebug() << str; 350 353 } 351 354 return; … … 363 366 } 364 367 365 // Change RINEX Header Content 368 // Change RINEX Header Content 366 369 //////////////////////////////////////////////////////////////////////////// 367 370 void t_reqcEdit::editRnxObsHeader(t_rnxObsFile& obsFile) { … … 372 375 QString newMarkerName = settings.value("reqcNewMarkerName").toString(); 373 376 if (!newMarkerName.isEmpty()) { 374 if (oldMarkerName.isEmpty() || 377 if (oldMarkerName.isEmpty() || 375 378 QRegExp(oldMarkerName).exactMatch(obsFile.markerName())) { 376 379 obsFile.setMarkerName(newMarkerName); … … 381 384 QString newAntennaName = settings.value("reqcNewAntennaName").toString(); 382 385 if (!newAntennaName.isEmpty()) { 383 if (oldAntennaName.isEmpty() || 386 if (oldAntennaName.isEmpty() || 384 387 QRegExp(oldAntennaName).exactMatch(obsFile.antennaName())) { 385 388 obsFile.setAntennaName(newAntennaName); … … 426 429 QString newReceiverType = settings.value("reqcNewReceiverName").toString(); 427 430 if (!newReceiverType.isEmpty()) { 428 if (oldReceiverType.isEmpty() || 431 if (oldReceiverType.isEmpty() || 429 432 QRegExp(oldReceiverType).exactMatch(obsFile.receiverType())) { 430 433 obsFile.setReceiverType(newReceiverType); … … 442 445 } 443 446 444 // 445 //////////////////////////////////////////////////////////////////////////// 446 void t_reqcEdit::rememberLLI(const t_rnxObsFile* obsFile, 447 // 448 //////////////////////////////////////////////////////////////////////////// 449 void t_reqcEdit::rememberLLI(const t_rnxObsFile* obsFile, 447 450 const t_rnxObsFile::t_rnxEpo* epo) { 448 451 … … 467 470 } 468 471 } 469 470 // 471 //////////////////////////////////////////////////////////////////////////// 472 void t_reqcEdit::applyLLI(const t_rnxObsFile* obsFile, 472 473 // 474 //////////////////////////////////////////////////////////////////////////// 475 void t_reqcEdit::applyLLI(const t_rnxObsFile* obsFile, 473 476 t_rnxObsFile::t_rnxEpo* epo) { 474 477 475 478 if (_samplingRate == 0) { 476 479 return; … … 509 512 QListIterator<QFileInfo> it(dir.entryInfoList(filters)); 510 513 while (it.hasNext()) { 511 QString filePath = it.next().filePath(); 514 QString filePath = it.next().filePath(); 512 515 appendEphemerides(filePath, ephs); 513 516 } … … 520 523 } 521 524 522 // 525 // 523 526 //////////////////////////////////////////////////////////////////////////// 524 527 void t_reqcEdit::editEphemerides() { … … 594 597 } 595 598 596 // 599 // 597 600 //////////////////////////////////////////////////////////////////////////// 598 601 void t_reqcEdit::appendEphemerides(const QString& fileName, … … 633 636 } 634 637 } 638 639 void t_reqcEdit::addRnxConversionDetails(const t_rnxObsFile* obsFile, 640 QMap<QString, QString>& txtMap) { 641 642 int key = 0; 643 QString systems = obsFile->header().usedSystems(); 644 QString comment = QString("RINEX 3 => 2 CONVERSION DETAILS:"); 645 QString commentKey = QString("COMMENT %1").arg(key, 3, 10, QChar('0')); 646 txtMap.insert(commentKey, comment); 647 648 for(int ii = 0; ii < obsFile->numSys(); ii++) { 649 key++; 650 char sys = systems[ii].toAscii(); 651 QString preferredAttrib = obsFile->signalPriorities(sys); 652 comment = QString("%1: Signal priority = %2").arg(sys).arg(preferredAttrib); 653 commentKey = QString("COMMENT %1").arg(key, 3, 10, QChar('0')); 654 txtMap.insert(commentKey, comment); 655 QStringList types = obsFile->header().obsTypes(sys); 656 for (int jj = 0; jj < types.size(); jj++) { 657 key++; 658 QString inType = types[jj]; 659 for (int iPref = 0; iPref < preferredAttrib.length(); iPref++) { 660 if (preferredAttrib[iPref] == '?' || 661 (inType.length() == 2 && preferredAttrib[iPref] == '_' ) || 662 (inType.length() == 3 && preferredAttrib[iPref] == inType[2]) ) { 663 QString outType = t_rnxObsFile::type3to2(sys, inType); 664 comment = QString("%1: %2 => %3").arg(sys).arg(inType).arg(outType); 665 commentKey = QString("COMMENT %1").arg(key, 3, 10, QChar('0')); 666 txtMap.insert(commentKey, comment); 667 break; 668 } 669 } 670 } 671 } 672 } -
trunk/BNC/src/rinex/reqcedit.h
r5738 r7474 33 33 class t_reqcEdit : public QThread { 34 34 Q_OBJECT 35 35 36 36 public: 37 37 t_reqcEdit(QObject* parent); … … 42 42 signals: 43 43 void finished(); 44 44 45 45 public slots: 46 46 47 47 public: 48 48 virtual void run(); 49 static void initRnxObsFiles(const QStringList& obsFileNames, 49 static void initRnxObsFiles(const QStringList& obsFileNames, 50 50 QVector<t_rnxObsFile*>& rnxObsFiles, 51 51 QTextStream* log); … … 53 53 QVector<t_eph*>& ephs); 54 54 static void appendEphemerides(const QString& fileName, QVector<t_eph*>& ephs); 55 55 56 56 private: 57 57 void editObservations(); … … 60 60 void rememberLLI(const t_rnxObsFile* obsFile, const t_rnxObsFile::t_rnxEpo* epo); 61 61 void applyLLI(const t_rnxObsFile* obsFile, t_rnxObsFile::t_rnxEpo* epo); 62 void addRnxConversionDetails(const t_rnxObsFile* obsFile, QMap<QString, QString>& txtMap); 62 63 63 64 QString _logFileName; -
trunk/BNC/src/rinex/rnxobsfile.cpp
r6943 r7474 35 35 * Created: 24-Jan-2012 36 36 * 37 * Changes: 37 * Changes: 38 38 * 39 39 * -----------------------------------------------------------------------*/ … … 310 310 _obsTypes.clear(); 311 311 if (_version < 3.0) { 312 _obsTypes['G'] << "C1" << "P1" << "L1" << "S1" 312 _obsTypes['G'] << "C1" << "P1" << "L1" << "S1" 313 313 << "C2" << "P2" << "L2" << "S2"; 314 314 _obsTypes['R'] = _obsTypes['G']; … … 319 319 } 320 320 else { 321 _obsTypes['G'] << "C1C" << "L1C" << "S1C" 321 _obsTypes['G'] << "C1C" << "L1C" << "S1C" 322 322 << "C1W" << "L1W" << "S1W" 323 323 << "C2X" << "L2X" << "S2X" 324 << "C2W" << "L2W" << "S2W" 324 << "C2W" << "L2W" << "S2W" 325 325 << "C5X" << "L5X" << "S5X"; 326 326 327 327 _obsTypes['J'] = _obsTypes['G']; 328 329 _obsTypes['R'] << "C1C" << "L1C" << "S1C" 328 329 _obsTypes['R'] << "C1C" << "L1C" << "S1C" 330 330 << "C2P" << "L2P" << "S2P"; 331 331 332 332 _obsTypes['E'] << "C1X" << "L1X" << "SX1" 333 333 << "C5X" << "L5X" << "SX5" 334 334 << "C7X" << "L7X" << "SX7" 335 335 << "C8X" << "L8X" << "SX8"; 336 336 337 337 _obsTypes['S'] << "C1C" << "L1C" << "S1C" 338 338 << "C5I" << "L5I" << "S5I" 339 339 << "C5Q" << "L5Q" << "S5Q"; 340 340 341 341 _obsTypes['C'] << "C2I" << "L2I" << "S2I" 342 342 << "C6I" << "L6I" << "S6I" … … 359 359 _version = t_rnxObsHeader::defaultRnxObsVersion3; 360 360 } 361 _interval = header._interval; 362 _antennaNumber = header._antennaNumber; 363 _antennaName = header._antennaName; 364 _markerName = header._markerName; 365 _markerNumber = header._markerNumber; 361 _interval = header._interval; 362 _antennaNumber = header._antennaNumber; 363 _antennaName = header._antennaName; 364 _markerName = header._markerName; 365 _markerNumber = header._markerNumber; 366 366 _markerType = header._markerType; 367 _antNEU = header._antNEU; 368 _antXYZ = header._antXYZ; 369 _antBSG = header._antBSG; 370 _xyz = header._xyz; 371 _observer = header._observer; 372 _agency = header._agency; 373 _receiverNumber = header._receiverNumber; 374 _receiverType = header._receiverType; 367 _antNEU = header._antNEU; 368 _antXYZ = header._antXYZ; 369 _antBSG = header._antBSG; 370 _xyz = header._xyz; 371 _observer = header._observer; 372 _agency = header._agency; 373 _receiverNumber = header._receiverNumber; 374 _receiverType = header._receiverType; 375 375 _receiverVersion = header._receiverVersion; 376 _startTime = header._startTime; 376 _startTime = header._startTime; 377 377 _comments = header._comments; 378 378 _usedSystems = header._usedSystems; 379 379 380 380 for (unsigned iPrn = 1; iPrn <= t_prn::MAXPRN_GPS; iPrn++) { 381 _wlFactorsL1[iPrn] = header._wlFactorsL1[iPrn]; 382 _wlFactorsL2[iPrn] = header._wlFactorsL2[iPrn]; 381 _wlFactorsL1[iPrn] = header._wlFactorsL1[iPrn]; 382 _wlFactorsL2[iPrn] = header._wlFactorsL2[iPrn]; 383 383 } 384 384 … … 444 444 for (int iSys = 0; iSys < _usedSystems.length(); iSys++) { 445 445 char sys = _usedSystems[iSys].toAscii(); 446 QString type = _version >= 3.0 ? t_rnxObsFile::type2to3(sys, useObsTypes->at(iType)) : 446 QString type = _version >= 3.0 ? t_rnxObsFile::type2to3(sys, useObsTypes->at(iType)) : 447 447 t_rnxObsFile::type3to2(sys, useObsTypes->at(iType)); 448 448 if (!_obsTypes[sys].contains(type)) { … … 523 523 524 524 if (txtMap) { 525 525 QMapIterator<QString, QString> it(*txtMap); 526 526 while (it.hasNext()) { 527 527 it.next(); … … 529 529 runBy = it.value(); 530 530 } 531 else if ( it.key() == "COMMENT") {532 newComments = it.value().split("\\n", QString::SkipEmptyParts);531 else if ((it.key().indexOf("COMMENT")) != -1) { 532 newComments += it.value().split("\\n", QString::SkipEmptyParts); 533 533 } 534 534 } … … 570 570 .leftJustified(60) 571 571 << "MARKER TYPE\n"; 572 572 573 573 *stream << QString("%1%2") 574 574 .arg(_observer, -20) … … 766 766 } 767 767 768 // 768 // 769 769 //////////////////////////////////////////////////////////////////////////// 770 770 char t_rnxObsHeader::system(int iSys) const { … … 781 781 } 782 782 783 // 784 //////////////////////////////////////////////////////////////////////////// 785 QString t_rnxObsHeader::usedSystems(void) const { 786 return _usedSystems; 787 } 788 789 QStringList t_rnxObsHeader::obsTypes(char sys) const { 790 if (_obsTypes.contains(sys)) { 791 return _obsTypes[sys]; 792 } 793 else { 794 return QStringList(); 795 } 796 } 797 783 798 // Number of Observation Types (satellite-system specific) 784 799 //////////////////////////////////////////////////////////////////////////// … … 873 888 QTextStream(&hlp) << QString("%1").arg(_obsTypes[sys0].size(), 6); 874 889 for (int ii = 0; ii < _obsTypes[sys0].size(); ii++) { 875 QTextStream(&hlp) << QString("%1").arg(_obsTypes[sys0][ii], 6); 890 QTextStream(&hlp) << QString("%1").arg(_obsTypes[sys0][ii], 6); 876 891 if ((ii+1) % 9 == 0 || ii == _obsTypes[sys0].size()-1) { 877 892 strList.append(hlp.leftJustified(60) + "# / TYPES OF OBSERV\n"); … … 887 902 for (int iType = 0; iType < nTypes(sys); iType++) { 888 903 QString type = obsType(sys, iType); 889 QTextStream(&hlp) << QString(" %1").arg(type, -3); 904 QTextStream(&hlp) << QString(" %1").arg(type, -3); 890 905 if ((iType+1) % 13 == 0 || iType == nTypes(sys)-1) { 891 906 strList.append(hlp.leftJustified(60) + "SYS / # / OBS TYPES\n"); … … 985 1000 // Handle Special Epoch Flag 986 1001 //////////////////////////////////////////////////////////////////////////// 987 void t_rnxObsFile::handleEpochFlag(int flag, const QString& line, 1002 void t_rnxObsFile::handleEpochFlag(int flag, const QString& line, 988 1003 bool& headerReRead) { 989 1004 … … 1003 1018 1004 1019 // Re-Read Header 1005 // -------------- 1020 // -------------- 1006 1021 else if (flag == 3 || flag == 4 || flag == 5) { 1007 1022 int numLines = 0; … … 1077 1092 int numSat; 1078 1093 readInt(line, 32, 3, numSat); 1079 1094 1080 1095 _currEpo.rnxSat.resize(numSat); 1081 1096 … … 1090 1105 int pos = 3 + 16*iType; 1091 1106 double obsValue = 0.0; 1092 int lli = 0; 1107 int lli = 0; 1093 1108 int snr = 0; 1094 1109 readDbl(line, pos, 14, obsValue); … … 1154 1169 int numSat; 1155 1170 readInt(line, 29, 3, numSat); 1156 1171 1157 1172 _currEpo.rnxSat.resize(numSat); 1158 1173 … … 1172 1187 int satNum; readInt(line, pos + 1, 2, satNum); 1173 1188 _currEpo.rnxSat[iSat].prn.set(sys, satNum); 1174 1189 1175 1190 pos += 3; 1176 1191 } … … 1206 1221 } 1207 1222 } 1208 1223 1209 1224 _flgPowerFail = false; 1210 1225 1211 1226 return &_currEpo; 1212 1227 } 1213 1228 1214 1229 return 0; 1215 1230 } … … 1226 1241 const t_rnxSat& rnxSat = epo->rnxSat[ii]; 1227 1242 if (_header._obsTypes[rnxSat.prn.system()].size() > 0) { 1228 epoLocal.rnxSat.push_back(rnxSat); 1243 epoLocal.rnxSat.push_back(rnxSat); 1229 1244 } 1230 1245 } … … 1240 1255 // Write Data Epoch (RINEX Version 2) 1241 1256 //////////////////////////////////////////////////////////////////////////// 1242 void t_rnxObsFile::writeEpochV2(QTextStream* stream, const t_rnxObsHeader& header, 1257 void t_rnxObsFile::writeEpochV2(QTextStream* stream, const t_rnxObsHeader& header, 1243 1258 const t_rnxEpo* epo) { 1244 1259 … … 1278 1293 QString typeV2 = header.obsType(sys, iTypeV2); 1279 1294 bool found = false; 1280 1295 1281 1296 QString preferredAttrib = signalPriorities(sys); 1282 1297 for (int iPref = 0; iPref < preferredAttrib.length(); iPref++) { … … 1324 1339 // Write Data Epoch (RINEX Version 3) 1325 1340 //////////////////////////////////////////////////////////////////////////// 1326 void t_rnxObsFile::writeEpochV3(QTextStream* stream, const t_rnxObsHeader& header, 1341 void t_rnxObsFile::writeEpochV3(QTextStream* stream, const t_rnxObsHeader& header, 1327 1342 const t_rnxEpo* epo) { 1328 1343 … … 1431 1446 // Set Observations from RINEX File 1432 1447 //////////////////////////////////////////////////////////////////////////// 1433 void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo, 1448 void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo, 1434 1449 const t_rnxObsFile::t_rnxSat& rnxSat, t_satObs& obs) { 1435 1450 obs._staID = rnxObsFile->markerName().toAscii().constData(); … … 1461 1476 if (rnxObs.value != 0.0) { 1462 1477 string type2ch(typeV3.mid(1).toAscii().data()); 1463 1478 1464 1479 t_frqObs* frqObs = 0; 1465 1480 for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) { … … 1474 1489 obs._obs.push_back(frqObs); 1475 1490 } 1476 1491 1477 1492 switch( typeV3.toAscii().data()[0] ) { 1478 1493 case 'C': -
trunk/BNC/src/rinex/rnxobsfile.h
r6941 r7474 62 62 int numGloSlots() const; 63 63 QString obsType(char sys, int index, double version = 0.0) const; 64 QString usedSystems() const; 65 QStringList obsTypes(char sys) const; 64 66 QStringList phaseShifts() const; 65 67 QStringList gloBiases() const; … … 136 138 t_rnxObsFile(const QString& fileName, e_inpOut inpOut); 137 139 ~t_rnxObsFile(); 138 140 139 141 double version() const {return _header._version;} 140 142 double interval() const {return _header._interval;} … … 177 179 void setStartTime(const bncTime& startTime) {_header._startTime = startTime;} 178 180 179 t_rnxEpo* nextEpoch(); 181 t_rnxEpo* nextEpoch(); 180 182 181 183 int wlFactorL1(unsigned iPrn) { … … 198 200 QTextStream* stream() {return _stream;} 199 201 200 static void setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo, 202 static void setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo, 201 203 const t_rnxObsFile::t_rnxSat& rnxSat, t_satObs& obs); 202 204 203 205 static QString type2to3(char sys, const QString& typeV2); 204 206 static QString type3to2(char sys, const QString& typeV3); 207 static QString signalPriorities(char sys); 205 208 206 209 static void writeEpoch(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo) { … … 216 219 static void writeEpochV2(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo); 217 220 static void writeEpochV3(QTextStream* stream, const t_rnxObsHeader& header, const t_rnxEpo* epo); 218 static QString signalPriorities(char sys);219 221 t_rnxObsFile() {}; 220 222 void openRead(const QString& fileName);
Note:
See TracChangeset
for help on using the changeset viewer.