28 #include <QtCore/QDataStream>
29 #include <QtCore/QDir>
30 #include <QtCore/QFile>
31 #include <QtCore/QRegExp>
32 #include <QtCore/QRegularExpression>
33 #include <QtCore/QStringList>
34 #include <QtCore/QTextStream>
62 return "SgCableCalReading";
80 return "SgMeteoReading";
98 return "SgTraklReading";
117 return "SgTsysReading";
125 for (QMap<QString, float>::const_iterator it=
tsys.begin(); it!=
tsys.end(); ++it)
126 tsys_.insert(it.key(), it.value());
134 for (QMap<QString, QVector<int> >::const_iterator it=
tpcont.begin(); it!=
tpcont.end(); ++it)
135 tpcont_.insert(it.key(), it.value());
153 return "SgPcalReading";
171 return "SgSefdReading";
178 const QString& chanKey,
const QVector<double>& val)
192 "::addValByChanKey(): source name has changed: old: \"" +
srcName_ +
"\", new: \"" +
195 if (-1000<
az_ && az !=
az_)
199 "::addValByChanKey(): azimuth has changed: old: \"" + QString(
"").setNum(
az_) +
", new: " +
202 if (-1000<
el_ && el !=
el_)
206 "::addValByChanKey(): elevation has changed: old: \"" + QString(
"").setNum(
el_) +
", new: " +
209 QVector<double> *v =
new QVector<double>(val);
215 "::addValByChanKey(): the channel key \"" + chanKey +
"\" is already in the map");
242 return "SgOnSourceRecord";
261 return "SgChannelSetup";
287 skyFrq = loFreq + bbcFreq - width;
289 skyFrq = loFreq - bbcFreq - width;
291 skyFrq = loFreq + bbcFreq;
293 skyFrq = loFreq - bbcFreq;
297 return skyFrq + width/2.0;
367 QString sensorKey=it.key();
368 QString sensorId(
"");
374 "::selfCheck(): VGOS setup: cannot find sensor ID for key \"" +
375 sensorKey +
"\" for station \"" + stnKey +
"\"");
385 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
386 "the map bbcFreqByIdx is empty");
392 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
393 "the map bbcBandwidthByIdx is empty");
399 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
400 "the maps loIdByIdx/loIdByCid are empty");
406 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
407 "the map loFreqById is empty");
413 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
414 "the map loSideBandById is empty");
420 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
421 "the map loPolarizationById is empty");
427 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
428 "the map ifIdxById is empty");
434 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
435 "the map ifSideBandById is empty");
440 QString ifId(it.key());
455 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
456 "cannot find side band for LO \"" + loId +
"\"");
463 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
464 "cannot find side band for channel #" + QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
472 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
473 "cannot find polarization for LO \"" + loId +
"\"");
481 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
482 "cannot find bandwidth for channel #" + QString(
"").setNum(cIdx) +
", ID=" + ifId);
489 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
490 "cannot find BBC_FRQ for channel #" + QString(
"").setNum(cIdx));
496 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
497 "cannot find LO frq for channel #" + QString(
"").setNum(cIdx) +
", loID=" + loId);
504 "::selfCheck(): the channel setup for station \"" + stnKey +
"\" is not usable: "
505 "cannot find LO ID for channel #" + QString(
"").setNum(cIdx) +
" with id \"" + ifId +
"\"");
531 return "SgChannelSkeded";
542 "::parseSkdFile(): going to parse \"" + f.fileName() +
"\" sked file");
547 "::parseSkdFile(): the file " + f.fileName() +
" does not exists");
548 return (
isOk_=
false);
551 if (f.open(QFile::ReadOnly))
556 QRegExp reCodes(
"^\\$CODES", Qt::CaseInsensitive);
557 QRegExp reFrec(
"^F\\s+(\\S+)\\s+(\\S+)\\s+(.+)$", Qt::CaseInsensitive);
559 QRegExp reCrec(
"^C\\s+(\\w+)\\s+(\\w+)\\s+(.+)$", Qt::CaseInsensitive);
560 QRegExp reSb(
"\\w*\\s*\\(([-+0-9,]+)\\).*", Qt::CaseInsensitive);
561 bool getCodesRec=
false;
567 bool hasUsb, hasLsb, hasBothBands;
570 while (!s.atEnd() && !haveDone)
575 if (str.size() && str.at(0)==
"*")
578 else if (reCodes.indexIn(str) != -1)
580 else if (getCodesRec)
582 if (reFrec.indexIn(str) != -1)
585 lst = reFrec.cap(3).split(
" ", QString::SkipEmptyParts);
586 for (
int i=0; i<lst.size(); i++)
587 stations << lst.at(i).leftJustified(8,
' ');
588 if (!stations.size())
590 "::parseSkdFile(): got \"F\" record without stations: \"" + str +
"\"");
593 for (
int i=0; i<stations.size(); i++)
595 const QString& key=stations.at(i);
599 "::parseSkdFile(): got " + QString(
"").setNum(stations.size()) +
" stations from F record");
602 else if (reCrec.indexIn(str) != -1)
605 lst = reCrec.cap(0).split(
" ", QString::SkipEmptyParts);
611 frq = lst.at(3).toDouble(&
isOk);
616 "::parseSkdFile(): cannot get sky frequency from C record \"" + str +
"\"");
619 cIdx = lst.at(5).toDouble(&
isOk);
624 "::parseSkdFile(): cannot get channel index from C record \"" + str +
"\"");
627 width = lst.at(7).toDouble(&
isOk);
632 "::parseSkdFile(): cannot get channel width from C record \"" + str +
"\"");
635 hasUsb = hasLsb = hasBothBands =
false;
637 if (reSb.indexIn(lst.at(8)) != -1)
639 lst = reSb.cap(1).split(
",", QString::KeepEmptyParts);
642 "::parseSkdFile(): nothing to parse side band set up: \"" + str +
"\"");
645 if (lst.at(0).size())
650 if (1 < lst.size() && lst.at(1).size())
655 if (2 < lst.size() && lst.at(2).size())
660 if (3 < lst.size() && lst.at(3).size())
665 hasBothBands = hasUsb && hasLsb;
670 "::parseSkdFile(): cannot get parse side band set up: \"" + str +
"\"");
675 ChanCfg cc(bandKey, cIdx, frq - width, width, sideBands);
676 for (
int i=0; i<stations.size(); i++)
679 ChanCfg cc(bandKey, cIdx, frq, width, sideBands);
680 for (
int i=0; i<stations.size(); i++)
695 "::parseSkdFile(): nothing has found in the sked file \"" + f.fileName() +
"\"");
703 const StnCfg& cfg=it.value();
708 "::parseSkdFile(): the sked file \"" + f.fileName() +
709 "\" is not usable: station name is missing");
715 "::parseSkdFile(): the sked file \"" + f.fileName() +
"\" is not usable for " + it.key() +
716 ": no channels setup");
727 "::parseSkdFile(): the sked file \"" + f.fileName() +
"\" is not usable for " + it.key() +
728 ": bad channel index for chan#" + QString(
"").setNum(i));
734 "::parseSkdFile(): the sked file \"" + f.fileName() +
"\" is not usable for " + it.key() +
735 ": bad band key for chan#" + QString(
"").setNum(i));
741 "::parseSkdFile(): the sked file \"" + f.fileName() +
"\" is not usable for " + it.key() +
742 ": bad sky frequency for chan#" + QString(
"").setNum(i));
748 "::parseSkdFile(): the sked file \"" + f.fileName() +
"\" is not usable for " + it.key() +
749 ": bad bandwidth for chan#" + QString(
"").setNum(i));
755 "::parseSkdFile(): the sked file \"" + f.fileName() +
"\" is not usable for " + it.key() +
756 ": no sideband setup for chan#" + QString(
"").setNum(i));
783 return "SgStnLogReadings";
818 stationName_(stationName),
854 for (
int i=0; i<
tSyses_.size(); i++)
858 for (
int i=0; i<
trakls_.size(); i++)
860 for (
int i=0; i<
pcals_.size(); i++)
914 for (
int i=0; i<
tSyses_.size(); i++)
924 const QMap<QString, int> *defaultCableSignByStn)
928 SgMJD tLeftMarging, tRightMarging;
937 "::verifyReadings(): the station " +
stationName_ +
" has no any observations; skipped");
944 tLeftMarging = tFirst - 1.0/24.0;
945 tRightMarging = tLast + 1.0/24.0;
990 "::verifyReadings(): station " +
stationName_ +
": got the duplicate scan \"" +
1000 " scan " + osRec->
getScanName() +
", it's already in the map, nr(c/m)=" +
1001 QString(
"").setNum(osRec->
cableCals().size()) +
"/" +
1002 QString(
"").setNum(osRec->
meteoPars().size()));
1009 QString(
"").setNum(osRec->
cableCals().size()) +
"/" +
1010 QString(
"").setNum(osRec->
meteoPars().size()));
1028 "::verifyReadings(): station " +
stationName_ +
": insufficient number (" +
1029 QString(
"").setNum(inRangePts) +
") of meteo parameters; skipped");
1046 "::verifyReadings(): station " +
stationName_ +
": insufficient number (" +
1047 QString(
"").setNum(inRangePts) +
") of cable calibrations; skipped");
1054 for (
int i=0; i<
tSyses_.size(); i++)
1055 if (tFirst<=
tSyses_.at(i)->getT() &&
tSyses_.at(i)->getT()<=tLast)
1064 "::verifyReadings(): station " +
stationName_ +
": insufficient number (" +
1065 QString(
"").setNum(inRangePts) +
") of tsys readings; skipped");
1078 ": cannot determine the cable sign from cablelong measurements");
1079 else if (!hasCableSign)
1083 "::verifyReadings(): station " +
stationName_ +
": the cable sign has been set to \"" +
1084 (
cableSign_>0?
"+":
"-") +
"\" according to cablelong measurements");
1085 hasCableSign =
true;
1091 ": the found cable sign is different from the cablelong measurements: \"" +
1092 (
cableSign_>0?
"+":
"-") +
"\" vs \"" + (signCableLong>0?
"+":
"-") +
1093 "\"; the sign has been reverted");
1099 ": the cable sign has been confirmed by cablelong measurements");
1104 ": cannot find any usable cablelong measurements");
1110 "::verifyReadings(): station " +
stationName_ +
": cannot find any usable meteo readings");
1113 "::verifyReadings(): station " +
stationName_ +
": cannot find any usable cable calibrations");
1118 "::verifyReadings(): station " +
stationName_ +
": cannot determine the cable calibration sign");
1122 if (defaultCableSignByStn)
1129 ": the cable sign was set to \"" + QString(
cableSign_==1?
"+":
"-") +
1130 "\" according to the list of default cable signs");
1136 "::verifyReadings(): no default cable cal list were provided");
1150 const QMap<QString, SgVlbiAuxObservation*> &auxObservationByScan)
1156 ": unable to lookup the scan name: no source name provided,");
1158 "::lookupScanName(): station " +
stationName_ +
": the on_data record is: " +
1164 double tLimit=15.0/60.0/24.0;
1168 SgMJD tClosest=*auxClosest;
1170 dT = fabs(tClosest - t);
1171 for (QMap<QString, SgVlbiAuxObservation*>::const_iterator it=auxObservationByScan.begin();
1172 it!=auxObservationByScan.end(); ++it)
1174 SgMJD &ti=*it.value();
1175 if ( (fabs(ti-t)<dT) && it.value()->getOwner()->src()->getKey().contains(osRec->
getSourceName()))
1179 auxClosest = it.value();
1183 if (auxClosest && dT<=tLimit)
1197 ": no scan name was assigned to the on_data record: [" +
1209 double window=10.0/60.0/24.0;
1217 if (fabs(
cableCals_.at(j)->getT() - tL) < window)
1220 if (selectedReadings.size())
1222 double vAverage, ratio;
1224 "::determineCableSignFromLong(): collected " + QString(
"").setNum(selectedReadings.size()) +
1225 " close cable readings for cablelong measurement on " + tL.
toString());
1228 for (
int j=0; j<selectedReadings.size(); j++)
1229 vAverage += selectedReadings.at(j)->getV();
1230 vAverage /= selectedReadings.size();
1232 ratio = (clV - vAverage)/vAverage;
1235 else if (ratio < -1.0e-3 )
1239 signByCablelong << cableSign;
1241 "::determineCableSignFromLong(): average cable cal: " + QString(
"").setNum(vAverage*1.0e9) +
1242 "ns, cablelong: " + QString(
"").setNum(clV*1.0e9) +
1243 "ns; the sign is \"" + QString(cableSign==0?
"?":(cableSign<0?
"-":
"+")) +
"\"");
1244 selectedReadings.clear();
1248 "::determineCableSignFromLong(): no close cable readings found for cablelong measurement on " +
1252 if (signByCablelong.size() == 0)
1254 else if (signByCablelong.size() == 1)
1255 cableSign = signByCablelong.at(0);
1258 QMap<int, int> signByNum;
1259 for (
int i=0; i<signByCablelong.size(); i++)
1261 if (signByNum.contains(signByCablelong.at(i)))
1262 signByNum[signByCablelong.at(i)]++;
1264 signByNum[signByCablelong.at(i)] = 1;
1266 if (signByNum.size() == 1)
1268 cableSign = signByNum.begin().key();
1270 "::determineCableSignFromLong(): according to all " +
1271 QString(
"").setNum(signByCablelong.size()) +
" cablelong measurements, the sign is \"" +
1272 QString(cableSign==0?
"?":(cableSign<0?
"-":
"+")) +
"\"");
1278 "::determineCableSignFromLong(): cannot determine the proper sign, the "
1279 "numbers of measuremnts are:");
1280 for (QMap<int, int>::iterator it=signByNum.begin(); it!=signByNum.end(); ++it)
1282 "::determineCableSignFromLong(): " +
1283 QString(
"").sprintf(
"sign \"%s\": %2d count(s)", it.key()==0?
"?":(it.key()<0?
"-":
"+"),
1287 signByCablelong.clear();
1300 int numOfResolvedAmbigs=0;
1301 int numOfOutliers=0;
1302 bool allReadingsRsame;
1312 numOfResolvedAmbigs++;
1314 vAverage = vAverage*i/(i + 1) + rec->
getV()/(i+1);
1316 if (numOfResolvedAmbigs)
1318 "::cleanCableCalibrations() station " +
stationName_ +
": " +
1319 QString(
"").setNum(numOfResolvedAmbigs) +
" ambiguit" + (numOfResolvedAmbigs==1?
"y":
"ies") +
1320 " resolved in the cable cal readings");
1329 allReadingsRsame =
true;
1334 if (allReadingsRsame &&
cableCals_.at(i)->getV()!=vTmp)
1335 allReadingsRsame =
false;
1337 if (!allReadingsRsame)
1341 vDispersion -= vAverage*vAverage;
1342 if (vDispersion < 0.0)
1345 "::cleanCableCalibrations(): station " +
stationName_ +
": dispersion^2<0.0 (" +
1346 QString(
"").sprintf(
"%.16g", vDispersion) +
")");
1347 vDispersion = -vDispersion;
1349 if (vDispersion > 0.0)
1351 vDispersion = sqrt(vDispersion);
1353 if (fabs(
cableCals_.at(i)->getV()-vAverage) > 5.0*vDispersion)
1368 while (j < cl.size())
1369 if (!cl.at(j)->getIsOk())
1385 "::cleanCableCalibrations(): station " +
stationName_ +
": " +
1386 QString(
"").setNum(numOfOutliers) +
" outlier" +
1387 QString(numOfOutliers==1?
" has ":
"s have ") +
"been removed",
true);
1399 "::cleanCableCalibrations(): station " +
stationName_ +
": subtracted the average value of " +
1400 QString(
"").setNum(vAverage*1.0e9) +
"ns from the cable cal readings");
1409 QMap<QString, SgMeteoReading*>
1412 double d, dt, extrRmin=0.0, extrRmax=1.0;
1413 int nExtr4Rmin=0, nExtr4Rmax=0, numOfDuples=0, numOfSameEpochs=0;
1423 if (mpByEpoch.contains(str))
1428 "::cleanMeteoParameters(): station " +
stationName_ +
": got duplicate weather record at " +
1435 stationName_ +
": got two different records at the same epoch " +
1447 "::cleanMeteoParameters(): station " +
stationName_ +
": " + QString(
"").setNum(numOfDuples) +
1448 " duplicate meteo records found");
1449 if (numOfSameEpochs)
1451 "::cleanMeteoParameters(): station " +
stationName_ +
": " + QString(
"").setNum(numOfSameEpochs) +
1452 " records with the same epoch and different values found");
1464 "::cleanMeteoParameters(): station " +
stationName_ +
": too small number of meteo records (" +
1465 QString(
"").setNum(
meteoPars_.size()) +
"), nothing to do");
1471 SgVector dP(nPars), dT(nPars), dR(nPars);
1473 for (
int i=1; i<nPars; i++)
1481 dP.setElement(i, d/dt);
1485 dT.setElement(i, d/dt);
1487 d =
meteoPars_.at(i)->getM().getRelativeHumidity() -
meteoPars_.at(i-1)->getM().getRelativeHumidity();
1492 if (fabs(
meteoPars_.at(i)->getM().getRelativeHumidity() - extrRmin) < 1.0e-6)
1494 if (fabs(
meteoPars_.at(i)->getM().getRelativeHumidity() - extrRmax) < 1.0e-6)
1500 double mrP, mrT, mrR;
1501 int n4P=0, n4T=0, n4R=0;
1502 bool isOkP=
true, isOkT=
true, isOkR=
true, hasSuspiciousExtrems4R=
false;
1507 for (
int i=1; i<nPars; i++)
1509 if (mrP < fabs(dP.getElement(i)))
1513 " has too big pressure rate, " + QString(
"").setNum(dP.getElement(i)/24.0) +
1514 "(mbar/hr) at the idx " + QString(
"").setNum(i));
1517 if (mrT < fabs(dT.getElement(i)))
1521 " has too big atm.temperature rate, " + QString(
"").setNum(dT.getElement(i)/24.0) +
1522 "(C/hr) at the idx " + QString(
"").setNum(i));
1529 " has too big rel.humidity rate, " + QString(
"").setNum(100.0*dR.
getElement(i)/24.0) +
1530 "(%/hr) at the idx " + QString(
"").setNum(i));
1532 "::cleanMeteoParameters(): station " +
stationName_ +
": i-1: " +
1534 QString(
"").sprintf(
"%.4f",
meteoPars_.at(i-1)->getM().getRelativeHumidity()) +
1536 QString(
"").sprintf(
"%.4f",
meteoPars_.at(i)->getM().getRelativeHumidity()));
1545 "::cleanMeteoParameters(): station " +
stationName_ +
" has more than 10 (" +
1546 QString(
"").setNum(n4P) +
") suspicious big pressure rates, use standard pressure instead");
1552 "::cleanMeteoParameters(): station " +
stationName_ +
" has more than 10 (" +
1553 QString(
"").setNum(n4T) +
1554 ") suspicious big atm.temperature rates, use default temperature instead");
1560 "::cleanMeteoParameters(): station " +
stationName_ +
" has more than 10 (" +
1561 QString(
"").setNum(n4R) +
1562 ") suspicious big rel.humidity rates, use default humidity instead");
1564 if (8 < nExtr4Rmin && 8 < nExtr4Rmax)
1567 "::cleanMeteoParameters(): station " +
stationName_ +
" has too much extremal values (" +
1568 QString(
"").setNum(nExtr4Rmin) +
"/" + QString(
"").setNum(nExtr4Rmax) +
1569 ") for rel.humidity, use default humidity instead");
1570 hasSuspiciousExtrems4R =
true;
1575 if (!isOkP || !isOkT || !isOkR || hasSuspiciousExtrems4R)
1585 if (!isOkR || hasSuspiciousExtrems4R)
1592 "::cleanMeteoParameters(): station " +
stationName_ +
": the meteoparameters have been ordered");
1610 " is too far from the first available meteo reading (" +
meteoPars_.at(idx_r)->getT().toString() +
1611 "), no extrapolation");
1619 " is too far from the last available meteo reading (" +
meteoPars_.at(idx_l)->getT().toString() +
1620 "), no extrapolation");
1633 while (t<
meteoPars_.at(idx_l)->getT() && 0<idx_l)
1642 double dt, dPr, dTp, dRh, x;
1645 dPr =
meteoPars_.at(idx_r)->getM().getPressure() -
1647 dTp =
meteoPars_.at(idx_r)->getM().getTemperature() -
1648 meteoPars_.at(idx_l)->getM().getTemperature();
1649 dRh =
meteoPars_.at(idx_r)->getM().getRelativeHumidity() -
1650 meteoPars_.at(idx_l)->getM().getRelativeHumidity();
1662 QRegExp reBrokenScanName(
"([a-zA-Z0-9+-]+)_.+", Qt::CaseInsensitive);
1663 bool isScanNameSuspicious;
1665 int numOfExactMatches, numOfMultExactMatches, numOfClosestMatches, cSign;
1666 int numOfChannels, chanIdx, ccIdx;
1667 bool hasMeteoOk, hasCableOk, hasTsysOk;
1670 numOfExactMatches = numOfMultExactMatches = numOfClosestMatches = 0;
1671 hasMeteoOk = hasCableOk = hasTsysOk =
false;
1672 static const QString sideBand2str[] = {
"UNDEF",
"LSB",
"USB",
"DUAL"};
1673 static const QString polarization2str[] = {
"UNDEF",
"RCP",
"LCP",
"HLP",
"VLP"};
1698 QString scanNameAux(
"");
1700 QString surrogateScanName(
"");
1717 for (
int i=0; i<numOfChannels; i++)
1721 isScanNameSuspicious = reBrokenScanName.indexIn(scanName) != -1;
1722 if (isScanNameSuspicious)
1723 scanNameAux = reBrokenScanName.cap(1).toLower();
1724 if (scanName.size()==9 && scanName.at(8).isLetter())
1725 surrogateScanName = scanName.left(8);
1728 if (!
recordByScan_.contains(scanName) && !isScanNameSuspicious)
1732 "::propagateData(): station " +
stationName_ +
": cannot find the scan \"" + scanName +
1733 "\" in the log file");
1735 else if (isScanNameSuspicious && !
recordByScan_.contains(scanNameAux))
1739 "::propagateData(): station " +
stationName_ +
": cannot find the suspicious scan \"" +
1740 scanNameAux +
"\"' in the log file");
1742 else if (surrogateScanName.size() &&
1748 "::propagateData(): station " +
stationName_ +
": cannot find the surrogate scan \"" +
1749 scanNameAux +
"\"' in the CDMS file");
1754 if (!osRec && isScanNameSuspicious)
1756 else if (!osRec && surrogateScanName.size())
1768 numOfExactMatches++;
1774 ": no cable cal record found for the scan \"" + scanName +
"\" in the log file");
1775 numOfClosestMatches++;
1788 numOfMultExactMatches++;
1791 if (osRec->
getSourceName().leftJustified(8,
' ') != sourceName)
1793 "::propagateData(): source name mismatch: from the log: \"" + osRec->
getSourceName() +
1794 "\", from the obs: \"" + sourceName +
"\"");
1800 if (osRec->
tSyses().size() == 1)
1801 tsr = osRec->
tSyses().last();
1805 dt = fabs(osRec->
tSyses().at(0)->getT() - t);
1806 for (
int i=1; i<osRec->
tSyses().size(); i++)
1807 if ((f=fabs(osRec->
tSyses().at(i)->getT() - t)) < dt)
1812 tsr = osRec->
tSyses().at(idx);
1819 if (tsr->
getTsys().contains(jt.value()))
1823 1 < osRec->
tSyses().size())
1826 ": the OnSource record has more than one (" +
1827 QString(
"").setNum(osRec->
tSyses().size()) +
") TSYS record for the scan \"" +
1833 "::propagateData(): the OnSource record is NULL: the station= " +
stationName_ +
1834 ", the scan= \"" + scanName +
"\"");
1846 if (idx4Cable == -1)
1848 dt = fabs(cables->at((idx4Cable=0))->getT() - t);
1849 for (
int i=1; i<cables->size(); i++)
1850 if ((f=fabs(cables->at(i)->getT() - t)) < dt)
1875 "::propagateData(): station " +
stationName_ +
": " + QString(
"").setNum(numOfExactMatches) +
1876 " exact " + (numOfMultExactMatches?(
"(" + QString(
"").setNum(numOfMultExactMatches) +
1877 (numOfMultExactMatches==1?
" is ":
" are ") +
"multiple) "):
"") +
1878 (numOfClosestMatches?
"and " + QString(
"").setNum(numOfClosestMatches) +
" closest ":
"") +
1879 "matches of cable calibrations were found");
1886 "::propagateData(): station " +
stationName_ +
": meteo parameters were found");
1901 const QString &
id=jt.value();
1902 const QString &sensorKey=jt.key();
1915 "::propagateData(): station " +
stationName_ +
": tsys data were found");
1921 return hasMeteoOk || hasCableOk || hasTsysOk;
1944 "::allocateCableReadings(): station " +
stationName_ +
": " + QString(
"").setNum(allocatedNum) +
1945 " cable cal readings were linked to on data records");
1958 s <<
"# Sensor# IF_Freq LO_Freq Sky_freq Pol SensorId Channel# SideBand\n#\n";
1966 QString ifKey(it.key());
1967 QString ifId(it.value());
1973 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
1974 ": cannot find IF index for if with the id \"" + ifId +
"\"");
1986 double ifFrq, loFrq, skyFrq, bw;
1987 ifFrq = loFrq = skyFrq = bw = 0.0;
2000 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find side band for LO \"" +
2008 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find side band for channel #" +
2009 QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
2016 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find polarization for LO \"" +
2024 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find bandwidth for channel #" +
2025 QString(
"").setNum(cIdx) +
", ID=" + ifId);
2044 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find BBC_FRQ for channel #" +
2045 QString(
"").setNum(cIdx));
2051 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find LO frq for channel #" +
2052 QString(
"").setNum(cIdx) +
", loID=" + loId);
2054 skyFrq = loFrq + ifFrq;
2058 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
": cannot find LO ID for channel #" +
2059 QString(
"").setNum(cIdx));
2064 str.sprintf(
"FRQ: %7d %11.2f %11.2f %11.2f",
2065 idx, ifFrq, loFrq, skyFrq);
2074 str.sprintf(
" %6s ", qPrintable(ifId));
2076 str.sprintf(
"%6d", cIdx);
2102 s <<
"# Sensor# IF_Freq LO_Freq Sky_freq Pol SensorId Channel# SideBand\n#\n";
2108 QString ifKey(it.key());
2109 QString ifId(it.value());
2116 "::export2antabFrqs_vgosSetup(): station " +
stationName_ +
2117 ": cannot find IF index for if with the id \"" + ifId +
"\"");
2125 double skyFrq, loFrq=-1.0;
2133 "::export2antabFrqs_vgosSetup(): station " +
stationName_ +
2134 ": cannot find side band for channel #" + QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
2149 "::export2antabFrqs_vgosSetup(): station " +
stationName_ +
2150 ": cannot find LO frq for channel #" + QString(
"").setNum(cIdx) +
", loID=\"" + loId +
"\"");
2158 "::export2antabFrqs_vgosSetup(): station " +
stationName_ +
2159 ": cannot find polarization for LO \"" + ifId +
"\"");
2163 str.sprintf(
"FRQ: %7d %11.2f %11.2f %11.2f ",
2164 idx, -1.0, loFrq, skyFrq);
2178 str.sprintf(
" %6s %6d ", qPrintable(ifId), cIdx);
2204 "::export2antabFrqs_skededSetup(): station " +
stationName_ +
2205 ": number of channels are different");
2210 s <<
"# Sensor# IF_Freq LO_Freq Sky_freq Pol SensorId Channel# SideBand\n#\n";
2217 QString ifKey(it.key());
2218 QString ifId(it.value());
2224 "::export2antabFrqs_nativeSetup(): station " +
stationName_ +
2225 ": cannot find IF index for if with the id \"" + ifId +
"\"");
2239 "::export2antabFrqs_skededSetup(): station " +
stationName_ +
": cannot find side band for channel #" +
2240 QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
2247 str.sprintf(
"FRQ: %7d %11.2f %11.2f %11.2f",
2248 idx, -1.0, -1.0, skyFrq);
2252 str.sprintf(
" %6s ", qPrintable(ifId));
2254 str.sprintf(
"%6d", cIdx);
2279 s <<
"# Sensor# IF_Freq LO_Freq Sky_freq Pol SensorId Channel# SideBand\n#\n";
2286 QString ifKey(it.key());
2287 QString ifId(it.value());
2293 "::export2antabFrqs_missedSetup(): station " +
stationName_ +
2294 ": cannot find IF index for if with the id \"" + ifId +
"\"");
2307 "::export2antabFrqs_missedSetup(): station " +
stationName_ +
2308 ": cannot find side band for channel #" + QString(
"").setNum(cIdx) +
2309 ", ID: \"" + ifId +
"\"");
2315 str.sprintf(
"FRQ: %7d %11.2f %11.2f %11.2f",
2316 idx, -1.0, -1.0, -1.0);
2319 str.sprintf(
" %6s ", qPrintable(ifId));
2321 str.sprintf(
"%6d", cIdx);
2344 QMap<int, double> frqByIdx_Fsl, frqByIdx_Skd;
2345 QMap<int, double> bwByIdx_Fsl, bwByIdx_Skd;
2346 int numOfChansAtSked, numOfChansAtLog;
2348 numOfChansAtSked = numOfChansAtLog = 0;
2356 frqByIdx_Skd[i] = skyFrq;
2357 bwByIdx_Skd[i] = bw;
2366 int cIdx=it.value();
2367 QString ifId(it.key());
2371 double ifFrq, loFrq, skyFrq, bw;
2372 ifFrq = loFrq = skyFrq = bw = 0.0;
2388 "::compareChannelSetups(): station " +
stationName_ +
": cannot find side band for LO \"" +
2396 "::compareChannelSetups(): station " +
stationName_ +
": cannot find side band for channel #" +
2397 QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
2404 "::compareChannelSetups(): station " +
stationName_ +
": cannot find bandwidth for channel #" +
2405 QString(
"").setNum(cIdx) +
", ID=" + ifId);
2426 "::compareChannelSetups(): station " +
stationName_ +
": cannot find BBC_FRQ for channel #" +
2427 QString(
"").setNum(cIdx));
2433 "::compareChannelSetups(): station " +
stationName_ +
": cannot find LO frq for channel #" +
2434 QString(
"").setNum(cIdx) +
", loID=" + loId);
2436 skyFrq = loFrq + ifFrq;
2440 "::compareChannelSetups(): station " +
stationName_ +
": cannot find LO ID for channel #" +
2441 QString(
"").setNum(cIdx));
2446 frqByIdx_Fsl[idx] = skyFrq - bw;
2447 bwByIdx_Fsl[idx] = bw;
2451 frqByIdx_Fsl[idx] = skyFrq;
2452 bwByIdx_Fsl[idx] = bw;
2457 if (frqByIdx_Fsl.size() != frqByIdx_Skd.size())
2461 "::compareChannelSetups(): station " +
stationName_ +
": the number of channels are different, " +
2462 QString(
"").sprintf(
"%d (log) vs %d (sked)", frqByIdx_Fsl.size(), frqByIdx_Skd.size()));
2468 QMap<double, int> idxByFrq_Fsl, idxByFrq_Skd;
2469 for (QMap<int, double>::iterator it=frqByIdx_Fsl.begin(); it!=frqByIdx_Fsl.end(); ++it, idx++)
2470 idxByFrq_Fsl[it.value()] = it.key();
2471 for (QMap<int, double>::iterator it=frqByIdx_Skd.begin(); it!=frqByIdx_Skd.end(); ++it, idx++)
2472 idxByFrq_Skd[it.value()] = it.key();
2477 for (
int i=0; i<d_Fsl.size(); i++)
2479 double frqFsl=d_Fsl.at(i), frqSkd=d_Skd.at(i);
2480 if (1.0e-4 < fabs(frqSkd - frqFsl))
2485 ": the sky frequency for the channel #" +
2486 QString(
"").setNum(i) +
" is different: " +
2487 QString(
"").sprintf(
"%.4f (log) vs %.4f (sked)", frqFsl, frqSkd));
2491 d_Fsl = bwByIdx_Fsl.values();
2492 d_Skd = bwByIdx_Skd.values();
2493 for (
int i=0; i<d_Fsl.size(); i++)
2495 double bwFsl=d_Fsl.at(i), bwSkd=d_Skd.at(i);
2496 if (1.0e-2 < fabs(bwSkd - bwFsl))
2501 ": the width for the channel #" +
2502 QString(
"").setNum(i) +
" is different: " +
2503 QString(
"").sprintf(
"%.2f (log) vs %.2f (sked)", bwFsl, bwSkd));
2565 int numOfChansAtSked, numOfChansAtLog;
2567 numOfChansAtSked = numOfChansAtLog = 0;
2577 QString ifId(it.key());
2584 "::compareChannelNumbers(): station " +
stationName_ +
": cannot find side band for channel #" +
2585 QString(
"").setNum(it.value()) +
", ID: \"" + ifId +
"\"");
2594 if (numOfChansAtLog != numOfChansAtSked)
2598 "::compareChannelNumbers(): station " +
stationName_ +
": the number of channels are different, " +
2599 QString(
"").sprintf(
"%d (log) vs %d (sked)", numOfChansAtLog, numOfChansAtSked));
2608 const QString& stnKey,
const SgChannelSkeded *channelSkeded,
bool useSkededChannelSetup,
2609 bool have2overwrite,
bool reportAllTsysData)
2611 enum ChannelSetup2Use {CSU_NONE, CSU_NATIVE, CSU_SKED, CSU_VEX, CSU_VGOS};
2614 ChannelSetup2Use setup2use;
2615 setup2use = CSU_NONE;
2617 haveTsys = 0 <
tSyses_.size();
2621 if (!outputFileName.size())
2624 if (5 < inputLogFileName.size() && inputLogFileName.right(4) == QString(
".log"))
2626 str = inputLogFileName.left(inputLogFileName.size() - 4) +
".ant";
2629 str = inputLogFileName +
".ant";
2632 str = outputFileName;
2635 "::createAntabFile(): station " + stnKey +
": " +
2636 " going to create " + f.fileName() +
" LOG-ANTAB file");
2643 "::createAntabFile(): station " + stnKey +
2644 ": the sked's channel setup is missing");
2645 else if (!channelSkeded->
isOk())
2647 "::createAntabFile(): station " + stnKey +
2648 ": the sked's channel setup is not good, skipping it");
2649 else if (!channelSkeded->
stnCfgByKey_.contains(stnKey))
2651 "::createAntabFile(): station " + stnKey +
2652 ": the sked's channel setup does not contain this station, skipping it");
2656 "::createAntabFile(): station " + stnKey +
2657 ": the number of collected channels and number of channels in the sked are different, skipping it");
2662 "::createAntabFile(): station " + stnKey +
2663 ": looks like we have channel setup from sked");
2669 setup2use = CSU_NATIVE;
2671 setup2use = CSU_VGOS;
2673 "::createAntabFile(): station " + stnKey +
2674 ": channel setup from the log file looks ok");
2678 "::createAntabFile(): station " + stnKey +
2679 ": comparing sked's and FS log channel setups");
2683 else if (haveSkeded)
2685 setup2use = CSU_SKED;
2687 "::createAntabFile(): station " + stnKey +
": cannot figure out channel setup from the log "
2688 "file, falling back to the set up from sked file");
2692 setup2use = CSU_NONE;
2694 "::createAntabFile(): station " + stnKey +
": cannot figure out the channel setup");
2697 if (setup2use == CSU_NATIVE && useSkededChannelSetup)
2699 setup2use = CSU_SKED;
2701 "::createAntabFile(): station " + stnKey +
": forced to use the set up from sked file");
2706 "::createAntabFile(): station " + stnKey +
": no TSYS data have found in the log file");
2714 "::createAntabFile(): the file " + f.fileName() +
" already exists; it will be overwritten");
2718 "::createAntabFile(): the file " + f.fileName() +
" already exists, skipping");
2727 if (f.open(QFile::WriteOnly))
2731 s <<
"# LOG-ANTAB Format Version of 2009.08.07\n";
2735 s <<
"# Generated from log file " << qPrintable(inputLogFileName) <<
" on "
2738 s <<
"STATION: " << qPrintable(stnKey) <<
"\n";
2744 s <<
"# Data_on start Data_on end Source Scan\n";
2752 << qPrintable(rec->
getSourceName().leftJustified(8,
' ')) <<
" "
2753 << qPrintable(rec->
getScanName().leftJustified(8,
' ')) <<
"\n";
2758 s <<
"NUMB_CAB: " <<
cableCals_.size() <<
"\n";
2765 s <<
"# Date Cable delay (sec)\n";
2772 << qPrintable(QString(
"").sprintf(
"%12.5E", cc->
getV())) <<
"\n";
2778 s <<
"NUMB_METEO: " <<
meteoPars_.size() <<
"\n";
2783 s <<
"# Date Temp Pres Humid\n";
2790 << qPrintable(QString(
"").sprintf(
"%6.2f %7.1f %4.1f",
2801 if (setup2use == CSU_NATIVE)
2803 else if (setup2use == CSU_VGOS)
2805 else if (setup2use == CSU_SKED && channelSkeded->
stnCfgByKey_.contains(stnKey))
2807 else if (setup2use == CSU_NONE)
2812 s <<
"#No FRQ data available\n";
2818 if (!reportAllTsysData)
2820 s <<
"# Scan Scan_name Src_name UTC_Time_tag ";
2825 s <<
" Ts#" << QString(
"").sprintf(
"%03d", idx);
2831 s <<
"NUMB_TSYS: " << numOfTsyses <<
"\n";
2838 for (
int j=0; j<sOn->
tSyses().size(); j++)
2840 tsr = sOn->
tSyses().at(j);
2841 s << str.sprintf(
"TSYS: %6d ", counter);
2842 str = sOn->
getScanName().leftJustified(9,
' ') +
" " +
2846 if (tsr && tsr->
osRec())
2856 if (tsr && tsr->
getTsys().contains(it.value()))
2857 v = tsr->
getTsys().value(it.value());
2858 s << str.sprintf(
" %7.1f", v);
2867 s <<
"# Idx Azimuth Elevation UTC_Time_tag ";
2872 s <<
" Ts#" << QString(
"").sprintf(
"%03d", idx);
2873 s <<
"\n# (deg) (deg)\n";
2875 for (
int i=0; i<
tSyses_.size(); i++)
2878 s << str.sprintf(
"TSYS: %6d ", i+1);
2879 str =
"SLWEING SLEWING ";
2882 double dt=1.0e3, d=0.0;
2883 for (
int j=0; j<tsr->
trakls().size(); j++)
2887 if ((d=fabs(tsr->
getT() - tsr->
trakls().at(j)->getT())) < dt)
2890 trakl = tsr->
trakls().at(j);
2895 str.sprintf(
"%10.5f %10.5f", trakl->
getAz(), trakl->
getEl());
2905 if (tsr && tsr->
getTsys().contains(it.value()))
2906 v = tsr->
getTsys().value(it.value());
2907 s << str.sprintf(
" %7.1f", v);
2915 s <<
"#\nNUMB_FRQ: 0\n#\n";
2916 s <<
"NUMB_TSYS: 0\n";
2917 s <<
"#\n#\n# No TSYS records found in the log file\n#\n";
2947 s <<
"# Sensor IF_Freq LO_Freq Sky_frq_Cen Bdw Pol SensorId IF# SideBand\n";
2948 s <<
"# tag MHz MHz MHz MHz\n";
2955 QString sensorKey(it.key());
2956 QString ifId(it.value());
2962 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
2963 ": cannot find IF index for if with the id \"" + ifId +
"\"");
2973 double ifFrq, loFrq, skyFrq, bw;
2974 ifFrq = loFrq = skyFrq = bw =
dFiller_;
2987 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find side band for LO \"" +
2995 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find side band for channel #" +
2996 QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
3003 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find polarization for LO \"" +
3011 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find bandwidth for channel #" +
3012 QString(
"").setNum(cIdx) +
", ID=" + ifId);
3031 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find BBC_FRQ for channel #" +
3032 QString(
"").setNum(cIdx));
3038 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find LO frq for channel #" +
3039 QString(
"").setNum(cIdx) +
", loID=" + loId);
3041 skyFrq = loFrq + ifFrq;
3045 "::export2antCalFrqs_nativeSetup(): station " +
stationName_ +
": cannot find LO ID for channel #" +
3046 QString(
"").setNum(cIdx));
3069 str.sprintf(
"TP_SENSOR: TS_%03d %8.2f %10.2f %10.2f %6.2f %3s %8s %3d %7s",
3070 idx, ifFrq, loFrq, skyFrq, bw,
3090 QString sSensorSbd(
"");
3091 QString sNetSbd(
"");
3093 QString sortingKey(
"");
3094 QMap<QString, QString> sensorSetupByKey;
3108 s <<
"# Note, the following sensor ID(s) were splitted by two sidebands: \n";
3112 const QString& key=it.key();
3114 str =
"# sensor " + key +
" => (";
3115 for (
int i=0; i<lst.size(); i++)
3116 str += lst.at(i) +
", ";
3122 s <<
"# Sensor IF_Freq LO_Freq Sky_frq_Cen BndWd Pol SensorId IF# Sensor Net Comments\n";
3123 s <<
"# tag MHz MHz MHz MHz SideBand SideBand\n";
3130 QString sensorKey(it.key());
3131 QString ifId(it.value());
3138 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3139 ": cannot find IF index for IF with ID \"" + ifId +
"\"");
3148 double ifFrq, loFrq, skyFrq, bw;
3149 ifFrq = loFrq = skyFrq = bw =
dFiller_;
3161 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3162 ": cannot find LO ID for sensorKey \"" + sensorKey +
"\"");
3169 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3170 ": cannot find LO sideband for sensorKey \"" + sensorKey +
"\"");
3177 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3178 ": cannot find side band for channel #" + QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
3185 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3186 ": cannot find LO frq for sensorKey \"" + sensorKey +
"\"");
3193 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3194 ": cannot find BBC_FRQ for channel #" + QString(
"").setNum(cIdx));
3201 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3202 ": cannot find bandwidth for sensor key \"" + sensorKey +
"\", ID=" + ifId);
3211 "::export2antCalFrqs_vgosSetup(): station " +
stationName_ +
3212 ": cannot find LO polarization for sensorKey \"" + sensorKey +
"\"");
3232 sSensorSbd =
"USB/LSB";
3239 sNetSbd =
"USB/LSB";
3242 str.sprintf(
"TP_SENSOR: TS_%03d %8.2f %10.2f %10.2f %6.2f %3s %8s %3d %7s %7s %s",
3243 idx, ifFrq, loFrq, skyFrq, bw,
3247 qPrintable(sSensorSbd),
3248 qPrintable(sNetSbd),
3249 qPrintable(QString(sensorKey).replace(
' ',
'_'))
3292 s <<
"# Sensor IF_Freq LO_Freq Sky_frq_Cen Bdw Pol SensorId IF# SideBand\n";
3293 s <<
"# tag MHz MHz MHz MHz\n";
3300 "::export2antCalFrqs_skededSetup(): station " +
stationName_ +
3301 ": number of channels are different");
3308 QString sensorKey(it.key());
3309 QString ifId(it.value());
3315 "::export2antCalFrqs_skededSetup(): station " +
stationName_ +
3316 ": cannot find IF index for if with the id \"" + ifId +
"\"");
3323 double ifFrq, loFrq, skyFrq, bw;
3324 ifFrq = loFrq = skyFrq = bw =
dFiller_;
3331 "::export2antCalFrqs_skededSetup(): station " +
stationName_ +
": cannot find side band for channel #" +
3332 QString(
"").setNum(cIdx) +
", ID: \"" + ifId +
"\"");
3351 str.sprintf(
"TP_SENSOR: TS_%03d %8.2f %10.2f %10.2f %6.2f %1s %8s %3d %7s",
3352 idx, ifFrq, loFrq, skyFrq, bw,
3375 s <<
"# Sensor Sky_frq_Cen Pol SensorId IF# SideBand Comments\n";
3384 QString key(it.key());
3385 QString id(it.value());
3396 freqOffset = width = 0.0;
3414 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3415 ": cannot find LO frequency for PCAL key \"" + key +
"\"");
3421 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3422 ": cannot find LO sideband for PCAL key \"" + key +
"\"");
3429 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3430 ": cannot find polarization for PCAL key \"" + key +
"\"");
3437 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3438 ": cannot find frequency offset for PCAL key \"" + key +
"\"");
3445 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3446 ": cannot find width for PCAL key \"" + key +
"\"");
3452 ifFreq =
id.right(4).toDouble(&isOk);
3456 skyFrq += 1024.0 - freqOffset - ifFreq;
3458 skyFrq -= 1024.0 - freqOffset - ifFreq;
3461 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3463 "\" for PCAL key \"" + key +
"\", cannot calculate the sky frequency");
3467 "::export2antCalPcal_vgosSetup(): station " +
stationName_ +
3468 ": cannot convert \"" +
id.right(4) +
3469 "\" to double for PCAL key \"" + key +
"\"");
3494 str.sprintf(
"PC_SENSOR: PC_%03d %14.2f %3s %8s %d %7s %s",
3500 qPrintable(QString(key).replace(
' ',
'_'))
3521 return (str.size()?str:
sFiller_).leftJustified(width,
' ');
3528 const QString& outputFileName,
const QString& stnKey,
const SgChannelSkeded *channelSkeded,
3529 bool useSkededChannelSetup,
bool have2overwrite,
bool reportAllReadings,
bool supressNonUsedSensors,
3530 int wishedOutputData,
const QString& ext4compress,
const QString& userCommand)
3532 enum ChannelSetup2Use {CSU_NONE, CSU_NATIVE, CSU_SKED, CSU_VEX, CSU_VGOS};
3533 const QString dataFlag[] = {
"DATA:OFF",
"DATA:ON_SOURCE",
"DATA:VALID_ON"};
3535 ChannelSetup2Use setup2use;
3539 QString outputContent(
"");
3542 int outputData=wishedOutputData;
3549 setup2use = CSU_NONE;
3577 outputContent +=
"DATA_ON ";
3579 outputContent +=
"CABLE_SIGN ";
3581 outputContent +=
"CABLE ";
3583 outputContent +=
"METEO ";
3585 outputContent +=
"TP_SENSOR TSYS ";
3589 outputContent +=
"TPI ";
3591 outputContent +=
"TP_SENSOR TPI ";
3596 outputContent +=
"TPC ";
3598 outputContent +=
"TP_SENSOR TPC ";
3603 outputContent +=
"SEFD ";
3605 outputContent +=
"TP_SENSOR SEFD ";
3608 outputContent +=
"PC_SENSOR PCAL ";
3610 outputContent +=
"FMT2GPS_TIMER FMTGPS";
3612 if (!outputContent.size())
3615 "::createAntCalFile(): station " + stnKey +
": nothing to output");
3621 outputContent.chop(1);
3623 "::createAntCalFile(): station " + stnKey +
": collected content for output: \"" +
3624 outputContent +
"\"");
3627 if (!outputFileName.size())
3629 str = inputLogFileName;
3635 if (5 < str.size() && str.right(4) == QString(
".log"))
3638 if (ext4compress.size())
3639 str +=
"." + ext4compress;
3642 str = outputFileName;
3644 if (ext4compress.size() && str.right(ext4compress.size()) != ext4compress)
3645 str +=
"." + ext4compress;
3652 "::createAntCalFile(): station " + stnKey +
": " +
3653 " going to create ANTCAL file \"" + f.fileName() +
"\"");
3659 "::createAntCalFile(): the file " + f.fileName() +
" already exists; it will be overwritten");
3663 "::createAntCalFile(): the file " + f.fileName() +
" already exists, skipping");
3678 "::createAntCalFile(): station " + stnKey +
3679 ": the sked's channel setup is missing");
3680 else if (!channelSkeded->
isOk())
3682 "::createAntCalFile(): station " + stnKey +
3683 ": the sked's channel setup is not good, skipping it");
3684 else if (!channelSkeded->
stnCfgByKey_.contains(stnKey))
3686 "::createAntCalFile(): station " + stnKey +
3687 ": the sked's channel setup does not contain this station, skipping it");
3691 "::createAntCalFile(): station " + stnKey +
3692 ": the number of collected channels and number of channels in the sked are different, skipping it");
3697 "::createAntCalFile(): station " + stnKey +
3698 ": looks like we have channel setup from sked");
3704 setup2use = CSU_NATIVE;
3707 setup2use = CSU_VGOS;
3709 "::createAntCalFile(): station " + stnKey +
3710 ": channel setup from the log file looks ok");
3714 "::createAntCalFile(): station " + stnKey +
3715 ": comparing sked's and FS log channel setups");
3719 else if (haveSkeded)
3721 setup2use = CSU_SKED;
3723 "::createAntCalFile(): station " + stnKey +
": cannot figure out channel setup from the log "
3724 "file, falling back to the set up from sked file");
3728 setup2use = CSU_NONE;
3730 "::createAntCalFile(): station " + stnKey +
": cannot figure out the channel setup");
3733 if (setup2use == CSU_NATIVE && useSkededChannelSetup)
3735 setup2use = CSU_SKED;
3737 "::createAntCalFile(): station " + stnKey +
": forced to use the set up from sked file");
3747 QFile fInpt(inputLogFileName);
3748 QFileInfo fi(fInpt);
3750 s <<
"# ANTCAL Format Version 0.96 of 2021.05.17\n#\n";
3751 s <<
"STATION: " << qPrintable(stnKey) <<
"\n#\n";
3753 s <<
"#\n# Created with command:\n";
3754 s <<
"#\n# " << qPrintable(userCommand) <<
"\n#\n";
3757 s <<
"# BACKEND INFO: " << qPrintable(
backEndInfo_) <<
"\n";
3759 s <<
"# RECORDER INFO: " << qPrintable(
recorderInfo_) <<
"\n#\n";
3763 s <<
"#\n# sec\n#\nUTC_MTAI: " <<
dFiller_ <<
"\n#\n#\n";
3764 s <<
"# Filler values\n# Real Integer Character\n#\n";
3768 s <<
"NUM_PROVENANCE: 1\n";
3773 s <<
"PROVENANCE: 1 CREATED_VARS: " << qPrintable(outputContent) <<
"\n";
3774 s <<
"PROVENANCE: 1 CREATION_DATE: "
3776 s <<
"PROVENANCE: 1 NUM_FILES: 1\n";
3778 s <<
"PROVENANCE: 1 DATA_TYPE: 1 FS_LOG Version " <<
fsVersionLabel_ <<
"\n";
3779 s <<
"PROVENANCE: 1 DATA_FILE: " << qPrintable(fi.canonicalFilePath()) <<
"\n";
3782 s <<
"PROVENANCE: 1 DATA_CREATED: 1 "
3784 s <<
"PROVENANCE: 1 NUM_COMMENTS: 1\n";
3785 s <<
"PROVENANCE: 1 COMMENT: Original field system log\n#\n";
3793 s <<
"# ScanIdx Data_on UTC start Data_on UTC end Source ScanName\n";
3794 s <<
"# YYYY.DD.MM-hh:mm:ss.ff YYYY.DD.MM-hh:mm:ss.ff\n";
3800 << qPrintable(str.sprintf(
"%6d ", i+1) +
3816 s <<
"#\nCABLE_SIGN: " << (
cableSign_<0?
"-1":
"+1") <<
"\n";
3822 if (reportAllReadings)
3829 s <<
"#\nNUM_CABLE: " << numOfRecs <<
"\n";
3831 s <<
"# CblIdx UTC Date Cable delay Source ScanName\n";
3832 s <<
"# YYYY.DD.MM-hh:mm:ss.ff s\n";
3840 scanIdx = sOn->
getIdx() + 1;
3841 if (reportAllReadings || sOn)
3843 s <<
"CABLE: " << qPrintable(str.sprintf(
"%6d ", scanIdx));
3846 str.sprintf(
" %12.5E ", cc->
getV()) +
3863 if (reportAllReadings)
3870 s <<
"#\nNUM_METEO: " << numOfRecs <<
"\n";
3872 s <<
"# MeteoIdx UTC Date Temp Pres Humid ScanIdx Source Scan\n";
3873 s <<
"# YYYY.DD.MM-hh:mm:ss.ff K Pa %\n";
3883 scanIdx = sOn->
getIdx() + 1;
3884 if (reportAllReadings || sOn)
3887 << qPrintable(str.sprintf(
"%7d ", meteoIdx+1))
3889 << qPrintable(QString(
"").sprintf(
"%6.2f %7.1f %5.1f ",
3893 << qPrintable(str.sprintf(
"%6d ", scanIdx))
3912 if (setup2use == CSU_NATIVE)
3920 else if (setup2use == CSU_VGOS)
3928 else if (setup2use == CSU_SKED && channelSkeded->
stnCfgByKey_.contains(stnKey))
3930 else if (setup2use == CSU_NONE)
3935 s <<
"# No TP_SENSOR data available\n";
3945 if (reportAllReadings)
3947 for (
int i=0; i<
tSyses_.size(); i++)
3948 if (
tSyses_.at(i)->getTsys().size())
3952 for (
int i=0; i<
tSyses_.size(); i++)
3953 if (
tSyses_.at(i)->getOsRec() &&
tSyses_.at(i)->getTsys().size())
3956 s <<
"#\nNUM_TSYS: " << numOfRecs <<
"\n";
3958 s <<
"# ScanIdx UTC_Time_tag Sensor Tsys Azimuth Elevat Source Scan DataScopeFlag\n";
3959 s <<
"# YYYY.DD.MM-hh:mm:ss.ff tag K deg deg\n";
3963 for (
int i=0; i<
tSyses_.size(); i++)
3972 double dt=1.0e3, d=0.0;
3974 for (
int j=0; j<tsr->
trakls().size(); j++)
3975 if (tsr->
trakls().at(j) &&
3976 (d=fabs(tsr->
getT() - tsr->
trakls().at(j)->getT())) < dt)
3979 trakl = tsr->
trakls().at(j);
3981 if (trakl && dt < 4.0/
DAY2SEC)
3983 az = trakl->
getAz();
3984 el = trakl->
getEl();
3995 scanIdx = osRec->
getIdx() + 1;
3998 if (reportAllReadings || osRec)
4004 QString sensorKey(it.key());
4008 if (tsr->
getTsys().contains(sensorKey))
4010 v = tsr->
getTsys().value(sensorKey);
4013 if (!supressNonUsedSensors || hasSensor)
4016 str.sprintf(
"TSYS: %6d %s TS_%03d %7.1f %9.4f %8.4f %s %s %s",
4024 qPrintable(dataFlag[dataFlagIdx])
4041 if (reportAllReadings)
4043 for (
int i=0; i<
tSyses_.size(); i++)
4044 if (
tSyses_.at(i)->getTpcont().size())
4048 for (
int i=0; i<
tSyses_.size(); i++)
4049 if (
tSyses_.at(i)->getOsRec() &&
tSyses_.at(i)->getTpcont().size())
4052 s <<
"#\nNUM_TPI: " << numOfRecs <<
"\n";
4054 s <<
"# ScanIdx UTC_Time_tag Sensor TpiOn TpiOff Azimuth Elevat Source Scan DataScopeFlag\n";
4055 s <<
"# YYYY.DD.MM-hh:mm:ss.ff tag K K deg deg\n";
4058 for (
int i=0; i<
tSyses_.size(); i++)
4067 double dt=1.0e3, d=0.0;
4068 for (
int j=0; j<tsr->
trakls().size(); j++)
4069 if (tsr->
trakls().at(j) &&
4070 (d=fabs(tsr->
getT() - tsr->
trakls().at(j)->getT())) < dt)
4073 trakl = tsr->
trakls().at(j);
4075 if (trakl && dt < 4.0/
DAY2SEC)
4077 az = trakl->
getAz();
4078 el = trakl->
getEl();
4089 scanIdx = osRec->
getIdx() + 1;
4092 if (reportAllReadings || osRec)
4098 QString sensorKey(it.key());
4102 if (tsr->
getTpcont().contains(sensorKey))
4104 vOn = tsr->
getTpcont().value(sensorKey)[0];
4105 vOf = tsr->
getTpcont().value(sensorKey)[1];
4108 if (!supressNonUsedSensors || hasSensor)
4111 str.sprintf(
"TPI: %6d %s TS_%03d %8d %8d %9.4f %8.4f %s %s %s",
4113 idx, vOn, vOf, az, el,
4119 qPrintable(dataFlag[dataFlagIdx]));
4137 if (reportAllReadings)
4138 numOfRecs =
pcals_.size();
4140 for (
int i=0; i<
pcals_.size(); i++)
4141 if (
pcals_.at(i)->getOsRec())
4144 s <<
"#\nNUM_PCAL: " << numOfRecs <<
"\n";
4149 s <<
"# ScanIdx UTC_Time_tag Sensor Ampl Phase Source Scan DataScopeFlag\n";
4150 s <<
"# YYYY.DD.MM-hh:mm:ss.ff tag rad [0,2pi)\n";
4153 for (
int i=0; i<
pcals_.size(); i++)
4165 scanIdx = osRec->
getIdx() + 1;
4168 if (reportAllReadings || osRec)
4177 if (pcr->
getPcal().contains(it.value()))
4179 vAmp = *pcr->
getPcal().value(it.value());
4180 vPhs = *(pcr->
getPcal().value(it.value()) + 1);
4181 vPhs = fmodf(vPhs + 360.0, 360.0)/
RAD2DEG;
4184 if (!supressNonUsedSensors || hasSensor)
4187 str.sprintf(
"PCAL: %6d %s PC_%03d %8.3f %10.5f %s %s %s",
4195 qPrintable(dataFlag[dataFlagIdx]));
4209 s <<
"# Timer Board\n";
4216 QString id(it.value());
4217 str.sprintf(
"FMT2GPS_TIMER: TMR_%03d %s",
4218 idx, qPrintable(
id) );
4224 if (reportAllReadings)
4231 s <<
"#\nNUM_FMTGPS: " << numOfRecs <<
"\n";
4233 s <<
"# Scan UTC_Time_tag Timer Formatter minus Formatter minus Source Scan\n";
4234 s <<
"# Idx tag GPS time PPS time\n";
4235 s <<
"# YYYY.DD.MM-hh:mm:ss.ff s s\n";
4249 scanIdx = osRec->
getIdx() + 1;
4252 if (reportAllReadings || osRec)
4267 if (!supressNonUsedSensors || hasSensor)
4269 str.sprintf(
"FMTGPS: %6d %s TMR_%03d %16.9e %16.9e %s %s",
4294 if (reportAllReadings)
4301 s <<
"#\nNUM_TPC: " << numOfRecs <<
"\n";
4303 s <<
"# ScanIdx UTC_Time_tag Sensor Gain TpCalOn TpCalOff SEFD Azimuth Elevat Source Scan DataScopeFlag\n";
4304 s <<
"# YYYY.DD.MM-hh:mm:ss.ff tag Jy deg deg\n";
4323 scanIdx = osRec->
getIdx() + 1;
4326 if (reportAllReadings || osRec)
4332 double vGain, vOn, vOf, vSefd;
4333 vGain = vOn = vOf = vSefd =
dFiller_;
4334 QString bbcId(it.value());
4335 #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
4336 QString sbId(it.value().at(it.value().size() - 1));
4338 QString sbId(it.value().back());
4351 else if (sbId ==
"u")
4360 "::createAntCalFile(): station " + stnKey +
4361 ": got an unknown sideband id: \"" + sbId +
"\", IF id is \"" +
4365 if (!supressNonUsedSensors || hasSensor)
4368 str.sprintf(
"TPC: %6d %s TS_%03d %8.1f %10.1f %10.1f %10.1f %9.4f %8.4f %s %s %s",
4370 idx, vGain, vOn, vOf, vSefd, az, el,
4376 qPrintable(dataFlag[dataFlagIdx])
4393 s <<
"#\nNUM_SEFD: " <<
sefds_.size() <<
"\n#\n";
4394 s <<
"# some docs on OnOff measurements can be found in FS sources, fs-master/onoff/onoff.txt\n";
4395 s <<
"# and fs-master/onoff/gain.txt\n";
4397 s <<
"# Sensor UTC_Time_tag SEFD Tsys Tcal Trat Gain Az El Source\n";
4398 s <<
"# tag YYYY.DD.MM-hh:mm:ss.ff Jy K Jy Compress deg deg\n";
4401 for (
int i=0; i<
sefds_.size(); i++)
4412 QString sensorKey(it.key());
4413 double v2, v3, v4, v5, v6;
4418 const QVector<double>
4429 "::createAntCalFile(): station " + stnKey +
4430 ": the sensor key \"" + sensorKey +
"\" is not found in the SEFD map");
4431 if (!supressNonUsedSensors || hasSensor)
4433 str.sprintf(
"SEFD: TS_%03d %s %10.3f %10.3f %10.3f %10.3f %10.3f %9.4f %9.4f %s",
4437 qPrintable(srcName));
4449 s <<
"# End of file\n";
4476 "(\\d{2}\\.?\\d{0,3})\\D+");
4478 "\\d{1,2}\\s+\\d{1,2}\\s+[\\d\\.eEdD+-]{1,}\\s+[\\dA-Z+-]{2,}\\s+\\d{3}-\\d{4}[a-z]?\\s*$");
4480 "d{1,2}\\s+\\d{1,2}\\s+\\d{1,2}\\s+[+-]?[\\d\\.]{1,}\\s+[+-]?[\\d\\.]{1,}\\s+[+-]?[\\d\\.]{1,}\\s*$");
4488 return "SgStnLogCollector";
4497 inputLogFileName_(
""),
4527 const SgMJD& tFirst,
const SgMJD& tLast,
const QString& orderOfMeteo)
4538 QString sScanName(
"");
4539 QString sSourceName(
"");
4540 QString versionStr(
"");
4545 SgMJD tRightMargin(tLast + 5.0/24.0/60.0);
4546 SgMJD tAtTheEnd(tLast - 75.0/24.0/60.0);
4547 SgMJD tAtTheBegin(tFirst - 7.0/24.0/60.0);
4549 bool isDataOn, isOnSource, reachedEndOfSession, hasStnName;
4551 hasStnName = (0 < stnName.size());
4560 if (orderOfMeteo.size())
4563 for (
int i=0; i<orderOfMeteo.size(); i++)
4565 if (orderOfMeteo.at(i) ==
'T')
4570 else if (orderOfMeteo.at(i) ==
'P')
4575 else if (orderOfMeteo.at(i) ==
'H')
4582 "::readLogFile(): the order of meteoparamters is set to \"" + str +
"\"");
4594 QRegularExpression reOnSource(
":preob|#trakl#\\s*Source acquired|"
4595 "#flagr#flagr/antenna,acquired|&preob[a-z0-9+_-]*/onsource|&preob/track",
4596 QRegularExpression::CaseInsensitiveOption);
4598 QRegularExpression reDataOn(
"(:|/)data_valid=on|data start\\W+|:midob",
4599 QRegularExpression::CaseInsensitiveOption);
4601 QRegularExpression reDataOff(
"(:|/)data_valid=off|data stop\\W+|;terminate|;halt|:postob",
4602 QRegularExpression::CaseInsensitiveOption);
4604 QRegularExpression reTapeOn(
"/tape\\d?/.*moving,.*(?:nostop|locked)",
4605 QRegularExpression::CaseInsensitiveOption);
4606 QRegularExpression reTapeOff(
"/tape\\d?/.*(?:stopped,.*unlocked|moving,.*stop|"
4607 "stopped,.*stop)", QRegularExpression::CaseInsensitiveOption);
4609 QRegularExpression reScanName(
":scan_name=([_a-zA-Z0-9+-]{1,}),([a-zA-Z0-9_+-]+),?.*",
4610 QRegularExpression::CaseInsensitiveOption);
4611 QRegularExpression reSourceName(
":source=([\\.a-zA-Z0-9_+-]{1,10}),.*",
4612 QRegularExpression::CaseInsensitiveOption);
4614 QRegularExpression reMeteo(
"(#wx#/WX/|/?wx/|DSNWX/|wx/weather:)([^,]+),([^,]+),([^,]+).*",
4615 QRegularExpression::CaseInsensitiveOption);
4617 QRegularExpression reCableCal(
"(/cable/|cableget/)(.+)",
4618 QRegularExpression::CaseInsensitiveOption);
4620 QRegularExpression reCableLong(
"(/cablelong/)(.+)",
4621 QRegularExpression::CaseInsensitiveOption);
4622 QRegularExpression reVersion(
"(mark\\s+.+\\s+field system\\s+v\\w*\\s*)(.+)",
4623 QRegularExpression::CaseInsensitiveOption);
4626 QRegularExpression reCableDiff(
"((?:/|;\"*\\s*)cable\\s*diff(?:/|;*\\s*))([^,]+),([+-])",
4627 QRegularExpression::CaseInsensitiveOption);
4629 QRegularExpression reCableSign(
"(c\\w?a\\w?b\\w?l\\w?e\\w?|ca\\w{2,2}e)\\s+sign\\s+is\\s+"
4630 "(positive|negative)", QRegularExpression::CaseInsensitiveOption);
4631 QRegularExpression reCableDiffIs(
"cable\\s+dif{1,2}e\\w{2,3}ce\\s+(?:is|was)",
4632 QRegularExpression::CaseInsensitiveOption);
4633 QRegularExpression reOpComments(
"\\d+;\"(.+)", QRegularExpression::CaseInsensitiveOption);
4636 QRegularExpression rePcmt(
"(\\d{4})\\s+(\\d{1,2})\\s+(\\d{1,2})\\s+"
4637 "(\\d{1,2})\\s+(\\d{1,2})\\s+(\\d{1,2})\\s+"
4638 "(.+)\\s+([\\dA-Z+-]{2,8})\\s+([0-9a-z-]{0,}).*",
4639 QRegularExpression::CaseInsensitiveOption);
4642 QRegularExpression reMet(
"(\\d{2,4})\\s+(\\d{1,2})\\s+(\\d{1,2})\\s+"
4643 "(\\d{1,2})\\s+(\\d{1,2})\\s+(\\d{1,2})\\s+"
4644 "([\\d\\.+-]+)\\s+([\\d\\.+-]+)\\s+([\\d\\.+-]+).*",
4645 QRegularExpression::CaseInsensitiveOption);
4647 QRegularExpression reCdms(
"([/#]CDMS/)(.+)", QRegularExpression::CaseInsensitiveOption);
4654 QRegularExpression reTsys(
"([/#]tsys/)([^,]+),([^,]+).*",
4655 QRegularExpression::CaseInsensitiveOption);
4665 QRegularExpression reTsysVgos(
"(#rdtc\\w#tsys/ )([^,]+),([^,]+).*");
4672 QRegularExpression reTpcontVgos(
"(#rdtc\\w#tpcont/ )([^,]+),([^,]+).*");
4682 QRegularExpression rePcalOffset(
"&.+/rdbe([a-z0-9]*)=pcal=([0-9\\.eEfFdD+-]+).*");
4692 QRegularExpression rePcalVgos(
"(#rdtc\\w#pcal/ )([^,]+),([^,]+).*");
4699 QRegularExpression reSefd(
"#onoff#VAL\\s+([\\.\\d\\w+-]+)\\s+([\\.\\d+-]+)\\s+"
4700 "([\\.\\d+-]+)\\s+([\\w\\d]+)\\s+([\\w\\d]+)\\s+([\\w\\d]+)\\s+([\\.\\d+-]+)\\s+([\\.\\d+-]+)\\s+"
4701 "([\\.\\d+-]+)\\s+([\\.\\d+-]+)\\s+([\\.\\d+-]+)\\s+([\\.\\d+-]+).*");
4709 QRegularExpression reDot2xpsVgos(
"#rdtc(\\w)#dot2(g|p)ps/\\s*([0-9eEdD\\.+-]+).*");
4714 QRegularExpression reVc(
"(/vc)([0-9]{2})=([0-9\\.]+),([^,]+).*");
4721 QRegularExpression rePatch(
"([&].+/\"?patch=lo)([^,]+),([^,]+).*");
4723 QRegularExpression reLo(
"([&].+/\"?lo=lo)([^,]+),([0-9\\.]+),(\\w)+,(\\w)+.*");
4728 QRegularExpression reLoRxg(
"[\\d](/lo/rxg,\\s*lo)([^,]+),\\s*([a-zA-Z0-9\\.+-]+),\\s*(\\w)+,\\s*(\\w)+.*");
4746 QRegularExpression reChanSkyFreq(
"&setup.*/\"channel\\s+sky\\s+freq.*");
4747 QRegularExpression reChanSkyFreqValues(
"&setup.*/\"\\s+([0-9]+)\\s+([0-9\\.]+)\\s+"
4748 "([0-9\\.]+)\\s+([0-9\\.]+).*");
4755 QRegularExpression reVci(
"(/\"?vci)([0-9]{2})=([0-9\\.]+),([^,]+).*");
4764 QRegularExpression reBbc(
"([&].+(?:/|=d)bbc)([0-9]+)=([0-9\\.]+),([^,]+).*");
4767 QRegularExpression reDbbc3Tp(
"/dbbc3/dbbc(\\d{3})/\\s*([0-9\\.+-]+),([^,]+),(\\d+),(\\d+),"
4768 "(\\w+),(\\d+),(\\d+),(\\d+),(\\d+),(\\d+),(\\d+);.*");
4774 QRegularExpression reTrakl(
"#trakl#\\[az\\s+([\\.0-9+-]+)\\s+el\\s+([\\.0-9+-]+)\\s+azv"
4775 "\\s+([\\.0-9+-]+)\\s+elv\\s+([\\.0-9+-]+)\\s+mjd\\s+"
4776 "([\\.0-9+-]+)\\s+s\\s+([\\.0-9+-]+)\\s+ms\\s+"
4777 "([\\.0-9+-]+)\\s*\\]");
4779 QRegularExpression reProcedureDecl(
"[\\.0-9+-]{2}:\"%\\s+define\\s+(\\S+).*");
4781 QRegularExpression reEndOfSchd(
":(sched_end|\\*end of schedule).*");
4784 QRegularExpression reProc(
";proc=(\\S+)");
4790 QRegularExpression reEquip(
"\\d{2}.equip1{0,1},([^,]+),([^,]+),(.+)");
4794 QString procName(
"");
4796 QString backEndName(
"");
4797 QString recorderName(
"");
4800 bool isProcedureContentMode;
4801 QMap<QString, QString> procedureNameByName;
4803 QRegularExpression reProcedures(
"");
4804 QRegularExpression reProcedureContent(
"");
4805 QString currentProcedureName(
"");
4806 QString currentProcedureTimeStamp(
"");
4816 str =
"#trakl#(?!\\[az)|#rdtc.#(?!";
4824 str +=
"dot2(:?g|p)ps";
4826 str +=
")|#antcn#(?!/wx)|\\d[:/]mk6a[=/]/";
4829 str =
"#trakl#(?!\\[az)|#rdtc.#|#antcn#(?!/wx)|\\d[:/]mk6a[=/]/";
4832 QRegularExpression re2skip(str);
4836 QRegularExpression reLocation(
";location,(\\S{1,8})\\s*,\\s*([-+\\.\\d]+)\\s*,"
4837 "\\s*([-+\\.\\d]+)\\s*,\\s*([-+\\.\\d]+).*", QRegularExpression::CaseInsensitiveOption);
4838 bool hasLocation=
false;
4842 QRegularExpression reStnId(
"\\d:\"\\s+([A-Z0-9]{1,6})\\s+([0-9]{4})\\s+"
4843 "([_A-Z0-9-]{2,8})\\s+([A-Z0-9])\\s+([A-Z0-9][a-z0-9+-])");
4849 bool hasVersionStr, hasCableSign, needCableSign;
4850 int val, numOfSkippedStrs, numOfReadStrs, numOfProcedureExpanded;
4858 QRegularExpressionMatch match;
4862 if ((tLast - tFirst) < 3.0/24.0)
4863 tAtTheEnd = tLast - 5.0/24.0/60.0;
4866 numOfSkippedStrs = numOfReadStrs = numOfProcedureExpanded = 0;
4868 have2checkT =
false;
4869 hasVersionStr = hasCableSign = needCableSign =
false;
4870 hasProc = hasEquip =
false;
4873 needCableSign =
true;
4882 "::readLogFile(): the log file " + fileName +
" does not exist");
4889 "::readLogFile(): station \"" +
stationName_ +
"\": reading log file " + fileName);
4894 if (fileName.right(9).toLower() ==
".cdms.dat")
4896 else if (fileName.right(4).toLower() ==
".dat" && fileName.toLower().contains(
".pcmt."))
4898 else if (fileName.right(8).toLower() ==
".met.dat")
4906 reachedEndOfSession =
false;
4911 hasProcedures =
false;
4912 isProcedureContentMode =
false;
4914 flogSize = QFileInfo(fileName).size();
4919 bool have2reportNumOfStrings;
4921 while (!s.atEnd() && !reachedEndOfSession)
4923 if (procedureContent.size())
4925 str = currentProcedureTimeStamp +
"&" + currentProcedureName +
"/" + procedureContent.takeFirst();
4927 if (procedureContent.size() == 0)
4929 currentProcedureName =
"";
4930 currentProcedureTimeStamp =
"";
4939 if (have2reportNumOfStrings && numOfReadStrs%100000 == 0)
4940 std::cout <<
" -- read " << numOfReadStrs/1000 <<
"K strings file size: " << flogSize <<
"\n";
4943 if (str.right(4) ==
"\\par")
4949 numOfTries++>10 && str.size())
4953 ": cannot determine the time mark format after " + QString(
"").setNum(numOfTries) +
4954 " tries, the log file: " + fileName);
4964 if (!hasVersionStr && (match=reVersion.match(str)).hasMatch())
4966 versionStr = match.captured(0);
4968 hasVersionStr =
true;
4973 if(str.size()==0 || re2skip.match(str).hasMatch())
4979 if ((match=rePcmt.match(str)).hasMatch() &&
4997 if (tRightMargin <= t && (!needCableSign || hasCableSign) )
4999 reachedEndOfSession =
true;
5002 ": got to the end of the session: " +
5009 versionStr =
"PCMT or CDMS file";
5010 hasVersionStr =
true;
5017 if ((match=reMet.match(str)).hasMatch() &&
5022 if (tRightMargin <= t && (!needCableSign || hasCableSign))
5024 reachedEndOfSession =
true;
5027 ": got to the end of the session: " +
5034 versionStr =
"External file with meteo data";
5035 hasVersionStr =
true;
5043 if ((match=reProcedureDecl.match(str)).hasMatch())
5045 hasProcedures =
true;
5046 procedureNameByName.insert(match.captured(1), match.captured(1));
5047 str =
"[\\.0-9]{2}:(";
5048 for (QMap<QString, QString>::iterator it=procedureNameByName.begin();
5049 it!=procedureNameByName.end(); ++it)
5050 str += it.key() +
"|";
5052 reProcedures.setPattern(str +
")");
5055 ": found declaration of procedure \"" + match.captured(1) +
"\"");
5058 else if (hasProcedures && (match=reProcedures.match(str)).hasMatch())
5061 if (isProcedureContentMode && currentProcedureName.size() &&
5063 procedureNameByName.contains(currentProcedureName) )
5066 procedureNameByName.remove(currentProcedureName);
5068 strTmp =
"[\\.0-9]{2}:(";
5069 for (QMap<QString, QString>::iterator it=procedureNameByName.begin();
5070 it!=procedureNameByName.end(); ++it)
5071 strTmp += it.key() +
"|";
5073 reProcedures.setPattern(strTmp +
")");
5076 ": procedure \"" + currentProcedureName +
5077 "\" is empty, removed from the substitution pool");
5079 currentProcedureName = match.captured(1);
5084 for (
int i=0; i<prc->
content().size(); i++)
5085 procedureContent.append(prc->
content().at(i));
5087 numOfProcedureExpanded++;
5093 isProcedureContentMode =
true;
5094 reProcedureContent.setPattern(
"[\\.0-9]{2}&" + currentProcedureName +
"/(.*)");
5097 ": found content of procedure \"" + currentProcedureName +
"\"");
5100 else if (isProcedureContentMode)
5106 if ((match=reProcedureContent.match(str)).hasMatch())
5107 prc->
content().append(match.captured(1));
5112 ": collected content of procedure \"" + currentProcedureName +
"\", " +
5113 QString(
"").setNum(prc->
content().size()) +
" record(s) total");
5117 procedureNameByName.remove(currentProcedureName);
5119 strTmp =
"[\\.0-9]{2}:(";
5120 for (QMap<QString, QString>::iterator it=procedureNameByName.begin();
5121 it!=procedureNameByName.end(); ++it)
5122 strTmp += it.key() +
"|";
5124 reProcedures.setPattern(strTmp +
")");
5127 ": procedure \"" + currentProcedureName +
5128 "\" is empty, removed from the substitution pool");
5130 isProcedureContentMode =
false;
5131 currentProcedureName =
"";
5132 currentProcedureTimeStamp =
"";
5138 ": cannot find procedure \"" + currentProcedureName +
"\" in the map; input: \"" +
5144 else if ((match=reProc.match(str)).hasMatch() &&
extractEpoch(str, t))
5149 procName = match.captured(1);
5151 else if (procName != match.captured(1))
5153 if (procName.size())
5156 ": proc has changed: \"" + procName +
"\" => \"" + match.captured(1) +
5158 procName = match.captured(1);
5159 if (tRightMargin <= t && (!needCableSign || hasCableSign))
5161 reachedEndOfSession =
true;
5164 ": got to the end of the session: " +
5170 if ((match=reEquip.match(str)).hasMatch() &&
extractEpoch(str, t))
5172 if (backEndName.size() && backEndName != match.captured(1))
5176 ": equip (backEnd) has changed: \"" + backEndName +
"\" => \"" + match.captured(1) +
5179 backEndName = match.captured(1);
5181 if (recorderName.size() && recorderName != match.captured(2))
5185 ": equip (recorder) has changed: \"" + recorderName +
"\" => \"" + match.captured(2) +
5188 recorderName = match.captured(2);
5191 if (backEndName ==
"dbbc3")
5193 if (backEndName.contains(
"dbbc3_"))
5195 else if (backEndName ==
"dbbc")
5197 else if (backEndName ==
"rdbe")
5202 else if (backEndName ==
"none")
5218 if ((match=reStnId.match(str)).hasMatch())
5220 stationName_ = match.captured(3).leftJustified(8,
' ');
5225 ": found a name of the station (from \"stnId\"): \"" +
stationName_ +
"\"");
5230 if ((match=reLocation.match(str)).hasMatch())
5234 stationName_ = match.captured(1).leftJustified(8,
' ');
5238 ": found a name of the station (from \"location\"): \"" +
stationName_ +
"\"");
5244 ": the station name from \"location\" (\"" + match.captured(1) +
5245 "\") is different");
5250 if (have2checkT &&
extractEpoch(str, t) && tRightMargin <= t && (!needCableSign || hasCableSign))
5252 reachedEndOfSession =
true;
5255 ": got to the end of the session: " +
5260 if (reEndOfSchd.match(str).hasMatch() &&
extractEpoch(str, t) && tFirst < t &&
5261 (!needCableSign || hasCableSign))
5263 reachedEndOfSession =
true;
5266 ": got to the end of the session: end of schedule at " +
5270 if (reachedEndOfSession)
5276 if (reOnSource.match(str).hasMatch() ||
5277 reTapeOn.match(str).hasMatch() )
5285 if (tRightMargin <= t && (!needCableSign || hasCableSign))
5287 reachedEndOfSession =
true;
5290 ": got to the end of a session: " +
5300 ": got unexpected `on source' record; string: \"" +
asciifyString(str) +
"\"");
5304 else if ((match=reScanName.match(str)).hasMatch())
5309 "::readLogFile(): station " +
stationName_ +
": the scan name \"" +
5310 osRec->
getScanName() +
"\" will be replaced with \"" + match.captured(1) +
5311 "\", looks like discontinuity in the log file");
5318 ": the scan is not empty: size of cable cal list is " +
5319 QString(
"").setNum(osRec->
cableCals().size()));
5323 ": the scan is not empty: size of meteo parameters list is " +
5324 QString(
"").setNum(osRec->
meteoPars().size()));
5329 if (match.captured(2).size())
5336 ": the experiment name has been changed: \"" +
5338 match.captured(2) +
"\"");
5342 ": found experiment name: \"" + match.captured(2) +
"\"");
5348 else if ((match=reSourceName.match(str)).hasMatch()
5361 "\" will be replaced with \"" + match.captured(1).toUpper() +
5362 "\", looks like discontinuity in the log file");
5371 else if (reDataOff.match(str).hasMatch() ||
5372 reTapeOff.match(str).hasMatch() )
5379 if (tRightMargin <= t && (!needCableSign || hasCableSign))
5381 reachedEndOfSession =
true;
5384 ": got to the end of a session: " +
5398 "::readLogFile(): station " +
stationName_ +
": the scan name \"" +
5400 "\" too short and cannot be used; the `data_valid=off' string: \"" +
5413 ": got unexpected data_valid=off record; string: \"" +
asciifyString(str) +
"\"");
5423 QRegularExpression reNotUserComments(
";\"(?:/| Command from |FiLa10G:|Flexbuff:|"
5424 "start transferring scan|Error opening connection to FILA10G|"
5425 "Error opening connection to flexbuff|.+\\s+1pps diff:).*",
5426 QRegularExpression::CaseInsensitiveOption);
5427 QRegularExpression reFilter1(
";\"\\s*Comment from\\s+'\\w+\\(?\\d?\\)?':\\s+\""
5428 "\\s+CHECKLIST\\(?\\w*\\)?:\\s+(\\b.+)", QRegularExpression::CaseInsensitiveOption);
5429 QRegularExpression reFilter2(
";\"\\s*CHECKLIST:\\s+(.+)",
5430 QRegularExpression::CaseInsensitiveOption);
5431 QRegularExpression reFilter3(
";\"\\s*Comment from\\s+'\\w+\\(?\\w*\\)?':\\s+\"\\s+(\\b.+)",
5432 QRegularExpression::CaseInsensitiveOption);
5433 QRegularExpression reFilterLast(
";\"\\s*(\\b.+)",
5434 QRegularExpression::CaseInsensitiveOption);
5435 if (reOpComments.match(str).hasMatch())
5440 if (!reNotUserComments.match(strTmp).hasMatch())
5442 if ((match=reFilter1.match(strTmp)).hasMatch())
5443 strTmp = match.captured(1);
5444 else if ((match=reFilter2.match(strTmp)).hasMatch())
5445 strTmp = match.captured(1);
5446 else if ((match=reFilter3.match(strTmp)).hasMatch())
5447 strTmp = match.captured(1);
5448 else if ((match=reFilterLast.match(strTmp)).hasMatch())
5449 strTmp = match.captured(1);
5451 if (strTmp.size() < 100)
5455 QStringList sLst=strTmp.split(QRegExp(
"\\s"));
5457 for (
int i=0; i<sLst.size(); i++)
5459 sAux +=
" " + sLst.at(i);
5460 if (sAux.size() > 81)
5474 if ((match=reTrakl.match(str)).hasMatch())
5488 if (pTs->
trakls().size() < 10)
5497 else if (reTsysVgos.match(str).hasMatch())
5499 QMap<QString, float> tsys;
5503 if (0.3/
DAY2SEC < fabs(lastReadTsys - t))
5507 tsr->
setOsRec(isOnSource?osRec:NULL);
5520 if (tsr->
trakls().size() < 5)
5534 else if (reTpcontVgos.match(str).hasMatch())
5536 QMap<QString, QVector<int> >
5541 if (0.2/
DAY2SEC < fabs(lastReadTsys - t))
5545 tsr->
setOsRec(isOnSource?osRec:NULL);
5558 if (tsr->
trakls().size() < 5)
5573 else if ((match=rePcalOffset.match(str)).hasMatch())
5577 else if ((match=rePcalVgos.match(str)).hasMatch())
5579 QMap<QString, float*> pcals;
5584 if (0.2/
DAY2SEC < fabs(lastReadPcal - t))
5588 pcr->
setOsRec(isOnSource?osRec:NULL);
5597 ": got duplicate pcals; input: \"" +
asciifyString(str) +
"\"");
5600 for (QMap<QString, float*>::iterator it=pcals.begin(); it!=pcals.end(); ++it)
5601 delete[] it.value();
5606 else if ((match=reDot2xpsVgos.match(str)).hasMatch())
5608 float dot2xps=1.0e20;
5617 if (0.2/
DAY2SEC < fabs(lastReadDot2xps - t))
5621 d2r->
setOsRec(isOnSource?osRec:NULL);
5629 ": got duplicate " + (isGps?
"dot2gps":
"dot2pps") +
5631 lastReadDot2xps = t;
5635 else if ((match=reDbbc3Tp.match(str)).hasMatch())
5639 QString sensorId(match.captured( 1));
5640 QString boardId(match.captured( 3));
5641 QString agc(match.captured( 6));
5651 bw = match.captured( 4).toDouble();
5652 gainU = match.captured( 7).toDouble();
5653 gainL = match.captured( 8).toDouble();
5654 tpOffU = match.captured( 9).toDouble();
5655 tpOffL = match.captured(10).toDouble();
5656 tpOnU = match.captured(11).toDouble();
5657 tpOnL = match.captured(12).toDouble();
5658 sensorId= sensorId.simplified().rightJustified(5,
' ');
5659 QString chanKey=
setupTpSensor(sensorId +
'l',
"readLogFile()", str);
5662 chanKey =
setupTpSensor(sensorId +
'u',
"readLogFile()", str);
5666 if (1.0/
DAY2SEC < fabs(lastReadTsys - t))
5670 tp->
setOsRec(isOnSource?osRec:NULL);
5678 tp->
addRecord(sensorId, boardId, bw, agc, gainU, gainL, tpOffU, tpOffL, tpOnU, tpOnL,
5684 "::readLogFile(): station " +
stationName_ +
": parsing chanKey has failed for \"" +
5685 sensorId +
'u' +
"\"; input: \"" +
asciifyString(str) +
"\"");
5689 "::readLogFile(): station " +
stationName_ +
": parsing chanKey has failed for \"" +
5690 sensorId +
'l' +
"\"; input: \"" +
asciifyString(str) +
"\"");
5694 else if ((match=reSefd.match(str)).hasMatch())
5699 QVector<double> vec;
5703 if (0.3/
DAY2SEC < fabs(lastReadSefd - t))
5710 ": got duplicate SEFD; input: \"" +
asciifyString(str) +
"\"");
5717 else if (wantTsys && reTsys.match(str).hasMatch())
5719 QMap<QString, float> tsys;
5722 if (fabs(lastReadTsys - t) < 0.1/
DAY2SEC)
5729 tsr->
setOsRec(isOnSource?osRec:NULL);
5739 if (tsr->
trakls().size() < 5)
5750 else if (reMeteo.match(str).hasMatch())
5766 else if ((match=reBbc.match(str)).hasMatch())
5771 else if ((match=reVc.match(str)).hasMatch())
5776 else if ((match=rePatch.match(str)).hasMatch())
5780 else if ((match=reLo.match(str)).hasMatch())
5784 else if ((match=reLoRxg.match(str)).hasMatch())
5788 else if ((match=reChanSkyFreqValues.match(str)).hasMatch())
5792 else if ((match=reVci.match(str)).hasMatch())
5799 else if ((match=reCableCal.match(str)).hasMatch())
5804 double scale = 4.0e5;
5816 else if ((match=reCdms.match(str)).hasMatch())
5821 double scale = 2e12;
5834 else if ((match=reCableLong.match(str)).hasMatch())
5836 double scale = 4.0e5;
5841 else if (!hasCableSign)
5844 if ((match=reCableDiff.match(str)).hasMatch())
5849 hasCableSign =
true;
5852 ": the cable calibration sign was set to \"" +
5857 else if (reCableSign.match(str).hasMatch())
5859 if (str.contains(
"positive", Qt::CaseInsensitive))
5862 hasCableSign =
true;
5865 ": the cable calibration sign was set to \"+\". Source: cable_sign_is");
5867 else if (str.contains(
"negative", Qt::CaseInsensitive))
5870 hasCableSign =
true;
5873 ": the cable calibration sign was set to \"-\". Source: cable_sign_is");
5877 "::readLogFile(): station " +
stationName_ +
": cannot determine proper cable sign "
5878 "from cable_sign_is pattern; input: \"" +
asciifyString(str) +
"\"");
5880 else if (reCableDiffIs.match(str).hasMatch())
5882 if (str.contains(
"positive", Qt::CaseInsensitive) ||
5883 str.contains(
"larger", Qt::CaseInsensitive) )
5886 hasCableSign =
true;
5889 ": the cable calibration sign was set to \"+\". Source: cable_diff_is");
5891 else if ( str.contains(
"negative", Qt::CaseInsensitive) ||
5892 str.contains(
"smaller", Qt::CaseInsensitive) )
5895 hasCableSign =
true;
5898 ": the cable calibration sign was set to \"-\". Source: cable_diff_is");
5903 ": cannot determine proper cable sign from cable_diff_is pattern; input: \"" +
5920 "::readLogFile(): station " +
stationName_ +
": picked up not finished onSource record");
5926 "::readLogFile(): station " +
stationName_ +
": no proc record has been found in the log file");
5928 if (operatorComments.size())
5931 "::readLogFile(): station " +
stationName_ +
": collected operator's comments: ");
5932 for (
int i=0; i<operatorComments.size(); i++)
5934 "::readLogFile(): station " +
stationName_ +
": " + operatorComments.at(i));
5939 if (flogSize < 1024)
5941 str.setNum(flogSize);
5944 else if (flogSize < 1048576)
5946 str.setNum(flogSize/1024);
5949 else if (flogSize < 1073741824)
5951 str.setNum(flogSize/1048576);
5956 str.setNum(flogSize/1073741824);
5960 "::readLogFile(): station " +
stationName_ +
": " + QString(
"").setNum(numOfReadStrs) +
5961 " strings of the log file (" + str +
") were read" +
5962 (numOfSkippedStrs>1?
" (" + QString(
"").setNum(numOfSkippedStrs) +
" strings were skipped)":
""));
5964 "::readLogFile(): station " +
stationName_ +
": the log file version: " + versionStr);
5965 if (numOfProcedureExpanded)
5968 "::readLogFile(): station " +
stationName_ +
": " + QString(
"").setNum(numOfProcedureExpanded) +
5969 " time(s) procedure(s) were expanded:");
5973 "::readLogFile(): station " +
stationName_ +
": " + it.value()->getName() +
": " +
5974 QString(
"").setNum(it.value()->getNumOfExpanded()));
5977 "::readLogFile(): station " +
stationName_ +
": collected " +
5985 "::readLogFile(): station " +
stationName_ +
": collected " +
5989 "::readLogFile(): station " +
stationName_ +
": collected " +
5993 "::readLogFile(): station " +
stationName_ +
": collected " +
6005 "::readLogFile(): station " +
stationName_ +
": collected " +
6007 " meteo records from RINEX files");
6010 "::readLogFile(): station " +
stationName_ +
": nothing to get from RINEX files");
6024 else if (
reFsNew_.match(str).hasMatch())
6026 else if (
reFsOld_.match(str).hasMatch())
6028 else if (
rePcmt_.match(str).hasMatch())
6030 else if (
reMet_.match(str).hasMatch())
6043 int nYear=0, nMonth=0, nDay=0, nHour=0, nMin=0;
6044 double dSecond=0.0, f=0.0;
6046 QRegularExpressionMatch match;
6053 if (
reFsOld_.match(str).hasMatch())
6055 nDay = str.mid(0,3).toInt(&isOk);
6058 nHour = str.mid(3,2).toInt(&isOk);
6061 nMin = str.mid(5,2).toInt(&isOk);
6064 dSecond = str.mid(7,2).toInt(&isOk);
6074 "::extractEpoch(): looks like not OLD FS format, string: \"" +
asciifyString(str) +
"\"");
6081 if (
reFsNew_.match(str).hasMatch())
6083 nYear = str.mid(0,2).toInt(&isOk);
6086 nDay = str.mid(2,3).toInt(&isOk);
6089 nHour = str.mid(5,2).toInt(&isOk);
6092 nMin = str.mid(7,2).toInt(&isOk);
6095 dSecond = str.mid(9,2).toInt(&isOk);
6098 f = str.mid(11,2).toInt(&isOk);
6102 nYear += (nYear>68)?1900:2000;
6114 "::extractEpoch(): looks like not NEW FS format, string: \"" +
asciifyString(str) +
"\"");
6127 nYear = match.captured(1).toInt(&isOk);
6130 nDay = match.captured(2).toInt(&isOk);
6133 nHour = match.captured(3).toInt(&isOk);
6136 nMin = match.captured(4).toInt(&isOk);
6139 dSecond = match.captured(5).toDouble(&isOk);
6176 "::extractEpoch(): looks like not NEWEST FS format, string: \"" +
asciifyString(str) +
"\"");
6184 if (
rePcmt_.match(str).hasMatch())
6186 QStringList l=str.split(QRegExp(
"\\s+"));
6189 nYear = l.at(0).toInt(&isOk);
6192 nMonth = l.at(1).toInt(&isOk);
6195 nDay = l.at(2).toInt(&isOk);
6198 nHour = l.at(3).toInt(&isOk);
6201 nMin = l.at(4).toInt(&isOk);
6203 dSecond = l.at(5).toDouble(&isOk);
6211 "::extractEpoch(): not enough data for PCMT format, the string: \"" +
6219 "::extractEpoch(): looks like not PCMT format, the string: \"" +
asciifyString(str) +
"\"");
6234 "::extractEpoch(): year has changed: " + QString(
"").setNum(
inYear_) +
" => " +
6235 QString(
"").setNum(nYear) +
"; input: \"" +
asciifyString(str) +
"\"");
6250 "::extractEpoch(): looks like FS format has changed NEWEST=>NEW: \"" +
6264 "::extractEpoch(): looks like FS format has changed NEW=>OLD: \"" +
asciifyString(str) +
"\"");
6271 "::extractEpoch(): failed to parse, string: \"" +
asciifyString(str) +
"\"");
6275 t.
setUpEpoch(nYear, nMonth, nDay, nHour, nMin, dSecond);
6285 return content.size() > 0;
6312 QString metStr(str.mid(reMeteo.match(str).capturedEnd(1)));
6314 if (metStr.contains(
"C"))
6315 metStr = metStr.remove(
"C");
6316 if (metStr.contains(
"mB"))
6317 metStr = metStr.remove(
"mB");
6318 if (metStr.contains(
"%"))
6319 metStr = metStr.remove(
"%");
6320 if (metStr.contains(
"weather:"))
6321 metStr = metStr.remove(
"weather:");
6326 "::extractMeteoReading(): cannot extract meteo data from \"" +
asciifyString(str) +
"\"");
6331 QStringList lst=metStr.split(
",");
6335 const QString &strT =lst.at(oom[0]);
6336 const QString &strP =lst.at(oom[1]);
6337 const QString &strRh=lst.at(oom[2]);
6339 d = strT.toDouble(&isOk);
6342 if (-50.0<=d && d<=80.0)
6345 d = strP.toDouble(&isOk);
6352 "::extractMeteoReading(): the extracted atmospheric pressure looks suspicious: " +
6353 QString(
"").setNum(d) +
"hPa (i.e.,==std.atm.); skipped");
6355 else if (d >= 500.0)
6358 d = strRh.toDouble(&isOk);
6361 if (-9.9<=d && d<=120.0)
6366 "::extractMeteoReading(): the extracted relative humidity looks suspicious: " +
6367 QString(
"").setNum(d) +
"%; adjusted it to zero");
6373 "::extractMeteoReading(): the extracted relative humidity looks suspicious: " +
6374 QString(
"").setNum(d) +
"%; adjusted it to 100%");
6384 "::extractMeteoReading(): the extracted relative humidity looks unrealstic: " +
6385 QString(
"").setNum(d) +
"%; skipped");
6388 else if (strRh.contains(
"EE.0", Qt::CaseInsensitive))
6392 "::extractMeteoReading(): forcefully set relative humidity to 1.00 from the string \"" +
6397 "::extractMeteoReading(): failed to extract relative humidity from \"" + strRh +
"\"");
6403 "::extractMeteoReading(): the extracted atmospheric pressure is too low: " +
6404 QString(
"").setNum(d) +
"hPa; skipped");
6409 "::extractMeteoReading(): failed to extract pressure from \"" + strP +
"\"");
6415 "::extractMeteoReading(): the extracted atmospheric temperature looks unreal: " +
6416 QString(
"").setNum(d) +
"C; skipped");
6421 "::extractMeteoReading(): failed to extract temperature: from \"" + strT +
"\"");
6425 "::extractMeteoReading(): the number of data less than 3: \"" + metStr +
"\"");
6445 sLo = match.captured(1);
6446 pcalOffset = match.captured(2).toDouble(&isOk)*1.0e-6;
6450 "::extractPcalOffsetReading(): station " +
stationName_ +
6451 ": cannot convert \"" + match.capturedEnd(2) +
"\" to double; input: \"" +
6457 if (sLo.size() == 0)
6459 else if (sLo.size() == 1)
6460 los << sLo << sLo +
"0" << sLo +
"1";
6464 for (
int i=0; i<los.size(); i++)
6469 "::extractPcalOffsetReading(): station " +
stationName_ +
6470 ": pcal frequency offset for LO=" + sLo +
" has changed from " +
6472 QString(
"").setNum(pcalOffset) +
"; input: \"" +
6488 QString bbcStr(str.mid(match.capturedEnd(2) + 1));
6489 QString bbcId(match.captured(2));
6494 if (nearTheEnd <= t)
6499 cIdx = bbcId.toInt(&isOk);
6504 ": cannot convert \"" + bbcId +
"\" to int; input: \"" +
asciifyString(str) +
"\"");
6508 QStringList lst=bbcStr.split(
",");
6538 if (3 <= lst.size())
6542 d = lst.at(0).toDouble(&isOk);
6547 ": cannot convert \"" + lst.at(0) +
"\" to double; input: \"" +
6557 ": IF frequency has changed for BBC #" + bbcId +
": " +
6558 QString(
"").sprintf(
"%.2f => %.2f", cs.
bbcFreqByIdx()[cIdx], d) +
6564 d = lst.at(2).toDouble(&isOk);
6569 ": cannot convert \"" + lst.at(2) +
"\" to double; input: \"" +
6578 ": IF bandwidth has changed for BBC #" + bbcId +
": " +
6593 ": got an unexpected \"bbc\" record; input: \"" +
asciifyString(str) +
"\"");
6601 ": the number of data less than 3: \"" + bbcStr +
"\"");
6615 QString vcStr(str.mid(match.capturedEnd(2) + 1));
6620 if (nearTheEnd <= t)
6623 QString bbcId(match.captured(2));
6626 cIdx = bbcId.toInt(&isOk);
6631 ": cannot convert \"" + bbcId +
"\" to int; input: \"" +
asciifyString(str) +
"\"");
6635 QStringList lst=vcStr.split(
",");
6661 d = lst.at(0).toDouble(&isOk);
6666 ": cannot convert \"" + lst.at(0) +
"\" to double; input: \"" +
6676 ": video frequency has changed for IF #" + bbcId +
": " +
6677 QString(
"").sprintf(
"%.2f => %.2f", cs.
bbcFreqByIdx()[cIdx], d) +
6685 d = lst.at(1).toDouble(&isOk);
6690 ": cannot convert \"" + lst.at(2) +
"\" to double; input: \"" +
6700 ": bandwidth has changed for IF #" + bbcId +
": " +
6712 ": got unexpected \"vc\" record; input: \"" +
asciifyString(str) +
"\"");
6720 ": the number of data less than 2: \"" + vcStr +
"\"");
6732 QString loStr(str.mid(match.capturedEnd(1)));
6737 if (nearTheEnd <= t)
6741 QString loId(match.captured(2));
6742 QStringList lst=loStr.split(
",");
6749 if (4 <= lst.size())
6752 d = lst.at(1).toDouble(&isOk);
6757 ": cannot convert \"" + lst.at(1) +
"\" to double; input: \"" +
asciifyString(str) +
"\"");
6765 "::extractLoReading(): station " +
stationName_ +
": LO frequency changed for LO \"" + loId +
6767 QString(
"").sprintf(
"%.2f", cs.
loFreqById()[loId]) +
" => " +
6768 QString(
"").sprintf(
"%.2f", d) +
"; input: \"" +
asciifyString(str) +
"\"");
6771 const QString &sb=lst.at(2);
6772 const QString &pz=lst.at(3);
6776 else if (sb ==
"lsb")
6783 ": cannot figure out side band form the string \"" +
asciifyString(str) +
"\"");
6788 else if (pz ==
"lcp")
6795 ": cannot figure out polarization form the string \"" +
asciifyString(str) +
"\"");
6797 if (5 <= lst.size())
6799 d = lst.at(4).toDouble(&isOk);
6804 ": cannot convert \"" + lst.at(4) +
"\" to double; input: \"" +
asciifyString(str) +
"\"");
6819 ": the number of data less than 4: \"" + loStr +
"\"");
6833 QString loStr(str.mid(match.capturedEnd(1)));
6838 if (nearTheEnd <= t)
6842 QString loId(match.captured(2));
6843 QStringList lst=loStr.split(
",");
6853 if (3 <= lst.size())
6856 d = lst.at(1).toDouble(&isOk);
6861 ": cannot convert \"" + lst.at(1) +
"\" to double; input: \"" +
asciifyString(str) +
"\"");
6868 "::extractLoRxgReading(): station " +
stationName_ +
": frequency changed for LO \"" + loId +
6870 QString(
"").sprintf(
"%.2f", cs.
loFreqById()[loId]) +
" => " +
6871 QString(
"").sprintf(
"%.2f", d) +
"; input: \"" +
asciifyString(str) +
"\"");
6875 const QString &pz=lst.at(2);
6880 else if (pz ==
"lcp")
6885 ": cannot figure out polarization form the string \"" +
asciifyString(str) +
"\"");
6890 "::extractLoRxgReading(): station " +
stationName_ +
": polarization changed for LO \"" +
6900 ": the number of data less than 3: \"" + loStr +
"\"");
6913 QString patchStr(str.mid(match.capturedEnd(1)));
6917 if (nearTheEnd <= t)
6921 QStringList lst=patchStr.split(
",");
6933 QString loId(lst.at(0));
6935 for (
int i=1; i<lst.size(); i++)
6937 QString cid(lst.at(i));
6938 QChar sb(cid.at(cid.size() - 1));
6939 if (sb ==
'l' || sb ==
'h')
6943 cIdx = cid.toInt(&isOk);
6948 ": cannot convert \"" + cid +
"\" to int; input: \"" +
asciifyString(str) +
"\"");
6978 const QRegularExpressionMatch& match,
6983 if (nearTheEnd <= t)
6988 double skyFrq=-1.0, loFrq=-1.0, videoFrq=-1.0;
6989 QString bbcId(match.captured(1));
6991 cIdx = bbcId.toInt(&isOk);
6995 "::extractChanSkyFrqReading(): station " +
stationName_ +
6996 ": cannot get channel index; input: \"" +
asciifyString(str) +
"\"");
6999 skyFrq = match.captured(2).toDouble(&isOk);
7003 "::extractChanSkyFrqReading(): station " +
stationName_ +
7004 ": cannot get sky frequency; input: \"" +
asciifyString(str) +
"\"");
7007 loFrq = match.captured(3).toDouble(&isOk);
7011 "::extractChanSkyFrqReading(): station " +
stationName_ +
7012 ": cannot get LO frequency; input: \"" +
asciifyString(str) +
"\"");
7015 videoFrq = match.captured(4).toDouble(&isOk);
7019 "::extractChanSkyFrqReading(): station " +
stationName_ +
7020 ": cannot get video frequency; input: \"" +
asciifyString(str) +
"\"");
7024 QString loId(
""), cId(
"");
7025 char sbIds[2] = {
'l',
'u'};
7038 for (
int i=0; i<2; i++)
7040 cId = QString(
"").sprintf(
"%02d%c", cIdx, sbIds[i]);
7046 "::extractChanSkyFrqReading(): station " +
stationName_ +
7047 ": video frequency has changed for IF #" + bbcId +
": " +
7048 QString(
"").sprintf(
"%.2f => %.2f", cs.
bbcFreqByIdx()[cIdx], videoFrq) +
7057 if (1.0e-2 < fabs(loFrq + videoFrq - skyFrq))
7059 "::extractChanSkyFrqReading(): station " +
stationName_ +
7060 ": got unexpected frequency setup; input: \"" +
asciifyString(str) +
"\"");
7071 "::extractChanSkyFrqReading(): station " +
stationName_ +
7072 ": got unexpected \"setup\" record (expected type #" + QString(
"").setNum(cs.
getHwType()) +
7088 QString targetStr(str.mid(match.capturedEnd(2) + 1));
7093 if (nearTheEnd <= t)
7098 QString bbcId(match.captured(2));
7099 cIdx = bbcId.toInt(&isOk);
7104 ": cannot convert \"" + bbcId +
"\" to int; input: \"" +
asciifyString(str) +
"\"");
7109 QStringList lst=targetStr.split(
",");
7110 if (2 <= lst.size())
7114 d = lst.at(0).toDouble(&isOk);
7118 "::extractVciReading(): station " +
stationName_ +
": cannot convert \"" + lst.at(0) +
7130 ": video frequency has changed for IF #" + bbcId +
": " +
7131 QString(
"").sprintf(
"%.2f => %.2f", cs.
bbcFreqByIdx()[cIdx], d) +
7136 QString ss(lst.at(1));
7139 QString pc(ss.at(ss.size() - 1));
7157 d = ss.toDouble(&isOk);
7161 "::extractVciReading(): station " +
stationName_ +
": cannot convert \"" + lst.at(2) +
7172 "::extractVciReading(): station " +
stationName_ +
": found unused channel #" +
7173 QString(
"").sprintf(
"%02d", cIdx) +
7174 ", attached it to the LO \"b\"; input: \"" +
asciifyString(str) +
"\"");
7184 ": got unexpected \"vci\" record; input: \"" +
asciifyString(str) +
"\"");
7192 ": the number of data less than 2; input: \"" +
asciifyString(str) +
"\"");
7202 SgMJD& t, QMap<QString, float>& tSys,
const SgMJD& tAtTheBegin)
7206 QRegularExpression reNoData(
"\\$+");
7207 QRegularExpression reNotASensor(
"i([0-9A-Za-z])+");
7208 QRegularExpression reDualSideBand(
"([0-9A-Za-z])+d");
7213 if (t < tAtTheBegin)
7216 QRegularExpressionMatch match;
7217 QString tsysStr(str.mid(reTsys.match(str).capturedEnd(1)));
7219 if (!tsysStr.size())
7223 ": cannot extract tsys data from \"" +
asciifyString(str) +
"\"");
7228 QStringList lst=tsysStr.split(
",");
7232 ": got odd number of tsys readings: \"" +
asciifyString(str) +
"\"");
7235 int numOfRecs=lst.size()/2;
7236 for (
int i=0; i<numOfRecs; i++)
7238 const QString &strIdx=lst.at(2*i);
7239 const QString &strVal=lst.at(2*i + 1);
7240 QString chanId(strIdx);
7246 if (!reNotASensor.match(strIdx).hasMatch())
7248 if (reNoData.match(strVal).hasMatch())
7254 f = strVal.toFloat(&isOk);
7257 QString sensorKey(
"");
7259 if ((match=reDualSideBand.match(strIdx)).hasMatch())
7261 QString sss(match.captured(1));
7262 sensorKey =
setupTpSensor(sss +
"u",
"extractTsysReading()", str);
7263 if (sensorKey.size())
7265 tSys.insert(sensorKey, f);
7271 sensorKey =
setupTpSensor(sss +
"l",
"extractTsysReading()", str);
7272 if (sensorKey.size())
7274 tSys.insert(sensorKey, f);
7283 sensorKey =
setupTpSensor(strIdx,
"extractTsysReading()", str);
7284 if (sensorKey.size())
7285 tSys.insert(sensorKey, f);
7292 "::extractTsysReading(): station " +
stationName_ +
": tsysVal #" + QString(
"").setNum(i) +
7293 " is empty of tsys readings: \"" +
asciifyString(str) +
"\"");
7298 "::extractTsysReading(): station " +
stationName_ +
": chanKey #" + QString(
"").setNum(i) +
7299 " is empty of tsys readings: \"" +
asciifyString(str) +
"\"");
7309 SgMJD& t, QMap<QString, float>& tSys,
const SgMJD& tAtTheBegin)
7313 QRegularExpression reNoData(
"\\$+");
7314 QRegularExpression reNoChan(
"(AV|SM)(\\w)(\\d)");
7318 if (t < tAtTheBegin)
7321 QString tsysStr(str.mid(reTsys.match(str).capturedEnd(1)));
7323 if (!tsysStr.size())
7326 "::extractTsysVgosReading(): station " +
stationName_ +
7327 ": cannot extract tsys data from \"" +
asciifyString(str) +
"\"");
7332 QStringList lst=tsysStr.split(
",");
7335 "::extractTsysVgosReading(): station " +
stationName_ +
7336 ": got odd number of tsys readings: \"" +
asciifyString(str) +
"\"");
7346 int numOfRecs=lst.size()/2;
7347 for (
int i=0; i<numOfRecs; i++)
7349 const QString &strIdx=lst.at(2*i);
7350 const QString &strVal=lst.at(2*i + 1);
7356 if (!reNoChan.match(strIdx).hasMatch() && !reNoData.match(strIdx).hasMatch())
7358 if (reNoData.match(strVal).hasMatch())
7364 f = strVal.toFloat(&isOk);
7368 QString sensorKey=
setupTpSensor(strIdx,
"extractTsysVgosReading()", str);
7369 if (sensorKey.size())
7370 tSys.insert(sensorKey, f);
7376 "::extractTsysVgosReading(): station " +
stationName_ +
": tsysVal #" + QString(
"").setNum(i) +
7377 " is empty of tsys readings: \"" +
asciifyString(str) +
"\"");
7381 "::extractTsysVgosReading(): station " +
stationName_ +
": chanKey #" + QString(
"").setNum(i) +
7382 " is empty of tsys readings: \"" +
asciifyString(str) +
"\"");
7390 "::extractTsysVgosReading(): station " +
stationName_ +
7391 ": got an unexpected \"bbc\" record; input: \"" +
asciifyString(str) +
"\"");
7402 const QString& inputString)
7404 const double rdbeChannelBandwidth=32.0;
7417 double loFreq=-9999.9, ifFreq=-9999.9, ifBw=-9.9;
7421 QString chanId(sensorTag.simplified().rightJustified(6,
' '));
7423 QChar cSideBand(
'-');
7424 QString sFreqSfx(
""), sPlrzSfx(
"x"), sLoSBndSfx(
"x"), sIfSBndSfx(
"x");
7430 QString cPlrz=sensorTag.at(sensorTag.size() - 1);
7431 QString cBand=sensorTag.at(sensorTag.size() - 2);
7432 QString sIdx =sensorTag.left(sensorTag.size() - 2);
7433 loId = QString(cBand) + cPlrz;
7439 else if (cBand ==
'b')
7441 else if (cBand ==
'c')
7443 else if (cBand ==
'd')
7445 else if (cBand ==
'e')
7447 else if (cBand ==
'f')
7449 else if (cBand ==
'g')
7451 else if (cBand ==
'h')
7457 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7458 ": get unexpected LO key \"" + cBand +
7459 "\"; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7463 sensorIdx = sIdx.toInt(&isOk);
7465 sensorIdx += offset;
7469 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7470 ": cannot convert \"" + sIdx +
"\" to int; the tag is \"" +
7471 asciifyString(sensorTag) +
"\", VGOS; input: \"" + inputString +
"\"");
7477 else if (cPlrz ==
'1')
7483 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7484 ": cannot figure out RDBE polarization from \"" + cPlrz +
"\"; the tag is: \"" +
7485 asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7489 ifFreq = 512.0 + rdbeChannelBandwidth/2.0 + rdbeChannelBandwidth*(sensorIdx%16);
7491 ifFreq = 512.0 + rdbeChannelBandwidth/2.0 + rdbeChannelBandwidth*(15 - sensorIdx%16);
7495 ifBw = rdbeChannelBandwidth;
7499 QString sIdx=sensorTag.left(sensorTag.size() - 1);
7500 cSideBand = sensorTag.at(sensorTag.size() - 1);
7505 sensorIdx = sIdx.toInt(&isOk);
7507 sensorIdx = sIdx.toInt(&isOk, 16);
7510 sensorIdx = sIdx.toInt(&isOk, 16);
7514 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7515 ": cannot convert \"" + sIdx +
"\" to int; the tag is \"" +
7516 sensorTag +
"\", other; input: \"" + inputString +
"\"");
7525 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7526 ": cannot find LO id for the sensorIdx " + QString(
"").setNum(sensorIdx) +
7527 "; the tag is \"" + sensorTag +
"\"; input: \"" + inputString +
"\"");
7536 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7537 ": LO polarization for LO \"" + loId +
"\" is not defined; the tag is: \"" +
7538 asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7548 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7549 ": cannot find BBC frequency for the sensorIdx " + QString(
"").setNum(sensorIdx) +
7550 "; the tag is \"" + sensorTag +
"\"; input: \"" + inputString +
"\"");
7559 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7560 ": cannot find BBC bandwidth for the sensorIdx " + QString(
"").setNum(sensorIdx) +
7561 "; the tag is \"" + sensorTag +
"\"; input: \"" + inputString +
"\"");
7565 if (cSideBand.toLower() ==
'u')
7567 else if (cSideBand.toLower() ==
'l')
7569 else if (cSideBand.toLower() ==
'd')
7574 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7575 ": cannot guess sideband; the tag is \"" + sensorTag +
"\"; input: \"" + inputString +
"\"");
7587 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7588 ": LO frequency for LO \"" + loId +
"\" is not defined; the tag is: \"" +
7589 asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7595 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7596 ": LO sideband for LO \"" + loId +
"\" is not defined; the tag is: \"" +
7597 asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7605 sFreqSfx.sprintf(
"%08.1f-%08.1f:%05.1f", loFreq, ifFreq, ifBw);
7613 QString sensorKey(
"");
7614 sensorKey.sprintf(
"%08.1f-", skyFrq);
7616 sensorKey += sPlrzSfx +
'-' + loId +
'-' + sLoSBndSfx +
'-' + sIfSBndSfx +
'-' + chanId +
'-' + sFreqSfx;
7630 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7631 ": got new LO ID \"" + loId +
"\" for sensor key \"" + sensorKey +
7633 "\"; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7649 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7650 ": got new LO frequency " +
7651 QString(
"").sprintf(
"%8.1f", loFreq) +
" for sensor \"" +
7652 chanId +
"\", with the sensor key \"" + sensorKey +
7653 "\", the previous one is " +
7655 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7670 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7671 ": got new LO sideband " +
7673 chanId +
"\", with the sensor key \"" + sensorKey +
7674 "\", the previous one is " +
7676 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7690 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7691 ": got new LO polarization " +
7693 chanId +
"\", with the sensor key \"" + sensorKey +
7694 "\", the previous one is " +
7696 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7712 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7713 ": got new IF frequency " +
7714 QString(
"").sprintf(
"%8.1f", ifFreq) +
" for sensor \"" +
7715 chanId +
"\", with the sensor key \"" + sensorKey +
7716 "\", the previous one is " +
7718 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7734 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7735 ": got new IF bandwidth " +
7736 QString(
"").sprintf(
"%8.1f", ifBw) +
" for sensor \"" +
7737 chanId +
"\", with the sensor key \"" + sensorKey +
7738 "\", the previous one is " +
7740 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7755 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7757 chanId +
", for the channel key \"" + sensorKey +
7759 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7774 if (cs.
ifIdxById()[chanId] != sensorIdx)
7777 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7778 ": got new value, " +
7779 QString(
"").setNum(sensorIdx) +
", for the channel id \"" + chanId +
7780 "\", the previous one is " +
7781 QString(
"").setNum(cs.
ifIdxById()[chanId]) +
7782 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7803 "::setupTpSensor(): station " +
stationName_ +
", caller " + callerName +
7804 ": got new sideband, " +
7805 sideBand2Str(ifSBnd) +
", for the channel id \"" + chanId +
7806 "\", the previous one is " +
7808 "; the tag is \"" +
asciifyString(sensorTag) +
"\"; input: \"" + inputString +
"\"");
7824 SgMJD& t, QMap<QString, QVector<int> >& tPcont,
const SgMJD& tAtTheBegin)
7829 QRegularExpression reNoData(
"\\$+");
7835 if (t < tAtTheBegin)
7838 QString tpcontStr(str.mid(reTpcont.match(str).capturedEnd(1)));
7840 if (!tpcontStr.size())
7843 "::extractTpcontVgosReading(): station " +
stationName_ +
7844 ": cannot extract tpcont data from \"" +
asciifyString(str) +
"\"");
7849 QStringList lst=tpcontStr.split(
",");
7852 "::extractTpcontVgosReading(): station " +
stationName_ +
7853 ": got odd number of tpcont readings: \"" +
asciifyString(str) +
"\"");
7865 int numOfRecs=lst.size()/3;
7866 for (
int i=0; i<numOfRecs; i++)
7868 const QString &strIdx=lst.at(3*i);
7869 const QString &strValOn=lst.at(3*i + 1);
7870 const QString &strValOf=lst.at(3*i + 2);
7872 if (strIdx.size() && strValOn.size() && strValOf.size())
7874 if (reNoData.match(strValOn).hasMatch())
7880 nOn = strValOn.toInt(&isOk);
7882 if (isOk && reNoData.match(strValOf).hasMatch())
7888 nOf = strValOf.toInt(&isOk);
7892 QString sensorKey=
setupTpSensor(strIdx,
"extractTpcontVgosReading()",
7897 if (sensorKey.size())
7898 tPcont.insert(sensorKey, QVector<int>(v));
7903 if (strIdx.size() == 0)
7905 "::extractTpcontVgosReading(): station " +
stationName_ +
": chanKey #" +
7906 QString(
"").setNum(i) +
" is empty of tpcont readings: \"" +
asciifyString(str) +
"\"");
7908 if (strValOn.size())
7910 "::extractTpcontVgosReading(): station " +
stationName_ +
": tpcalon #" +
7911 QString(
"").setNum(i) +
" is empty of tpcont readings: \"" +
asciifyString(str) +
"\"");
7913 if (strValOf.size())
7915 "::extractTpcontVgosReading(): station " +
stationName_ +
": tpcaloff #" +
7916 QString(
"").setNum(i) +
" is empty of tpcont readings: \"" +
asciifyString(str) +
"\"");
7926 "::extractTpcontVgosReading(): station " +
stationName_ +
7927 ": got an unexpected \"bbc\" record; input: \"" +
asciifyString(str) +
"\"");
7942 QRegularExpression reNoData(
"\\$+");
7947 if (t < tAtTheBegin)
7951 QString pcalStr(str.mid(match.capturedEnd(1)));
7953 if (!pcalStr.size())
7956 "::extractPcalVgosReading(): station " +
stationName_ +
7957 ": cannot extract tpcont data from \"" +
asciifyString(str) +
"\"");
7962 QStringList lst=pcalStr.split(
",");
7965 "::extractPcalVgosReading(): station " +
stationName_ +
7966 ": got odd number of tpcont readings: \"" +
asciifyString(str) +
"\"");
7981 int numOfRecs=lst.size()/3;
7982 for (
int i=0; i<numOfRecs; i++)
7984 const QString &strIdx=lst.at(3*i).simplified();
7985 const QString &strValAm=lst.at(3*i + 1);
7986 const QString &strValPh=lst.at(3*i + 2);
7987 QString chanId(strIdx.simplified().rightJustified(8,
' '));
7990 if (strIdx.size() && strValAm.size() && strValPh.size())
7992 if (reNoData.match(strValAm).hasMatch())
7998 dAmp = strValAm.toFloat(&isOk);
8000 if (isOk && reNoData.match(strValPh).hasMatch())
8006 dPhs = strValPh.toFloat(&isOk);
8010 QChar cPlrz(strIdx.at(0));
8011 QChar cBand(strIdx.at(1));
8012 QString loId(cBand);
8013 QString sensorKey(
"");
8014 QString sFreqOffset(
"");
8015 QString sSBndSfx(
"");
8021 loFreq = freqOffset = pcalWidth = -1.0;
8022 hasPcalOffset =
false;
8031 "::extractPcalVgosReading(): station " +
stationName_ +
": " +
8032 "frequency for LO \"" + loId +
"\" is not defined; the tag is: \"" + loId +
8040 "::extractPcalVgosReading(): station " +
stationName_ +
8041 ": LO sideband for LO \"" + loId +
"\" is not defined; the tag is: \"" +
8049 "::extractPcalVgosReading(): station " +
stationName_ +
8050 ": pcal width for LO \"" + loId +
"\" is not defined; the tag is: \"" +
8057 hasPcalOffset =
true;
8062 hasPcalOffset =
true;
8067 hasPcalOffset =
true;
8071 "::extractPcalVgosReading(): station " +
stationName_ +
8072 ": pcal offset for LO \"" + loId +
"\" is not defined; the tag is: \"" +
8077 sFreqOffset.sprintf(
"%04.1f:%04.1f", freqOffset, pcalWidth);
8078 sensorKey.sprintf(
"%08.1f-", loFreq);
8080 sensorKey += cPlrz +
'-' + loId +
'-' + sSBndSfx +
'-' + chanId +
'-' + sFreqOffset;
8091 "::extractPcalVgosReading(): station " +
stationName_ +
": get new id, " +
8092 chanId +
", for the channel key \"" + sensorKey +
8093 "\", the previous one is " +
8111 "::extractPcalVgosReading(): station " +
stationName_ +
": LO frequency changed from " +
8112 QString(
"").sprintf(
"%.1f to %.1f",
8114 " for the pcal key \"" + sensorKey +
"; input: \"" +
asciifyString(str) +
"\"");
8118 else if (0.0 < loFreq)
8128 "::extractPcalVgosReading(): station " +
stationName_ +
": LO sideband changed from " +
8131 " for the pcal key \"" + sensorKey +
"; input: \"" +
asciifyString(str) +
"\"");
8141 else if (cPlrz ==
'1')
8147 "::extractPcalVgosReading(): station " +
stationName_ +
8148 ": cannot figure out polarization from \"" + strIdx +
8159 "::extractPcalVgosReading(): station " +
stationName_ +
": frequency offset changed from " +
8160 QString(
"").sprintf(
"%.1f to %.1f",
8162 " for the pcal key \"" + sensorKey +
"; input: \"" +
asciifyString(str) +
"\"");
8166 else if (hasPcalOffset)
8176 "::extractPcalVgosReading(): station " +
stationName_ +
": width changed from " +
8177 QString(
"").sprintf(
"%.1f to %.1f",
8179 " for the pcal key \"" + sensorKey +
"; input: \"" +
asciifyString(str) +
"\"");
8183 else if (0.0 < pcalWidth)
8188 float *f=
new float[2];
8195 "::extractPcalVgosReading(): station " +
stationName_ +
": cannot convert str \"" +
8196 strIdx.mid(2) +
"\" to int; input: \"" +
asciifyString(str) +
"\"");
8200 if (strIdx.size() == 0)
8202 "::extractPcalVgosReading(): station " +
stationName_ +
": sensorKey #" + QString(
"").setNum(i) +
8203 " is empty of tpcont readings: \"" +
asciifyString(str) +
"\"");
8205 if (strValAm.size())
8207 "::extractPcalVgosReading(): station " +
stationName_ +
": amplitude #" + QString(
"").setNum(i) +
8208 " is empty of tpcont readings: \"" +
asciifyString(str) +
"\"");
8210 if (strValPh.size())
8212 "::extractPcalVgosReading(): station " +
stationName_ +
": phase #" + QString(
"").setNum(i) +
8213 " is empty of tpcont readings: \"" +
asciifyString(str) +
"\"");
8224 const QRegularExpressionMatch& match,
SgMJD& t, QString& sKey,
float& dot2xps,
8225 const SgMJD& tAtTheBegin,
bool& isGps)
8232 if (t < tAtTheBegin)
8235 sKey = match.captured(1);
8236 QString cap2(match.captured(2));
8237 QString cap3(match.captured(3));
8239 isGps = cap2 ==
"g";
8240 f = cap3.toFloat(&isOk);
8245 "::extractDot2xpsVgosReading(): station " +
stationName_ +
": cannot convert \"" + cap3 +
8265 if (t < tAtTheBegin)
8272 if ((s=match.captured(1)).size())
8274 d = s.toDouble(&isOk);
8278 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8282 if ((s=match.captured(2)).size())
8284 d = s.toDouble(&isOk);
8288 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8292 if ((s=match.captured(3)).size())
8294 d = s.toDouble(&isOk);
8298 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8302 if ((s=match.captured(4)).size())
8304 d = s.toDouble(&isOk);
8308 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8319 SgMJD& t, QString& sensorId, QString& srcName,
double& az,
double& de, QVector<double>& vec,
8320 const SgMJD& tAtTheBegin)
8324 QString sensorTag(match.captured(4));
8327 QRegularExpression notATag(
"i[A-Za-z0-9]");
8331 if (t < tAtTheBegin)
8333 if (notATag.match(sensorTag).hasMatch())
8340 srcName = match.captured(1);
8341 QString sensorKey=
setupTpSensor(sensorTag,
"extractSefdReading()", str);
8342 if (!sensorKey.size())
8346 sensorId = sensorKey;
8349 if ((s=match.captured(2)).size())
8351 d = s.toDouble(&isOk);
8355 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8360 if ((s=match.captured(3)).size())
8362 d = s.toDouble(&isOk);
8366 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8371 for (
int i=0; i<6; i++)
8373 if ((s=match.captured(7 + i)).size())
8375 d = s.toDouble(&isOk);
8379 ": cannot convert to double: \"" + s +
"\"; input: \"" +
asciifyString(str) +
"\"");
8391 SgMJD& t,
double& v)
8397 QString strCableVal(match.captured(2));
8400 if (strCableVal.endsWith(
'-'))
8401 strCableVal.chop(1);
8402 v = strCableVal.toDouble(&isOk);
8405 "::extractCableCalibration(): failed to extract cable calibration value from \"" +
8406 strCableVal +
"\"");
8407 else if (fabs(v) > 1.0e6)
8412 "::extractCableCalibration(): the exctracted value looks suspicious: \"" +
8413 strCableVal +
"\", skipped");
8424 const QRegularExpressionMatch& match,
SgMJD& t,
double& v, QString& source, QString& scan)
8426 int nYear=0, nMonth=0, nDay=0, nHour=0, nMin=0;
8427 double dSecond=0.0, f=0.0;
8431 nYear = match.captured(1).toInt(&isOk);
8434 nMonth = match.captured(2).toInt(&isOk);
8437 nDay = match.captured(3).toInt(&isOk);
8440 nHour = match.captured(4).toInt(&isOk);
8443 nMin = match.captured(5).toInt(&isOk);
8446 dSecond = match.captured(6).toDouble(&isOk);
8448 t.
setUpEpoch(nYear, nMonth, nDay, nHour, nMin, dSecond);
8456 "::extractDataFromPcmtRecord(): failed to extract epoch from the string \"" +
asciifyString(str) +
"\"");
8460 f = match.captured(7).toDouble(&isOk);
8464 source = match.captured(8);
8465 if (match.lastCapturedIndex() >= 9)
8466 scan = match.captured(9);
8468 std::cout <<
" --- no scan\n";
8472 "::extractDataFromPcmtRecord(): failed to extract cable cal value from the string \"" +
8485 int nYear=0, nMonth=0, nDay=0, nHour=0, nMin=0;
8486 double dSecond=0.0, f=0.0;
8489 nYear = match.captured(1).toInt(&isOk);
8492 nMonth = match.captured(2).toInt(&isOk);
8495 nDay = match.captured(3).toInt(&isOk);
8498 nHour = match.captured(4).toInt(&isOk);
8501 nMin = match.captured(5).toInt(&isOk);
8504 dSecond = match.captured(6).toDouble(&isOk);
8506 t.
setUpEpoch(nYear, nMonth, nDay, nHour, nMin, dSecond);
8514 "::extractDataFromMetRecord(): failed to extract epoch from the string \"" +
8519 f = match.captured(7).toDouble(&isOk);
8523 f = match.captured(8).toDouble(&isOk);
8527 f = match.captured(9).toDouble(&isOk);
8532 "::extractDataFromMetRecord(): failed to extract relative humidity from the string \"" +
8538 "::extractDataFromMetRecord(): failed to extract pressure from the string \"" +
8544 "::extractDataFromMetRecord(): failed to extract temperature from the string \"" +
8559 QString strCableDiff(match.captured(2));
8560 QString strCableSign(match.captured(3));
8562 d = strCableDiff.toDouble(&isOk);
8565 if (fabs(d) < 1.0e6)
8567 if (strCableSign.contains(
"-"))
8569 else if (strCableSign.contains(
"+"))
8573 "::extractCableCalibrationSignByDiff(): get unusable cable sign char sequence: \"" +
8574 strCableSign +
"\"");
8580 "::extractCableCalibrationSignByDiff(): the cable diff is too big: \"" + strCableDiff +
"\"");
8585 "::extractCableCalibrationSignByDiff(): cannot convert diff to double: \"" + strCableDiff +
"\"");
8593 const SgMJD& tFinis,
const QString& rinexStnName)
8595 const QString eoh(
"END OF HEADER");
8596 QString path2Rinex(
"");
8598 int idx=fileName.lastIndexOf(
"/");
8600 path2Rinex = fileName.left(idx);
8602 QDir dir(path2Rinex);
8603 QStringList nameFilters;
8605 nameFilters << rinexStnName +
"*.??m";
8606 QStringList nameList=dir.entryList(nameFilters,
8607 QDir::Files | QDir::Readable, QDir::Name | QDir::IgnoreCase);
8608 if (!nameList.size())
8611 "::checkRinexFile(): no RINEX file found");
8616 "::checkRinexFile(): processing RINEX files for the station " +
stationName_);
8624 QRegExp reData(
"\\s*(\\d{1,2})\\s+(\\d{1,2})\\s+(\\d{1,2})\\s+"
8625 "(\\d{1,2})\\s+(\\d{1,2})\\s+(\\d{1,2})\\s+"
8626 "(\\d{1,4}\\.\\d+)\\s+([+-\\.\\d]+)\\s+([+-]?[\\.\\d]+)(?:\\s+|$|-99)",
8627 Qt::CaseInsensitive);
8628 int nYr, nMn, nDy, nHr, nMi, nSc;
8629 double fPr, fTp, fRh;
8640 "::checkRinexFile(): using offset of " + QString(
"").setNum(dP) +
" mbar for atmospheric "
8644 for (
int i=0; i<nameList.size(); i++)
8646 const QString &fn=nameList.at(i);
8649 "::checkRinexFile(): processing " + fn +
" file");
8652 f.setFileName(path2Rinex +
"/" + fn);
8653 if (f.open(QFile::ReadOnly))
8657 while (!s.atEnd() && !str.contains(eoh))
8663 "::checkRinexFile(): skipped " + QString(
"").setNum(idx) +
" strings");
8666 nYr = nMn = nDy = nHr = nMi = nSc = 0;
8667 fPr = fTp = fRh = 0.0;
8669 if (reData.indexIn(str) != -1)
8671 nYr = reData.cap(1).toInt(&isOk);
8674 nMn = reData.cap(2).toInt(&isOk);
8677 nDy = reData.cap(3).toInt(&isOk);
8680 nHr = reData.cap(4).toInt(&isOk);
8683 nMi = reData.cap(5).toInt(&isOk);
8686 nSc = reData.cap(6).toInt(&isOk);
8689 fPr = reData.cap(7).toDouble(&isOk);
8692 fTp = reData.cap(8).toDouble(&isOk);
8695 fRh = reData.cap(9).toDouble(&isOk);
8698 SgMJD t(nYr, nMn, nDy, nHr, nMi, (
double)nSc);
8699 if (tStart<=t && t<= tFinis)
8706 "::checkRinexFile(): the extracted relative humidity looks "
8707 "suspicious: " + QString(
"").setNum(fRh) +
"%; adjusted it to zero");
8710 else if (100.0 < fRh)
8713 "::checkRinexFile(): the extracted relative humidity looks "
8714 "suspicious: " + QString(
"").setNum(fRh) +
"%; adjusted it to 100%");
8728 "::checkRinexFile(): cannot convert relative humidity to double, "
8729 "string=\"" + reData.cap(9) +
"\"");
8733 "::checkRinexFile(): cannot convert temperature to double, string=\"" +
8734 reData.cap(8) +
"\"");
8738 "::checkRinexFile(): cannot convert pressure to double, string=\"" +
8739 reData.cap(7) +
"\"");
8743 "::checkRinexFile(): cannot convert second to int, string=\"" +
8744 reData.cap(6) +
"\"");
8748 "::checkRinexFile(): cannot convert minute to int, string=\"" +
8749 reData.cap(5) +
"\"");
8753 "::checkRinexFile(): cannot convert hour to int, string=\"" + reData.cap(4) +
"\"");
8757 "::checkRinexFile(): cannot convert day to int, string=\"" + reData.cap(3) +
"\"");
8761 "::checkRinexFile(): cannot convert month to int, string=\"" + reData.cap(2) +
"\"");
8765 "::checkRinexFile(): cannot convert year to int, string=\"" + reData.cap(1) +
"\"");
8771 "::checkRinexFile(): extracted " + QString(
"").setNum(count) +
" meteo records from " +
8772 QString(
"").setNum(idx) +
" strings of " + f.fileName() +
" RINEX file");
8777 "::checkRinexFile(): unable to read the file \"" + f.fileName() +
"\"");
8791 bool createAntabFile,
bool overwriteAntabFile,
bool reportAllReadings)
8808 "::propagateData(): the cable calibration data for " + stn->
getKey() +
" are CDMS");
8813 "::propagateData(): both /cable/ and /CDMS/ commands were found for " + stn->
getKey() +
8814 " in the log file");
8830 int numOfReadStrs=0;
8831 bool reachedEndOfSession=
false;
8832 QRegularExpressionMatch match;
8836 QString sEpoch(
"(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):([0-9\\.]+)\\s*UTC\\s*");
8837 QString sSep(
"\\s*,\\s*");
8838 QString sDbl(
"([0-9\\.+-]+)");
8842 QRegularExpression reBbc(sEpoch +
":\\s*BBC(\\d+):\\s*" + sDbl + sSep +
8843 "(\\d+)" + sSep +
"(\\w+)" + sSep +
"(\\d+)" + sSep +
"(\\d+)" + sSep +
"(\\d+)" + sSep +
8844 "(\\d+)" + sSep +
"(\\d+)" + sSep +
"(\\d+)" + sSep +
"SEFDU:\\s*" + sDbl +
"\\s*Jy" + sSep +
8845 "SEFDL:\\s*" + sDbl +
"\\s*Jy.*");
8851 QString sensorId(
"");
8852 int nYr, nMn, nDy, nHr, nMi;
8856 double bbcGainU, bbcGainL;
8857 double bbcTPUOn, bbcTPLOn, bbcTPUOff, bbcTPLOff;
8858 double bbcSEFDU, bbcSEFDL;
8860 bool isDataOn=
false;
8861 bool isOnSource=
false;
8866 fileSize = QFileInfo(fileName).size();
8879 ": previously accumulated dbbc3 TP records were reset");
8884 bool have2reportNumOfStrings=10000000 < fileSize;
8885 while (!s.atEnd() && !reachedEndOfSession)
8890 if (have2reportNumOfStrings && numOfReadStrs%200000 == 0)
8891 std::cout <<
" -- read " << numOfReadStrs/1000 <<
"K strings; file size: " << fileSize <<
"\n";
8895 nYr = nMn = nDy = nHr = nMi = 0;
8896 dSc = ifFrq = bw = bbcGainU = bbcGainL = bbcTPUOn =
8897 bbcTPLOn = bbcTPUOff = bbcTPLOff = bbcSEFDU = bbcSEFDL = 0.0;
8899 if ((match=reBbc.match(str)).hasMatch())
8901 agc = match.captured(10);
8903 nYr = match.captured( 1).toInt();
8904 nMn = match.captured( 2).toInt();
8905 nDy = match.captured( 3).toInt();
8906 nHr = match.captured( 4).toInt();
8907 nMi = match.captured( 5).toInt();
8908 dSc = match.captured( 6).toDouble();
8910 sensorId = match.captured(7).simplified().rightJustified(5,
' ');
8912 ifFrq = match.captured( 8).toDouble();
8913 bw = match.captured( 9).toDouble();
8914 bbcGainU = match.captured(11).toDouble();
8915 bbcGainL = match.captured(12).toDouble();
8916 bbcTPUOn = match.captured(13).toDouble();
8917 bbcTPLOn = match.captured(14).toDouble();
8918 bbcTPUOff = match.captured(15).toDouble();
8919 bbcTPLOff = match.captured(16).toDouble();
8920 bbcSEFDU = match.captured(17).toDouble();
8921 bbcSEFDL = match.captured(18).toDouble();
8927 if (osRec && osRec->
tStart()<t)
8932 if (osRec && osRec->
tDataOn()<t)
8938 if (0.1/
DAY2SEC < fabs(lastReadTsys - t))
8942 tp->
setOsRec(isOnSource?osRec:NULL);
8952 tp->
addRecord(sensorId,
"", bw, agc, bbcGainU, bbcGainL, bbcTPUOff, bbcTPLOff,
8953 bbcTPUOn, bbcTPLOn, bbcSEFDU, bbcSEFDL);
8963 "::readDbbc3DumpFile(): station " +
stationName_ +
": " + QString(
"").setNum(numOfReadStrs) +
8964 " strings of the DBBC3 dump file \"" + fileName +
"\" were read");
8966 "::readDbbc3DumpFile(): station " +
stationName_ +
": collected " +
8990 return "SgVlbaLogCollector";
9011 for (QMap<QString, SgStnLogReadings*>::iterator it=
readingsByKey_.begin();
9025 QString stnPattern(
"([\\w]{2})");
9026 QString srcPattern(
"([\\d\\w+-]{2,8})");
9027 QString epcPattern(
"(\\d{3})(?:-|\\s+)(\\d{2}):(\\d{2}):(\\d{2})");
9028 QString dblPattern(
"([+-\\.\\d]+)");
9030 QRegExp rePulseCalInfo(
"PulseCal information for\\s+" + stnPattern +
"\\s+",
9031 Qt::CaseInsensitive);
9032 QRegExp reScanCalInfo(
"Scan information for\\s+" + stnPattern +
"\\s+",
9033 Qt::CaseInsensitive);
9034 QRegExp reWeatherInfo(
"Weather information for\\s+" + stnPattern +
"\\s+",
9035 Qt::CaseInsensitive);
9036 QRegExp rePulseCalData
9037 (epcPattern +
"\\s+'CC'\\s+" + dblPattern +
"\\s+" + dblPattern,
9038 Qt::CaseInsensitive);
9039 QRegExp reScanCalData
9040 (srcPattern +
"\\s+" + epcPattern +
"\\s+" + epcPattern +
"\\s+" +
9041 dblPattern +
"\\s+" + dblPattern +
"\\s+" + dblPattern,
9042 Qt::CaseInsensitive);
9043 QRegExp rePulseScanData
9044 (
"!\\s+" + stnPattern +
"\\s+([\\w\\d+-]+)\\s+" + srcPattern +
"/(\\d+)\\s+" +
9045 epcPattern +
"/" + epcPattern,
9046 Qt::CaseInsensitive);
9047 QRegExp reWeatherData
9048 (epcPattern +
"\\s+" + dblPattern +
"\\s+" + dblPattern +
"\\s+" + dblPattern +
"\\s+" +
9049 dblPattern +
"\\s+" + dblPattern +
"\\s+" + dblPattern +
"\\s+" + dblPattern,
9050 Qt::CaseInsensitive);
9056 bool have2read, isOk;
9063 "::readLogFile(): the log file " + fileName +
" does not exist");
9069 "::readLogFile(): reading log file " + fileName);
9072 if (f.open(QFile::ReadOnly))
9083 if (rePulseCalInfo.indexIn(str) != -1)
9085 key = rePulseCalInfo.cap(1);
9094 while (!s.atEnd() && !str.contains(
" information "))
9099 if (rePulseCalData.indexIn(str) != -1)
9101 if (
strs2mjd(nYear, rePulseCalData.cap(1), rePulseCalData.cap(2),
9102 rePulseCalData.cap(3), rePulseCalData.cap(4), t))
9104 d = rePulseCalData.cap(5).toDouble(&isOk);
9109 "::readLogFile(): failed to extract cable cal value from PulseCalData: \"" +
9114 "::readLogFile(): failed to extract epoch from PulseCalData: \"" + str +
"\"");
9116 if (rePulseScanData.indexIn(str) != -1)
9118 m = rePulseScanData.cap(4).toInt(&isOk);
9123 if (
strs2mjd(nYear, rePulseScanData.cap(5), rePulseScanData.cap(6),
9124 rePulseScanData.cap(7), rePulseScanData.cap(8), t))
9126 if (
strs2mjd(nYear, rePulseScanData.cap(9), rePulseScanData.cap(10),
9127 rePulseScanData.cap(11), rePulseScanData.cap(12), t_aux))
9142 "::readLogFile(): got a duplicate string of PulseScanData: \"" + str +
"\"");
9148 "::readLogFile(): failed to extract epoch_2 from PulseScanData: \"" + str +
"\"");
9152 "::readLogFile(): failed to extract epoch_1 from PulseScanData: \"" + str +
"\"");
9157 "::readLogFile(): failed to extract qualifier value from PulseCalData: \"" + str +
"\"");
9191 if (reWeatherInfo.indexIn(str) != -1)
9193 key = reWeatherInfo.cap(1);
9202 while (!s.atEnd() && !str.contains(
" information "))
9205 if (reWeatherData.indexIn(str) != -1)
9207 if (
strs2mjd(nYear, reWeatherData.cap(1), reWeatherData.cap(2),
9208 reWeatherData.cap(3), reWeatherData.cap(4), t))
9210 double temp, press, dewpt;
9211 temp = reWeatherData.cap(5).toDouble(&isOk);
9214 press = reWeatherData.cap(6).toDouble(&isOk);
9217 dewpt = reWeatherData.cap(7).toDouble(&isOk);
9223 "::readLogFile(): failed to extract dew point from WeatherData: \"" + str +
"\"");
9227 "::readLogFile(): failed to extract pressure from WeatherData: \"" + str +
"\"");
9231 "::readLogFile(): failed to extract temperature from WeatherData: \"" + str +
"\"");
9235 "::readLogFile(): failed to extract epoch from WeatherData: \"" + str +
"\"");
9245 for (QMap<QString, SgStnLogReadings*>::iterator it=
readingsByKey_.begin();
9255 "::readLogFile(): collected logs of " + QString(
"").setNum(
readingsByKey_.size())+
9256 " stations from the log file");
9258 "::readLogFile(): parsing of the log file has been completed");
9267 const QString& sMin,
const QString& sSec,
SgMJD& t)
9273 dy = sDay.toInt(&isOk);
9276 hr = sHr.toInt(&isOk);
9279 mi = sMin.toInt(&isOk);
9282 se = sSec.toInt(&isOk);
9287 "::strs2mjd(): failed to extract seconds from \"" + sSec + +
"\"");
9291 "::strs2mjd(): failed to extract minutes from \"" + sMin + +
"\"");
9295 "::strs2mjd(): failed to extract hours from \"" + sHr + +
"\"");
9299 "::strs2mjd(): failed to extract days from \"" + sDay +
"\"");
9324 "::propagateData(): cannot find VLBA station " + stn->
getKey() +
" (aka " + vlbaKey +
9325 ") in the log file");
9332 "::propagateData(): cannot find a station " + stn->
getKey() +
" in the map of VLBA stations");
9379 {
"BR",
"CA",
"EB",
"FD",
"GA",
"GT",
"HN",
"JV",
"KP",
"LA",
"MK",
"NL",
"OV",
"PT",
"SC" };
9381 {
"BR-VLBA ",
"CAMBRIDG",
"EFLSBERG",
"FD-VLBA ",
"VLBA85_3",
"GBT-VLBA",
"HN-VLBA ",
9382 "JODRELL2",
"KP-VLBA ",
"LA-VLBA ",
"MK-VLBA ",
"NL-VLBA ",
"OV-VLBA ",
"PIETOWN ",
9400 for (
int i=0; i<str.size(); i++)
9403 n = str.at(i).unicode();
9405 s += QString(
"").sprintf(
"\\0x%04X", n);
SgIoExtFilterHandler compressors
const SgMJD tZero(1957, 10, 4)
#define DAY2SEC
radians to mas:
#define RAD2DEG
radians to degrees:
QString asciifyString(const QString &str)
#define NUM_OF_VLBA_ENTRIES
SgVersion libraryVersion("SgLib", 0, 8, 2, "Compton Peak (rc2)", SgMJD(2023, 4, 3, 10, 59))
QString polarization2Str(SgChannelPolarization p)
QString sideBand2Str(SgChannelSideBand sb)
bool isAttr(uint a) const
static const QString className()
void setOsRec(SgOnSourceRecord *os)
const SgMJD & getT() const
const SgOnSourceRecord * getOsRec() const
QMap< QString, double > & pcalOffsetByKey()
QMap< QString, SgChannelPolarization > & loPolarizationByTpSensorKey()
QMap< QString, double > & pcalLoFreqByKey()
QMap< QString, SgChannelSideBand > & ifSideBandById()
QMap< QString, int > & ifIdxById()
QMap< QString, QList< QString > > & origSensorIdById()
QMap< QString, SgChannelPolarization > loPolarizationById_
QMap< QString, double > & pcalWidthByKey()
QMap< QString, SgChannelSideBand > & loSideBandById()
QMap< QString, SgChannelPolarization > & loPolarizationById()
QMap< QString, QString > & loIdByTpSensorKey()
QMap< QString, QString > & ifIdByTpSensorKey()
QMap< QString, double > loFreqByTpSensorKey_
QMap< QString, QString > loIdByCid_
QMap< int, double > & bbcBandwidthByIdx()
QMap< QString, SgChannelPolarization > & pcalPolarizationByKey()
QMap< QString, double > & pcalOffsetByLoId()
void setBackEndType(BackEndType tp)
bool selfCheck(const QString &stnKey)
QMap< int, double > & bbcFreqByIdx()
QMap< QString, QString > & xpsIdByKey()
QMap< QString, double > & loFreqById()
QMap< QString, double > & ifFreqByTpSensorKey()
QMap< QString, QString > & pcalIdByKey()
QMap< QString, double > & loPcWidthById()
QMap< QString, int > ifIdxById_
static double calcSkyFreq(double loFreq, double bbcFreq, double width, SgChannelSideBand loSideBand, SgChannelSideBand ifSideBand)
QMap< QString, double > & ifBandwidthByTpSensorKey()
QMap< QString, SgChannelSideBand > loSideBandById_
QMap< QString, QString > & loIdByCid()
QMap< int, QString > loIdByIdx_
static const QString className()
QMap< int, double > bbcFreqByIdx_
QMap< QString, double > loFreqById_
QMap< int, QString > & loIdByIdx()
QMap< QString, double > & loFreqByTpSensorKey()
QMap< QString, SgChannelPolarization > & ifPolarizationById()
QMap< int, double > & ifFreqByIdx()
QMap< QString, SgChannelSideBand > & pcalSideBandByKey()
QMap< QString, QString > ifIdByTpSensorKey_
BackEndType getBackEndType() const
QMap< int, double > bbcBandwidthByIdx_
QMap< QString, SgChannelSideBand > ifSideBandById_
QMap< QString, SgChannelSideBand > & loSideBandByTpSensorKey()
void setHwType(HwType tp)
const QString & getBandKey() const
const QList< SgChannelSideBand > & getSideBands() const
double getBandWidth() const
const QList< ChanCfg > & getChannelCfgs() const
const QString & getStnKey() const
QMap< QString, StnCfg > stnCfgByKey_
static const QString className()
bool parseSkdFile(const QString &fileName)
void addRecord(const QString &sensorId, const QString &boardId, double bw, const QString &agc, double gainU, double gainL, double tpOffU, double tpOffL, double tpOnU, double tpOnL, double sefdU, double sefdL)
void setOsRec(SgOnSourceRecord *os)
const SgOnSourceRecord * getOsRec() const
const SgMJD & getT() const
void setIsOnSource(bool isOnSource)
void setT(const SgMJD &t)
const QMap< QString, TpRecord > & getTpBySensor() const
void setIsDataOn(bool isDataOn)
void setT(const SgMJD &t)
const SgOnSourceRecord * getOsRec() const
bool addDot2gpsByBrd(const QString &key, float v)
const QMap< QString, float > & getDot2ppsByBrd() const
const QMap< QString, float > & getDot2gpsByBrd() const
bool addDot2ppsByBrd(const QString &key, float v)
void setOsRec(SgOnSourceRecord *os)
const SgMJD & getT() const
const SgIoExternalFilter * lookupFilterByFileName(const QString &fileName)
static void closeFlt(FILE *&p, QFile &file, QTextStream &ts)
FILE * openFlt(const QString &fileName, QFile &file, QTextStream &ts, FilterDirection)
const QString & getDefaultExtension() const
virtual void write(LogLevel, quint32, const QString &, bool=false)
bool isEligible(LogLevel lvl, quint32 f) const
@ F_YYYYMMDDHHMMSSSS
Long verbose: Fri, the 2nd of Apr, 2010; 17hr 02min 43.6400sec.
@ F_Simple
Digits: 2010/04/02 17:02:43.6.
@ F_SOLVE_SPLFL_V3
Another spoolfile represenation of epoch: 2012.01.20-09:14:28.0.
@ F_SOLVE_SPLFL
That was used in ECC.dat files: 2010.04.02-17.02.
@ F_INTERNAL
Digits, date and time: 20100402.71.
QString toString(Format format=F_Verbose) const
void setUpEpoch(int year, int month, int day, int hour, int min, double sec)
double getPressure() const
void setRelativeHumidity(double rho)
double getTemperature() const
void setTemperature(double t)
void setPressure(double p)
static double dewPt2Rho(double temperature, double dewPtTemperature)
double getRelativeHumidity() const
const SgMJD & getT() const
const SgOnSourceRecord * getOsRec() const
void setOsRec(SgOnSourceRecord *os)
static const QString className()
const SgMeteoData & getM() const
const QString & getKey() const
QList< SgCableCalReading * > & cableCals()
QList< SgTsysReading * > & tSyses()
static const QString className()
const SgMJD & getTdataOn() const
const QString & getScanName() const
void setScanName(const QString &str)
const SgMJD & getTfinis() const
void setSourceName(const QString &str)
void setTfinis(const SgMJD &t)
QList< SgDbbc3TpReading * > & dbbc3Tps()
const QString & getSourceName() const
const SgMJD & getTstart() const
void setTstart(const SgMJD &t)
QList< SgMeteoReading * > & meteoPars()
const SgOnSourceRecord * getOsRec() const
void setT(const SgMJD &t)
void setOsRec(SgOnSourceRecord *os)
const QMap< QString, float * > & getPcal() const
static const QString className()
const SgMJD & getT() const
bool addPcals(const QMap< QString, float * > &pcals)
const SgMJD & getT() const
static const QString className()
bool addValByChanKey(const SgMJD &t, const QString &srcName, double az, double el, const QString &chanKey, const QVector< double > &val)
QMap< QString, QVector< double > * > valByChanKey_
const QMap< QString, QVector< double > * > & getValByChanKey() const
const QString & getSrcName() const
QList< QString > & content()
bool extractPcalOffsetReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &tAtTheEnd, SgChannelSetup &cs, const SgMJD &tFirst)
const QMap< QString, double > * rinexPressureOffsetByStn_
const QMap< QString, QString > * rinexFileNameByStn_
static const QRegularExpression reMet_
FieldSystemEpochFormat fsFmt_
bool useSkededChannelSetup_
bool extractTraklReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, SgTraklReading &, const SgMJD &tAtTheBegin)
static const QString className()
bool extractTsysVgosReading(const QString &str, const QRegularExpression &reTsys, SgMJD &t, QMap< QString, float > &tSys, const SgMJD &tAtTheBegin)
static const QRegularExpression reFsOld_
bool extractBbcReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
bool createAntabFile(const QString &stnKey, const QString &outputFileName, bool have2owrt, bool reportAllTsysData)
static const QRegularExpression rePcmt_
bool extractTsysReading(const QString &str, const QRegularExpression &reTsys, SgMJD &t, QMap< QString, float > &tSys, const SgMJD &tAtTheBegin)
bool extractDataFromMetRecord(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, SgMeteoData &m)
bool extractVciReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
bool readDbbc3DumpFile(const QString &fileName)
const QMap< QString, int > * defaultCableSignByStn_
bool extractCableCalibration(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, double &v)
static int fsContentStartsAt_[]
bool extractCableCalibrationSignByDiff(const QRegularExpressionMatch &match, int &v)
QString setupTpSensor(const QString &sensorTag, const QString &callerName, const QString &inputString)
bool propagateData(SgVlbiStationInfo *stn, bool createAntabFile, bool overwriteAntabFile, bool reportAllTsysData)
bool extractContent(const QString &str, QString &content)
QString inputLogFileName_
bool extractVcReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
SgChannelSkeded * channelSkeded_
bool extractPatchReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
bool extractMeteoReading(const QString &str, const QRegularExpression &reMeteo, SgMJD &t, SgMeteoData &m, const int *oom)
FieldSystemEpochFormat guessFsFormat(const QString &str)
bool readLogFile(const QString &fileName, const QString &stnName, const SgMJD &tFirst, const SgMJD &tLast, const QString &orderOfMeteo)
bool extractChanSkyFrqReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
bool extractDot2xpsVgosReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, QString &sKey, float &dot2xps, const SgMJD &tAtTheBegin, bool &isGps)
bool extractPcalVgosReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, QMap< QString, float * > &pcal, SgChannelSetup &cs, const SgMJD &tAtTheBegin)
bool extractEpoch(const QString &str, SgMJD &t)
bool extractLoReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
bool extractDataFromPcmtRecord(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, double &v, QString &source, QString &scan)
static const QRegularExpression reFsNewest_
QMap< QString, Procedure * > procedureByName_
static const QRegularExpression reFsNew_
SgStnLogReadings logReadings_
bool checkRinexFile(const QString &fileName, const SgMJD &tStart, const SgMJD &tFinis, const QString &rinexStnName)
bool extractSefdReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, QString &sensorId, QString &srcName, double &az, double &de, QVector< double > &vec, const SgMJD &tAtTheBegin)
bool extractTpcontVgosReading(const QString &str, const QRegularExpression &reTpcont, SgMJD &t, QMap< QString, QVector< int > > &tPcont, const SgMJD &tAtTheBegin)
bool extractLoRxgReading(const QString &str, const QRegularExpressionMatch &match, SgMJD &t, const SgMJD &atEnd, SgChannelSetup &cs, const SgMJD &tFirst)
const QString & getRecorderInfo() const
QList< SgDbbc3TpReading * > & dbbc3Tps()
static const QString sFiller_
QList< SgTraklReading * > & trakls()
void removeCableCalReadings()
QList< SgDot2xpsReading * > dot2xpses_
QList< SgSefdReading * > sefds_
void export2antabFrqs_vgosSetup(QTextStream &s)
bool createAntabFile(const QString &inputLogFileName, const QString &outputFileName, const QString &stnKey, const SgChannelSkeded *channelSkeded, bool useSkededChannelSetup, bool have2overwrite, bool reportAllTsysData)
void export2antCalFrqs_vgosSetup(QTextStream &s)
QList< SgCableCalReading * > & cableCals()
void removeMeteoReadings()
void export2antabFrqs_skededSetup(QTextStream &s, const SgChannelSkeded::StnCfg &sCfg)
void allocateCableReadings()
QList< SgTsysReading * > & tSyses()
bool createAntCalFile(const QString &inputLogFileName, const QString &outputFileName, const QString &stnKey, const SgChannelSkeded *channelSkeded, bool useSkededChannelSetup, bool have2overwrite, bool reportAllReadings, bool supressNonUsedSensors, int antcalOutputData, const QString &ext4compress, const QString &userCommand)
void cleanCableCalibrations()
void interpolateMeteoParameters(SgVlbiAuxObservation *aux)
void setCableCalAmbig(double a)
void export2antabFrqs_nativeSetup(QTextStream &s)
QList< SgPcalReading * > pcals_
int determineCableSignFromLong()
static const QString className()
QList< SgSefdReading * > & sefds()
QList< SgDbbc3TpReading * > dbbc3Tps_
void export2antabFrqs_missedSetup(QTextStream &s)
static const double dFiller_
QList< SgCableCalReading * > cableCals_
bool compareChannelSetups(const SgChannelSkeded::StnCfg &sCfg)
void lookupScanName(SgOnSourceRecord *osRec, const QMap< QString, SgVlbiAuxObservation * > &auxObsByScan)
QList< SgMeteoReading * > & meteoPars()
QList< SgDot2xpsReading * > & dot2xpses()
void setRecorderInfo(const QString &info)
void setStationName(const QString &name)
void setBackEndInfo(const QString &info)
QList< SgOnSourceRecord * > & onSourceRecords()
QList< SgOnSourceRecord * > onSourceRecords_
QList< SgTraklReading * > trakls_
SgChannelSetup & channelSetup()
SgChannelSetup channelSetup_
QString str4AntCal(const QString &str, int width)
const QString & getExperimentName() const
void setExperimentName(const QString &name)
QList< SgTsysReading * > tSyses_
QList< SgMeteoReading * > meteoPars_
const QString & getBackEndInfo() const
void export2antCalPcal_vgosSetup(QTextStream &s)
void cleanMeteoParameters()
QList< SgCableCalReading * > & cableLongs()
bool tSensorsPrinted2AntCal_
void setFsVersionLabel(const QString &ver)
QList< SgCableCalReading * > cableLongs_
void export2antCalFrqs_skededSetup(QTextStream &s, const SgChannelSkeded::StnCfg &sCfg)
bool compareChannelNumbers(const SgChannelSkeded::StnCfg &sCfg)
bool propagateData(SgVlbiStationInfo *stn)
void verifyReadings(SgVlbiStationInfo *stn, const QMap< QString, int > *defaultCableSignByStn)
static const int nFiller_
QList< SgPcalReading * > & pcals()
bool areCableCalsPresent_
void removeTsysReadings()
QMap< QString, SgOnSourceRecord * > recordByScan_
void setItType(InputType t)
void export2antCalFrqs_nativeSetup(QTextStream &s)
static const QString className()
void setT(const SgMJD &t)
const SgMJD & getT() const
void setOsRec(SgOnSourceRecord *os)
void setT(const SgMJD &t)
static const QString className()
void addTsyses(const QMap< QString, float > &tsys)
void setIsOnSource(bool isOnSource)
const QMap< QString, float > & getTsys() const
QMap< QString, QVector< int > > & tpcont()
QList< SgTraklReading * > & trakls()
const SgOnSourceRecord * getOsRec() const
void setIsDataOn(bool isDataOn)
const SgMJD & getT() const
QMap< QString, QVector< int > > tpcont_
QMap< QString, float > & tsys()
const QMap< QString, QVector< int > > & getTpcont() const
QMap< QString, float > tsys_
void addTpconts(const QMap< QString, QVector< int > > &tpcont)
SgOnSourceRecord *& osRec()
void setElement(unsigned int i, double d)
double getElement(unsigned int i) const
QString name(NameFormat fmt=NF_Human) const
static const QString className()
bool readLogFile(const QString &fileName, int year)
bool strs2mjd(int nYear, const QString &sDay, const QString &sHr, const QString &sMin, const QString &sSec, SgMJD &t)
bool propagateData(SgVlbiStationInfo *stn)
static const QString ivsStationNames_[NUM_OF_VLBA_ENTRIES]
bool isVlba(const QString &key) const
static const QString vlbaStationCodes_[NUM_OF_VLBA_ENTRIES]
QMap< QString, QString > ivs2vlba_
QMap< QString, SgStnLogReadings * > readingsByKey_
void setTsyses(const SgVector &ts)
void setCableCalibration(double cable)
void setMeteoData(const SgMeteoData &meteo)
SgMeteoData & meteoData()
SgVlbiObservation * getOwner() const
const SgVector & cableCorrections() const
const QString & getScanName() const
QMap< QString, SgVlbiObservable * > & observableByKey()
QMap< QString, SgVlbiAuxObservation * > * auxObservationByScanId()
QVector< QString > & tsysIfSideBands()
QVector< double > & tsysIfFreqs()
QVector< QString > & tsysIfIds()
@ Attr_HAS_CABLE_CAL
a station has cable calibration readings;
@ Attr_METEO_MODIFIED
a station has meteo parameters;
@ Attr_CABLE_CAL_MODIFIED
a station has cable calibration readings;
@ Attr_HAS_METEO
a station has meteo parameters;
@ Attr_CABLE_CAL_IS_CDMS
FS log file contains /CDMS/ readings instead of /cable/;.
void setCableCalMultiplierDBCal(double c)
QVector< QString > & tsysIfPolarizations()
SgVersion * driverVersion