Changeset 6719 in ntrip for trunk/BNC/src/rinex/rnxobsfile.cpp


Ignore:
Timestamp:
Mar 25, 2015, 10:48:43 AM (9 years ago)
Author:
stuerze
Message:

Some mandatory RINEX v3 header lines in observation files are added. That's of interest especially for merging RINEX v3 files. Within RINEX files, which are generated from RTCM streams, these lines are empty because of missing information in RTCM. But as soon this information is available from station logs the respective lines will be filled as well.

File:
1 edited

Legend:

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

    r6704 r6719  
    213213      _startTime.set(year, month, day, hour, min, sec);
    214214    }
     215    else if (key == "SYS / PHASE SHIFT"){
     216      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
     217      char sys;
     218      QString obstype;
     219      double shift;
     220      in >> sys >> obstype >> shift;
     221      if (obstype.size())
     222        _phaseShifts.insert(sys, QPair<QString, double>(obstype, shift));
     223    }
     224    else if (key == "GLONASS COD/PHS/BIS"){
     225      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
     226      for (int ii = 0; ii < 4; ii++) {
     227        QString type;
     228        double  value;
     229        in >> type >> value;
     230        if (type.size())
     231          _gloPhaseBiases[type] = value;
     232      }
     233    }
     234    else if (key == "GLONASS SLOT / FRQ #") {
     235      QTextStream* in = new QTextStream(value.toAscii(), QIODevice::ReadOnly);
     236      int nSlots = 0;
     237      *in >> nSlots;
     238      for (int ii = 0; ii < nSlots; ii++) {
     239        if (ii > 0 && ii % 8 == 0) {
     240          line = stream->readLine(); ++numLines;
     241          delete in;
     242          in = new QTextStream(line.left(60).toAscii(), QIODevice::ReadOnly);
     243        }
     244        QString sat;
     245        int    slot;
     246        *in >> sat >> slot;
     247        t_prn prn;
     248        prn.set(sat.toStdString());
     249        if(sat.size())
     250          _gloSlots[prn] = slot;
     251      }
     252      delete in;
     253    }
    215254    if (maxLines > 0 && numLines == maxLines) {
    216255      break;
     
    218257  }
    219258
    220   // set default observation types if empty in skl file
    221   // --------------------------------------------------
     259  // set default observation types if empty in input file
     260  // ----------------------------------------------------
    222261  if (_obsTypes.empty()) {
    223262    setDefault(_markerName, _version);
     
    313352  _comments        = header._comments;
    314353  _usedSystems     = header._usedSystems;
    315 
     354  if (_version >= 3.0) {
     355    _phaseShifts   = header._phaseShifts;
     356    _gloPhaseBiases = header._gloPhaseBiases;
     357    _gloSlots       = header._gloSlots;
     358  }
    316359  for (unsigned iPrn = 1; iPrn <= t_prn::MAXPRN_GPS; iPrn++) {
    317360    _wlFactorsL1[iPrn] =  header._wlFactorsL1[iPrn];
     
    515558    .leftJustified(60)
    516559           << "TIME OF FIRST OBS\n";
     560
     561  if (_version >= 3.0) {
     562    if (_phaseShifts.empty()) {
     563      QString sys = _usedSystems;
     564      for (int ii = 0; ii < sys.size(); ii++) {
     565        *stream << QString("%1")
     566          .arg(sys[ii], 0)
     567          .leftJustified(60)
     568           << "SYS / PHASE SHIFT\n";
     569      }
     570    } else {
     571      QMultiHash<char, QPair<QString, double> >::const_iterator it = _phaseShifts.begin();
     572      while(it != _phaseShifts.end()) {
     573        *stream << QString("%1%2%3")
     574          .arg(it.key(), 0)
     575          .arg(it.value().first, 4)
     576          .arg(it.value().second, 9, 'f', 5)
     577          .leftJustified(60)
     578           << "SYS / PHASE SHIFT\n";
     579        it++;
     580      }
     581    }
     582  }
     583
     584  if (_version >= 3.0) {
     585    QString hlp = "";
     586    QMap<QString, double>::const_iterator it = _gloPhaseBiases.begin();
     587    while (it != _gloPhaseBiases.end()){
     588      hlp += QString("%1%2").arg(it.key(), 4).arg(it.value(), 9, 'f', 3);
     589      it++;
     590    }
     591    *stream << QString("%1")
     592      .arg(hlp, 0)
     593      .leftJustified(60)
     594           << "GLONASS COD/PHS/BIS\n";
     595  }
     596
     597  if (_version >= 3.0) {
     598    QString number = QString::number(_gloSlots.size());
     599    QString hlp = "";
     600    int ii = 0;
     601    QMap<t_prn, int>::const_iterator it = _gloSlots.begin();
     602    while (it != _gloSlots.end()) {
     603      QString prn(it.key().toString().c_str());
     604      hlp +=  QString("%1%2").arg(prn, 4).arg(it.value(), 3);
     605      it++;
     606      ii++;
     607      if (ii % 8 == 0) {
     608        *stream << QString("%1%2")
     609          .arg(number, 3)
     610          .arg(hlp, 0)
     611          .leftJustified(60)
     612           << "GLONASS SLOT / FRQ #\n";
     613        ii = 0;
     614        hlp = number = "";
     615      }
     616    }
     617    if (hlp.size() || !_gloSlots.size()) {
     618      *stream << QString("%1%2")
     619            .arg(number, 3)
     620            .arg(hlp, 0)
     621            .leftJustified(60)
     622            << "GLONASS SLOT / FRQ #\n";
     623    }
     624  }
     625
    517626
    518627  *stream << QString()
Note: See TracChangeset for help on using the changeset viewer.