Changeset 7474 in ntrip for trunk/BNC/src/rinex/reqcedit.cpp


Ignore:
Timestamp:
Sep 29, 2015, 9:29:30 AM (9 years ago)
Author:
stuerze
Message:

in case of RINEX3 to RINEX 2 conversion now some comment lines are written into the RINEX header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcedit.cpp

    r7280 r7474  
    3535 * Created:    11-Apr-2012
    3636 *
    37  * Changes:   
     37 * Changes:
    3838 *
    3939 * -----------------------------------------------------------------------*/
     
    8888}
    8989
    90 // 
     90//
    9191////////////////////////////////////////////////////////////////////////////
    9292void t_reqcEdit::run() {
    93  
     93
    9494  // Open Log File
    9595  // -------------
     
    120120          << _samplingRate << endl;
    121121    *_log << QByteArray("Start time").leftJustified(15) << ": "
    122           << _begTime.datestr().c_str() << ' ' 
     122          << _begTime.datestr().c_str() << ' '
    123123          << _begTime.timestr(0).c_str() << endl;
    124124    *_log << QByteArray("End time").leftJustified(15) << ": "
    125           << _endTime.datestr().c_str() << ' ' 
     125          << _endTime.datestr().c_str() << ' '
    126126          << _endTime.timestr(0).c_str() << endl;
    127127    *_log << QByteArray("Input Obs Files").leftJustified(15) << ": "
     
    159159// Initialize input observation files, sort them according to start time
    160160////////////////////////////////////////////////////////////////////////////
    161 void t_reqcEdit::initRnxObsFiles(const QStringList& obsFileNames, 
     161void t_reqcEdit::initRnxObsFiles(const QStringList& obsFileNames,
    162162                                 QVector<t_rnxObsFile*>& rnxObsFiles,
    163163                                 QTextStream* log) {
     
    172172      QListIterator<QFileInfo> it(dir.entryInfoList(filters));
    173173      while (it.hasNext()) {
    174         QString filePath = it.next().filePath(); 
     174        QString filePath = it.next().filePath();
    175175        t_rnxObsFile* rnxObsFile = 0;
    176176        try {
     
    199199    }
    200200  }
    201   qStableSort(rnxObsFiles.begin(), rnxObsFiles.end(), 
     201  qStableSort(rnxObsFiles.begin(), rnxObsFiles.end(),
    202202              t_rnxObsFile::earlierStartTime);
    203203}
    204204
    205 // 
     205//
    206206////////////////////////////////////////////////////////////////////////////
    207207void t_reqcEdit::editObservations() {
     
    218218  // ----------------------------------
    219219  t_rnxObsFile outObsFile(_outObsFileName, t_rnxObsFile::output);
    220  
     220
    221221  // Select observation types
    222222  // ------------------------
     
    296296    t_rnxObsFile* obsFile = _rnxObsFiles[ii];
    297297    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() << ' '
    300300            << obsFile->startTime().timestr(0).c_str() << endl;
    301301    }
     
    320320        txtMap["COMMENT"]  = comment;
    321321      }
     322      if (int(_rnxVersion) < int(obsFile->header().version())) {
     323        addRnxConversionDetails(obsFile, txtMap);
     324      }
    322325      outObsFile.header().write(outObsFile.stream(), &txtMap);
    323326    }
     
    331334          break;
    332335        }
    333      
    334         if (_samplingRate == 0 || 
     336
     337        if (_samplingRate == 0 ||
    335338            fmod(round(epo->tt.gpssec()), _samplingRate) == 0) {
    336339          applyLLI(obsFile, epo);
     
    347350      }
    348351      else {
    349         qDebug() << str;   
     352        qDebug() << str;
    350353      }
    351354      return;
     
    363366}
    364367
    365 // Change RINEX Header Content 
     368// Change RINEX Header Content
    366369////////////////////////////////////////////////////////////////////////////
    367370void t_reqcEdit::editRnxObsHeader(t_rnxObsFile& obsFile) {
     
    372375  QString newMarkerName   = settings.value("reqcNewMarkerName").toString();
    373376  if (!newMarkerName.isEmpty()) {
    374     if (oldMarkerName.isEmpty() || 
     377    if (oldMarkerName.isEmpty() ||
    375378        QRegExp(oldMarkerName).exactMatch(obsFile.markerName())) {
    376379      obsFile.setMarkerName(newMarkerName);
     
    381384  QString newAntennaName  = settings.value("reqcNewAntennaName").toString();
    382385  if (!newAntennaName.isEmpty()) {
    383     if (oldAntennaName.isEmpty() || 
     386    if (oldAntennaName.isEmpty() ||
    384387        QRegExp(oldAntennaName).exactMatch(obsFile.antennaName())) {
    385388      obsFile.setAntennaName(newAntennaName);
     
    426429  QString newReceiverType = settings.value("reqcNewReceiverName").toString();
    427430  if (!newReceiverType.isEmpty()) {
    428     if (oldReceiverType.isEmpty() || 
     431    if (oldReceiverType.isEmpty() ||
    429432        QRegExp(oldReceiverType).exactMatch(obsFile.receiverType())) {
    430433      obsFile.setReceiverType(newReceiverType);
     
    442445}
    443446
    444 // 
    445 ////////////////////////////////////////////////////////////////////////////
    446 void t_reqcEdit::rememberLLI(const t_rnxObsFile* obsFile, 
     447//
     448////////////////////////////////////////////////////////////////////////////
     449void t_reqcEdit::rememberLLI(const t_rnxObsFile* obsFile,
    447450                             const t_rnxObsFile::t_rnxEpo* epo) {
    448451
     
    467470  }
    468471}
    469  
    470 // 
    471 ////////////////////////////////////////////////////////////////////////////
    472 void t_reqcEdit::applyLLI(const t_rnxObsFile* obsFile, 
     472
     473//
     474////////////////////////////////////////////////////////////////////////////
     475void t_reqcEdit::applyLLI(const t_rnxObsFile* obsFile,
    473476                          t_rnxObsFile::t_rnxEpo* epo) {
    474  
     477
    475478 if (_samplingRate == 0) {
    476479    return;
     
    509512      QListIterator<QFileInfo> it(dir.entryInfoList(filters));
    510513      while (it.hasNext()) {
    511         QString filePath = it.next().filePath(); 
     514        QString filePath = it.next().filePath();
    512515        appendEphemerides(filePath, ephs);
    513516      }
     
    520523}
    521524
    522 // 
     525//
    523526////////////////////////////////////////////////////////////////////////////
    524527void t_reqcEdit::editEphemerides() {
     
    594597}
    595598
    596 // 
     599//
    597600////////////////////////////////////////////////////////////////////////////
    598601void t_reqcEdit::appendEphemerides(const QString& fileName,
     
    633636  }
    634637}
     638
     639void 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}
Note: See TracChangeset for help on using the changeset viewer.