General Purpose Geodetic Library
SgVlbiSessionIoDbh.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #include <iostream>
24 #include <stdlib.h>
25 
26 
27 #include <SgVlbiSession.h>
28 
29 #include <SgConstants.h>
30 #include <SgDbhImage.h>
31 #include <SgEccRec.h>
32 #include <SgLogger.h>
33 #include <SgSolutionReporter.h>
34 #include <SgVlbiObservation.h>
35 #include <SgVlbiBand.h>
36 
37 
38 #if QT_VERSION >= 0x050000
39 # include <QtWidgets/QMessageBox>
40 #else
41 # include <QtGui/QMessageBox>
42 #endif
43 
44 
45 
46 const bool useOldAcm=true;
47 
48 /*=======================================================================================================
49 *
50 * Auxiliary data structures
51 *
52 *======================================================================================================*/
53 
54 
55 // locally used type:
57 {
58  const char *lCode_;
59  QString description_;
61  bool isPresent_;
63  int dimensions_[3];
64  int numOfTc_;
68 };
69 
70 
71 // and constants:
72 extern DbhDescriptorX dbhDxTable[];
73 extern const int numOfDxT;
74 
75 
76 // individual records:
77 extern DbhDescriptorX &rNSites_;
78 extern DbhDescriptorX &rNStars_;
79 extern DbhDescriptorX &rNObs_;
107 extern DbhDescriptorX &rEccNames_;
108 extern DbhDescriptorX &rEccTypes_;
109 extern DbhDescriptorX &rEl_Cut_;
110 extern DbhDescriptorX &rError_Bl_;
111 extern DbhDescriptorX &rN4Obs_;
113 extern DbhDescriptorX &rAmpByFrq_;
114 extern DbhDescriptorX &rCorrCoef_;
120 extern DbhDescriptorX &rRecSetup_;
124 extern DbhDescriptorX &rSbDelay_;
126 extern DbhDescriptorX &rSecTag_;
127 extern DbhDescriptorX &rSnr_;
129 extern DbhDescriptorX &rCalByFrq_;
134 extern DbhDescriptorX &rUtcTag_;
138 extern DbhDescriptorX &rAzimuths_;
145 extern DbhDescriptorX &rSitPart_;
146 extern DbhDescriptorX &rStarPart_;
147 extern DbhDescriptorX &rUT1Part_;
153 extern DbhDescriptorX &rGrIonFrq_;
154 extern DbhDescriptorX &rIonCorr_;
155 extern DbhDescriptorX &rIonRms_;
156 extern DbhDescriptorX &rPhIonFrq_;
157 extern DbhDescriptorX &rNAmbig_;
158 extern DbhDescriptorX &rAtmCflg_;
159 extern DbhDescriptorX &rClkCflg_;
164 extern DbhDescriptorX &rIonCode_;
182 extern DbhDescriptorX &rBatchCnt_;
184 extern DbhDescriptorX &rAcmNames_;
187 extern DbhDescriptorX &rUt1Ortho_;
188 extern DbhDescriptorX &rWobOrtho_;
194 extern DbhDescriptorX &rFeedCorr_;
196 extern DbhDescriptorX &rNdryCont_;
197 extern DbhDescriptorX &rNwetCont_;
201 extern DbhDescriptorX &rCalSites_;
202 extern DbhDescriptorX &rCalList_;
203 extern DbhDescriptorX &rCalFlags_;
208 extern DbhDescriptorX &rIonBits_;
210 extern DbhDescriptorX &rFut1_inf_;
211 extern DbhDescriptorX &rFut1_pts_;
212 extern DbhDescriptorX &rFwob_inf_;
213 extern DbhDescriptorX &rFwob_pts_;
214 extern DbhDescriptorX &rTidalUt1_;
216 extern DbhDescriptorX &rSolData_;
217 extern DbhDescriptorX &rSupMet_;
220 extern DbhDescriptorX &rFclList_;
221 extern DbhDescriptorX &rFclFlags_;
222 extern DbhDescriptorX &rObcList_;
223 extern DbhDescriptorX &rObcFlags_;
224 extern DbhDescriptorX &rScanName_;
225 extern DbhDescriptorX &rRunCode_;
228 extern DbhDescriptorX &rWobLibra_;
229 extern DbhDescriptorX &rUt1Libra_;
230 extern DbhDescriptorX &rNut06xys_;
231 extern DbhDescriptorX &rNut06xyp_;
232 extern DbhDescriptorX &rNutWahr_;
233 extern DbhDescriptorX &rNut2006_;
235 extern DbhDescriptorX &rAcSites_;
236 extern DbhDescriptorX &rCcSites_;
237 extern DbhDescriptorX &rOceOld_;
238 extern DbhDescriptorX &rPtdOld_;
239 extern DbhDescriptorX &rFrngErr_;
242 extern DbhDescriptorX &rParAngle_;
244 extern DbhDescriptorX &rNdryPart_;
245 extern DbhDescriptorX &rNwetPart_;
248 
250 
251 
252 // individual descriptors:
254 extern bool &hasNSites_;
256 extern bool &hasNStars_;
258 extern bool &hasNObs_;
260 extern bool &hasSiteNames_;
262 extern bool &hasStarNames_;
264 extern bool &hasAxisOffsets_;
266 extern bool &hasStar2000_;
268 extern bool &hasSiteRecs_;
270 extern bool &hasOloadAmpHorz_;
272 extern bool &hasOloadPhsHorz_;
274 extern bool &hasOloadAmpVert_;
276 extern bool &hasOloadPhsVert_;
278 extern bool &hasAxisTypes_;
280 extern bool &hasCableSigns_;
282 extern bool &hasCableStations_;
284 extern bool &hasAtmConstr_;
286 extern bool &hasAtmIntrv_;
288 extern bool &hasClockConstr_;
290 extern bool &hasClockIntrv_;
292 extern bool &hasAcmOffsets_;
294 extern bool &hasAcmRates_;
296 extern bool &hasError_K_;
298 extern bool &hasEccCoords_;
300 extern bool &hasNRefClocks_;
302 extern bool &hasBaselinesSelStatus_;
304 extern bool &hasSourcesSelStatus_;
306 extern bool &hasBaselinesDepClocks_;
309 extern bool &hasRefClockSites_;
311 extern bool &hasClockBreakStatus_;
313 extern bool &hasEccNames_;
315 extern bool &hasEccTypes_;
317 extern bool &hasEl_Cut_;
319 extern bool &hasError_Bl_;
321 extern bool &hasN4Obs_;
323 extern bool &hasNumOfSamples_;
334 extern bool &hasRefFreqByChannel_;
339 extern SgDbhDatumDescriptor *&dSnr_;
341 extern bool &hasNumOfChannels_;
343 extern bool &hasCalByFrq_;
347 extern bool &hasPhaseCalOffset_;
354 extern bool &hasElevationData_;
356 extern bool &hasConsBendingDelay_;
358 extern bool &hasConsensusDelay_;
360 extern bool &hasAzimuthData_;
362 extern bool &hasNutationPart_;
364 extern bool &hasNutationPart2K_;
366 extern bool &hasOloadContrib_;
368 extern bool &hasSitPart_;
370 extern bool &hasStarPart_;
372 extern bool &hasUT1Part_;
374 extern bool &hasWobblePart_;
376 extern bool &hasMeteoPressureData_;
378 extern bool &hasCableData_;
380 extern bool &hasMeteoRelHumidityData_;
382 extern bool &hasMeteoTemperatureData_;
384 extern bool &hasNAmbig_;
386 extern bool &hasGrIonFrq_;
388 extern bool &hasIonCorr_;
390 extern bool &hasIonRms_;
392 extern bool &hasPhIonFrq_;
394 extern bool &hasAtmCflg_;
396 extern bool &hasClkCflg_;
398 extern bool &hasClkBrkEpochs_;
400 extern bool &hasClkBrkNum_;
402 extern bool &hasClkBrkFlags_;
404 extern bool &hasClkBrkNames_;
407 extern bool &hasNAmbigSecBand_;
409 extern bool &hasQualityCodeSecBand_;
411 extern bool &hasEffFreqsSecBand_;
413 extern bool &hasRateObsSecBand_;
415 extern bool &hasSigmaRateObsSecBand_;
417 extern bool &hasDelayObsSecBand_;
419 extern bool &hasSigmaDelayObsSecBand_;
421 extern bool &hasPhaseObsSecBand_;
423 extern bool &hasSigmaPhaseObsSecBand_;
425 extern bool &hasTotalPhaseSecBand_;
427 extern bool &hasRefFreqSecBand_;
429 extern bool &hasSnrSecBand_;
431 extern bool &hasCorrCoefSecBand_;
433 extern bool &hasSBDelaySecBand_;
435 extern bool &hasSigmaSBDelaySecBand_;
437 extern bool &hasGrpAmbiguitySecBand_;
439 extern bool &hasTotalPhase_;
441 extern bool &hasBatchCnt_;
443 extern bool &hasCorrelatorType_;
445 extern bool &hasAcmNames_;
447 extern bool &hasCalcVersionValue_;
449 extern bool &hasTectPlateNames_;
451 extern bool &hasUt1Ortho_;
453 extern bool &hasWobOrtho_;
455 extern bool &hasPtdContrib_;
457 extern bool &hasEtdContrib_;
459 extern bool &hasWobXContrib_;
461 extern bool &hasWobYContrib_;
463 extern bool &hasWobNutatContrib_;
465 extern bool &hasFeedCorr_;
467 extern bool &hasTiltRemvr_;
469 extern bool &hasNdryCont_;
471 extern bool &hasNwetCont_;
473 extern bool &hasNgradParts_;
475 extern bool &hasUnPhaseCal_;
477 extern bool &hasAxOffsetCont_;
479 extern bool &hasCalSites_;
481 extern bool &hasCalList_;
483 extern bool &hasCalFlags_;
485 extern bool &hasAxsOfsPart_;
487 extern bool &hasTai_2_Utc_;
489 extern bool &hasFourFitFileName_;
491 extern bool &hasFourFitFileNameSecBand_;
493 extern bool &hasIonBits_;
495 extern bool &hasUserAction4Suppression_;
497 extern bool &hasFut1_inf_;
499 extern bool &hasFut1_pts_;
501 extern bool &hasFwob_inf_;
503 extern bool &hasFwob_pts_;
505 extern bool &hasTidalUt1_;
507 extern bool &hasPhAmbig_S_;
509 extern bool &hasSolData_;
511 extern bool &hasSupMet_;
513 extern bool &hasBlDepClocks_;
515 extern bool &hasAtmPartFlag_;
517 extern bool &hasFclList_;
519 extern bool &hasFclFlags_;
521 extern bool &hasObcList_;
523 extern bool &hasObcFlags_;
525 extern bool &hasScanName_;
527 extern bool &hasRunCode_;
529 extern bool &hasOloadHorzContrib_;
531 extern bool &hasOloadVertContrib_;
533 extern bool &hasWobLibra_;
535 extern bool &hasUt1Libra_;
537 extern bool &hasNut06xys_;
539 extern bool &hasNut06xyp_;
541 extern bool &hasNutWahr_;
543 extern bool &hasNut2006_;
545 extern bool &hasOptlContib_;
547 extern bool &hasAcSites_;
549 extern bool &hasCcSites_;
551 extern bool &hasOceOld_;
553 extern bool &hasPtdOld_;
555 extern bool &hasFrngErr_;
557 extern bool &hasAcmEpochs_;
559 extern bool &hasAcmNumber_;
561 extern bool &hasParAngle_;
563 extern bool &hasConsensusRate_;
565 extern bool &hasNdryPart_;
567 extern bool &hasNwetPart_;
569 extern bool &hasSun1BendingContrib_;
571 extern bool &hasSun2BendingContrib_;
572 
574 extern bool &hasMslmIonContrib_;
575 
576 
577 
578 extern const QString sCalList[] = {"CABL DEL", "UNPHASCL", "NDRYCONT", "NWETCONT", " ",
579  "WVR DELY"};
580 
581 extern const QString sFclList[] = {"CFAKBDRY", "CFAKBWET", "CFAJJDRY", "IFADRFLY", "IFADRYSS",
582  "MTTDRFLY", "MTTDRYSS", "NMFDRFLY"};
583 
584 extern const QString sMntTypes[] ={"AZEL", "EQUA", "X_YN", "X_YE", "RICHMOND", "UNKN"};
585 
586 
587 //("PTD CONT", "WOBXCONT", "WOBYCONT", "ETD CONT", "OCE CONT", "UT1ORTHO", "WOBORTHO", "WOBLIBRA", "UT1LIBRA", "OPTLCONT", "FEED.COR", "OCE_OLD ", "TILTRMVR", "PTOLDCON")
588 //("PTD CONT", "WOBXCONT", "WOBYCONT", "ETD CONT", "OCE CONT", "PTOLDCON", "UT1ORTHO", "WOBORTHO", "WOBNUTAT", "FEED.COR", "WAHRCONT", "TILTRMVR", "", "")
589 
591 {
603  O10_TILT_RMVR = 11
604 };
606 {
621 };
622 
623 
624 
625 /*=======================================================================================================
626 *
627 * I/O utilities:
628 *
629 *======================================================================================================*/
630 //
631 bool SgVlbiSession::getDataFromDbhImages(QMap<QString, SgDbhImage*> &images,
632  bool have2LoadImmatureSession, bool guiExpected)
633 {
634  SgMJD startEpoch(SgMJD::currentMJD());
635  bool isOk=false;
636 
637  if (images.size()==0)
638  {
640  "::getDataFromDbhImages(): nothing to import");
641  return false;
642  }
643  else if (images.size()==1)
644  {
646  "::getDataFromDbhImages(): importing one-band set of DBH images");
647  isOk = getDataFromDbhImage(images.values().at(0), true, true, have2LoadImmatureSession, guiExpected);
648  }
649  // Here we organize the order of importing.
650  // standard IVS case:
651  else if (images.size()==2 && images.contains("X") && images.contains("S") &&
652  images["X"]->currentVersion() >= images["S"]->currentVersion())
653  {
655  "::getDataFromDbhImages(): importing typical IVS set of DBH images");
656  isOk = getDataFromDbhImage(images["S"], false, true, have2LoadImmatureSession, guiExpected);
657  isOk = isOk && getDataFromDbhImage(images["X"], true, true, have2LoadImmatureSession, guiExpected);
658  }
659  else
660  {
662  "::getDataFromDbhImages(): importing non-standard set of DBH images");
663  // first, we want a band with highest CALC version to be a primary band:
664  double cverMax(-1.0), cverMin(-1.0), cver(-1.0);
665  for (QMap<QString, SgDbhImage*>::iterator it=images.begin(); it!=images.end(); ++it)
666  {
667  SgDbhImage *image=it.value();
668  cver = -1.0;
670  {
671  cver = image->getR8(dCalcVersionValue_, 0,0,0);
672  if (cver>cverMax)
673  cverMax = cver;
674  if (cverMin<0.0)
675  cverMin = cver;
676  else if (cverMin<cver)
677  cverMin = cver;
678  };
679  };
681  if (cverMin != cverMax) // ok, we can chose:
682  {
683  for (QMap<QString, SgDbhImage*>::iterator it=images.begin(); it!=images.end(); ++it)
684  {
685  SgDbhImage *image=it.value();
687  imgByCver.insert(image->getR8(dCalcVersionValue_, 0,0,0), image);
688  else
689  imgByCver.insert(0.1*image->currentVersion(), image);
690  };
691  }
692  else // sort by freqs:
693  {
694  for (QMap<QString, SgDbhImage*>::iterator it=images.begin(); it!=images.end(); ++it)
695  {
696  SgDbhImage *image=it.value();
698  imgByCver.insert(image->getR8(dReferenceFrequency_, 0,0,0, 0), image);
699  else
700  imgByCver.insert(0.1*image->currentVersion(), image);
701  };
702  };
703  isOk = true;
704  int idx=0;
705  for (QMultiMap<double, SgDbhImage*>::iterator it=imgByCver.begin(); it!=imgByCver.end(); ++it)
706  {
707  isOk = isOk &&
708  getDataFromDbhImage(it.value(), (idx==imgByCver.size()-1), // true is for highest CVer/freq
709  false, have2LoadImmatureSession, guiExpected);
710  idx++;
711  };
712  };
713  // remove observations that are not in the primary band:
714  int idx, num;
715  idx = num = 0;
716  while (idx<observations_.size())
717  {
718  SgVlbiObservation *obs=observations_.at(idx);
720  {
721  observationByKey_.remove(obs->getKey());
722  observations_.removeAt(idx);
723  idx--;
724  num++;
725  delete obs;
726  };
727  idx++;
728  };
729  if (num)
731  "::getDataFromDbhImages(): " + QString("").setNum(num) +
732  " second-band-only observation" + (num==1?" ":"s ") + "were removed");
733  //
734  if (cppsSoft_ == CPPS_UNKNOWN)
736  //
737  // perform self check:
738  isOk = isOk && selfCheck(guiExpected);
739  //
740  SgMJD finisEpoch(SgMJD::currentMJD());
742  ": getDataFromDbhImages(): the session " + getName() + " has been read from DBH database" +
743  ", elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
744  //
745  return isOk;
746 };
747 
748 
749 
750 //
751 bool SgVlbiSession::getDataFromDbhImage(SgDbhImage *image, bool have2getAll, bool isStandardSession,
752  bool have2LoadImmatureSession, bool guiExpected)
753 {
754  SgMJD startEpoch(SgMJD::currentMJD());
755  bool isOk = true;
756  if (!image)
757  {
759  "::getDataFromDbhImage(): the image is NULL");
760  return false;
761  };
762  //
763  if (!image->numberOfObservations())
764  {
766  "::getDataFromDbhImage(): the image does not contain observations");
767  return false;
768  };
769  //
770  const QString dbhName(image->fileName());
772  "::getDataFromDbhImage(): starting parsing DBH image " + image->sessionID() );
773  //
774  // check info part:
775  int importingVersion=image->fileVersion();
776  if (name_ == "unnamed") // first pass, get some info from the dbh image
777  {
778  setName(image->sessionID());
779  if (name_.mid(8, 1)=="S") // right now manually switch to the primary band:
780  {
781  name_.replace(8, 1, "X");
783  "::getDataFromDbhImage(): session name has been switched from " + image->sessionID() +
784  " to " + name_);
785  };
786  networkSuffix_ = name_.mid(9, 1);
787  description_ = image->sessionDescription();
788  };
789 
790  // extract the name of the band: get it from the name of the session, e.g., "$10JUL29SE"
791  QString str = image->sessionID();
792  QString bandKey = str.mid(8, 1);
793 
794  // check is it already imported:
795  SgVlbiBand *band=NULL;
796  int i=0;
797  while (i<bands_.size() && band==NULL)
798  {
799  if (bands_.at(i)->getKey() == bandKey)
800  band = bands_.at(i);
801  i++;
802  };
803  // if it is a new band, insert it to the list:
804  if (band == NULL)
805  band = new SgVlbiBand;
806  else // something going wrong, notify user:
807  {
809  "::getDataFromDbhImage(): the band " + bandKey + " already exists in the session; clearing..");
810  delete band;
811  band = new SgVlbiBand;
812  };
813  band->setKey(bandKey);
814  bands_.append(band);
815  bandByKey_.insert(bandKey, band);
816 
817  // run format verification:
818  // first, lookup parameters:
819  for (int i=0; i<numOfDxT; i++)
820  {
821  if (!(dbhDxTable[i].d_=image->lookupDescriptor(dbhDxTable[i].lCode_)))
822  dbhDxTable[i].isPresent_ = false;
823  else
824  dbhDxTable[i].isPresent_ = true;
825  };
826 
827  // then, check content of the dbh image:
828  for (int i=0; i<numOfDxT; i++)
829  {
830 // if (!dbhDxTable[i].isPresent_ && dbhDxTable[i].isMandatory_ && false &&
831  if (!dbhDxTable[i].isPresent_ && dbhDxTable[i].isMandatory_ && !have2LoadImmatureSession &&
832  (dbhDxTable[i].expectedVersion_<=importingVersion))
833  {
835  "::getDataFromDbhImage(): cannot find lcode '" + dbhDxTable[i].lCode_ +
836  "' in the image; skipping the image of " + dbhName);
837  return false;
838  }
839  else if (!dbhDxTable[i].isPresent_ && !dbhDxTable[i].isMandatory_ &&
840  (dbhDxTable[i].expectedVersion_<=importingVersion))
842  "::getDataFromDbhImage(): cannot find lcode '" + dbhDxTable[i].lCode_ + "' in the image of " +
843  dbhName);
844  // check types:
845  if (dbhDxTable[i].isPresent_ && dbhDxTable[i].type_ != dbhDxTable[i].d_->type())
846  {
847  if (dbhDxTable[i].isMandatory_)
848  {
850  "::getDataFromDbhImage(): type missmatch for LCODE '" + dbhDxTable[i].lCode_ +
851  "': expected " + SgDbhDatumDescriptor::typeName(dbhDxTable[i].type_) + ", got " +
852  dbhDxTable[i].d_->typeName() + "; skipping the image of " + dbhName);
853  return false;
854  }
855  else
856  {
857  dbhDxTable[i].isPresent_ = false;
859  "::getDataFromDbhImage(): type missmatch for LCODE '" + dbhDxTable[i].lCode_ +
860  "': expected " + SgDbhDatumDescriptor::typeName(dbhDxTable[i].type_) + ", got " +
861  dbhDxTable[i].d_->typeName() + "; skipping use of the LCODE");
862  };
863  };
864  };
865 
866  // import observations:
867  QString station1Name, station2Name, sourceName, baselineName;
868  QString scanName, scanId, obsKey;
869  SgMJD epoch;
870  SgVlbiObservable *o=NULL;
871  SgVlbiStationInfo *station1Info, *station2Info;
872  SgVlbiStationInfo *bandStation1Info, *bandStation2Info;
873  SgVlbiSourceInfo *sourceInfo, *bandSourceInfo;
874  SgVlbiBaselineInfo *baselineInfo, *bandBaselineInfo;
875  int year, month, day, hour, minute;
876  double second;
877  SgVlbiObservation *obs=NULL;
878  SgVlbiAuxObservation *auxObs=NULL, *auxObsE=NULL;
879  QMap<QString, SgVlbiAuxObservation*> *auxObsByScan=NULL;
880  SgMeteoData meteo1, meteo2;
881  double cableCorrection1=0.0, cableCorrection2=0.0;
882  double refFreq=0.0;
883  double azimuthAngle1=0.0, azimuthAngle2=0.0;
884  double azimuthAngleRate1=0.0, azimuthAngleRate2=0.0;
885  double elevationAngle1=0.0, elevationAngle2=0.0;
886  double elevationAngleRate1=0.0, elevationAngleRate2=0.0;
887  double parallacticAngle1=0.0, parallacticAngle2=0.0;
888  double calcNdryContribDel1, calcNdryContribDel2;
889  double calcNwetContribDel1, calcNwetContribDel2;
890  double calcNdryContribRat1, calcNdryContribRat2;
891  double calcNwetContribRat1, calcNwetContribRat2;
892  double calcNgradNPartDel1, calcNgradEPartDel1;
893  double calcNgradNPartDel2, calcNgradEPartDel2;
894  double calcNgradNPartRat1, calcNgradEPartRat1;
895  double calcNgradNPartRat2, calcNgradEPartRat2;
896  double calcNdryPartDel1, calcNdryPartDel2;
897  double calcNdryPartRat1, calcNdryPartRat2;
898  double calcNwetPartDel1, calcNwetPartDel2;
899  double calcNwetPartRat1, calcNwetPartRat2;
900  double calcUnPhaseCal1, calcUnPhaseCal2;
901  double calcAxisOffsetDel1, calcAxisOffsetDel2;
902  double calcAxisOffsetRat1, calcAxisOffsetRat2;
903  double partAxisOffsetDel1, partAxisOffsetDel2;
904  double partAxisOffsetRat1, partAxisOffsetRat2;
905  double calcOcnLdDelH1, calcOcnLdDelH2, calcOcnLdDelV1, calcOcnLdDelV2;
906  //
907  calcNdryContribDel1 = calcNdryContribDel2 = calcNwetContribDel1 = calcNwetContribDel2 =
908  calcNdryContribRat1 = calcNdryContribRat2 = calcNwetContribRat1 = calcNwetContribRat2 =
909  calcNgradNPartDel1 = calcNgradEPartDel1 = calcNgradNPartDel2 = calcNgradEPartDel2 =
910  calcNgradNPartRat1 = calcNgradEPartRat1 = calcNgradNPartRat2 = calcNgradEPartRat2 = 0.0;
911  calcNdryPartDel1 = calcNdryPartDel2 = calcNdryPartRat1 = calcNdryPartRat2 = 0.0;
912  calcNwetPartDel1 = calcNwetPartDel2 = calcNwetPartRat1 = calcNwetPartRat2 = 0.0;
913  calcUnPhaseCal1 = calcUnPhaseCal2 = calcAxisOffsetDel1 = calcAxisOffsetDel2 = 0.0;
914  calcAxisOffsetRat1 = calcAxisOffsetRat2 = 0.0;
915  calcOcnLdDelH1 = calcOcnLdDelH2 = calcOcnLdDelV1 = calcOcnLdDelV2 = 0.0;
916 
917  // temporary (for pcal evaluating):
918 // double pCal4GrpDelay1=2.0, pCal4GrpDelay2=2.0;
919 // double pCalSigma4GrpDelay1=1.0, pCalSigma4GrpDelay2=1.0;
920 // SgVector pCal1ByChan(16), pCal2ByChan(16);
921 // SgVector pCalOffset1ByChan(16), pCalOffset2ByChan(16);
922 
923  int numOfChannels=0;
924  int maxNumOfChannels=0;
925  double f;
926  bool isSbdSigmaNan, isSbdSigmaInf;
927  bool isGrdSigmaNan, isGrdSigmaInf;
928  bool isPhrSigmaNan, isPhrSigmaInf;
930  {
931  if (dCalByFrq_->dim3() != dRefFreqByChannel_->dim1()) // complain:
933  "::getDataFromDbhImage(): the lcodes '" + rCalByFrq_.lCode_ +
934  "' and '" + rRefFreqByChannel_.lCode_ + "' have incompatible dimensions"
935  + QString("").sprintf(": %d vs %d", dCalByFrq_->dim3(), dRefFreqByChannel_->dim1()));
936  maxNumOfChannels = std::min(dCalByFrq_->dim3(), dRefFreqByChannel_->dim1());
938  "::getDataFromDbhImage(): the session has maximum " +
939  QString("").sprintf(" %d channels", maxNumOfChannels));
940  };
941  numOfChannels = maxNumOfChannels;
942  // eot
943  // set up correlator type, we use it in the loop:
944  if (hasCorrelatorType_)
945  band->setCorrelatorType(image->getStr(dCorrelatorType_, 0,0));
946  else
947  band->setCorrelatorType("Mk4"); // sort of default
948  if (getCorrelatorType() != "UNKN")
950  //
951  // run the loop:
952  for (int obsIdx=0; obsIdx<image->numberOfObservations(); obsIdx++)
953  {
954  // ========================= observation ==========================
955  year = image->getI2(dUtcTag_, 0, 0, 0, obsIdx);
956  month = image->getI2(dUtcTag_, 1, 0, 0, obsIdx);
957  day = image->getI2(dUtcTag_, 2, 0, 0, obsIdx);
958  hour = image->getI2(dUtcTag_, 3, 0, 0, obsIdx);
959  minute = image->getI2(dUtcTag_, 4, 0, 0, obsIdx);
960  second = image->getR8(dSecTag_, 0, 0, 0, obsIdx);
961  epoch.setUpEpoch(year, month, day, hour, minute, second);
962 
963  // stations and source names:
964  station1Name = image->getStr(dBaselineName_, 0, 0, obsIdx);
965  station2Name = image->getStr(dBaselineName_, 1, 0, obsIdx);
966  sourceName = image->getStr(dSourceName_, 0, 0, obsIdx);
967  baselineName = station1Name + ":" + station2Name;
968  // scanId and scanName:
969  scanId = epoch.toString(SgMJD::F_INTERNAL) + "@" + sourceName;
970  if (isStandardSession && hasScanName_)
971  scanName = image->getStr(dScanName_, 0, 0, obsIdx);
972  else if (isStandardSession && hasRunCode_)
973  scanName = image->getStr(dRunCode_, 0, 0, obsIdx);
974  else
975  scanName.sprintf("%03d-%02d:%02d:%04.1f@%s",
976  epoch.calcDayOfYear(), epoch.calcHour(), epoch.calcMin(), epoch.calcSec(),
977  qPrintable(sourceName));
978  //
979  // pick up or create an observation:
980  obsKey.sprintf("%s",
981  qPrintable(epoch.toString(SgMJD::F_INTERNAL) + "-" + baselineName + "@" + sourceName));
982  if (observationByKey_.contains(obsKey))
983  obs = observationByKey_.value(obsKey);
984  else
985  {
986  obs = new SgVlbiObservation(this);
987  obs->setMJD(epoch);
988  obs->setScanName(scanName);
989  obs->setScanId(scanId);
990  obs->setKey(obsKey);
991  obs->setMediaIdx(observations_.size());
992  observations_.append(obs);
993  observationByKey_.insert(obsKey, obs);
994  };
995  o = new SgVlbiObservable(obs, band);
996  o->setMediaIdx(obsIdx);
997  obs->addObservable(band->getKey(), o);
998  obs->setupActiveObservable(bandKey);
999 
1000  // station #1:
1001  if (stationsByName_.contains(station1Name))
1002  station1Info = stationsByName_.value(station1Name);
1003  else // new station, add it to the container and register its index:
1004  {
1005  station1Info = new SgVlbiStationInfo(stationsByName_.size(), station1Name);
1006  stationsByName_.insert(station1Info->getKey(), station1Info);
1007  stationsByIdx_.insert(station1Info->getIdx(), station1Info);
1008  };
1009  // station #2:
1010  if (stationsByName_.contains(station2Name))
1011  station2Info = stationsByName_.value(station2Name);
1012  else // new station, add it to the container and register its index:
1013  {
1014  station2Info = new SgVlbiStationInfo(stationsByName_.size(), station2Name);
1015  stationsByName_.insert(station2Info->getKey(), station2Info);
1016  stationsByIdx_.insert(station2Info->getIdx(), station2Info);
1017  };
1018  // source:
1019  if (sourcesByName_.contains(sourceName))
1020  sourceInfo = sourcesByName_.value(sourceName);
1021  else // new source, add it to the container and register its index:
1022  {
1023  sourceInfo = new SgVlbiSourceInfo(sourcesByName_.size(), sourceName);
1024  sourcesByName_.insert(sourceInfo->getKey(), sourceInfo);
1025  sourcesByIdx_.insert(sourceInfo->getIdx(), sourceInfo);
1026  };
1027  // baseline:
1028  if (baselinesByName_.contains(baselineName))
1029  baselineInfo = baselinesByName_.value(baselineName);
1030  else // new baseline, add it to the container and register its index:
1031  {
1032  baselineInfo = new SgVlbiBaselineInfo(baselinesByName_.size(), baselineName);
1033  baselinesByName_.insert(baselineInfo->getKey(), baselineInfo);
1034  baselinesByIdx_.insert(baselineInfo->getIdx(), baselineInfo);
1035  };
1036  // 4band:
1037  // band's station #1:
1038  if (band->stationsByName().contains(station1Name))
1039  bandStation1Info = band->stationsByName().value(station1Name);
1040  else // new station, add it to the container:
1041  {
1042  bandStation1Info = new SgVlbiStationInfo(station1Info->getIdx(), station1Name);
1043  band->stationsByName().insert(bandStation1Info->getKey(), bandStation1Info);
1044  band->stationsByIdx().insert(bandStation1Info->getIdx(), bandStation1Info);
1045  };
1046  // band's station #2:
1047  if (band->stationsByName().contains(station2Name))
1048  bandStation2Info = band->stationsByName().value(station2Name);
1049  else // new station, add it to the container:
1050  {
1051  bandStation2Info = new SgVlbiStationInfo(station2Info->getIdx(), station2Name);
1052  band->stationsByName().insert(bandStation2Info->getKey(), bandStation2Info);
1053  band->stationsByIdx().insert(bandStation2Info->getIdx(), bandStation2Info);
1054  };
1055  // band's source:
1056  if (band->sourcesByName().contains(sourceName))
1057  bandSourceInfo = band->sourcesByName().value(sourceName);
1058  else // new source, add it to the container:
1059  {
1060  bandSourceInfo = new SgVlbiSourceInfo(sourceInfo->getIdx(), sourceName);
1061  band->sourcesByName().insert(bandSourceInfo->getKey(), bandSourceInfo);
1062  band->sourcesByIdx().insert(bandSourceInfo->getIdx(), bandSourceInfo);
1063  };
1064  // band's baselines:
1065  if (band->baselinesByName().contains(baselineName))
1066  bandBaselineInfo = band->baselinesByName().value(baselineName);
1067  else // new baseline, add it to the container and register its index:
1068  {
1069  bandBaselineInfo = new SgVlbiBaselineInfo(baselineInfo->getIdx(), baselineName);
1070  band->baselinesByName().insert(bandBaselineInfo->getKey(), bandBaselineInfo);
1071  band->baselinesByIdx().insert(bandBaselineInfo->getIdx(), bandBaselineInfo);
1072  };
1073 
1074  obs->setStation1Idx(station1Info->getIdx());
1075  obs->setStation2Idx(station2Info->getIdx());
1076  obs->setSourceIdx(sourceInfo->getIdx());
1077  obs->setBaselineIdx(baselineInfo->getIdx());
1078  //
1079  // plus additional info:
1080  if (hasFourFitFileName_)
1081  o->setFourfitOutputFName(image->getStr(dFourFitFileName_, 0, 0, obsIdx));
1082  //
1083  // collect observables:
1084  // single band delay:
1085  if (dSbDelay_)
1086  o->sbDelay().setValue(1.0e-6*(image->getR8(dSbDelay_, 0, 0, 0, obsIdx) +
1087  image->getR8(dSbDelay_, 1, 0, 0, obsIdx) ));
1088  // group delay:
1089  if (dObservedDelay_)
1090  o->grDelay().setValue(1.0e-6*(image->getR8(dObservedDelay_, 0, 0, 0, obsIdx) +
1091  image->getR8(dObservedDelay_, 1, 0, 0, obsIdx) ));
1092  // delay rate:
1093  if (dDelayRate_)
1094  o->phDRate().setValue(image->getR8(dDelayRate_, 0, 0, 0, obsIdx));
1095  //
1096  // workaround the DBH "feature":
1097  isSbdSigmaNan = isSbdSigmaInf = isGrdSigmaNan = isGrdSigmaInf = isPhrSigmaNan = isPhrSigmaInf
1098  = false;
1099  // single band delay sigma:
1100  if (dSbSigmaDelay_)
1101  f = image->getR8(dSbSigmaDelay_, 0, 0, 0, obsIdx);
1102  else
1103  f = 1.0;
1104  if (isinf(f) != 0)
1105  {
1107  "::getDataFromDbhImage(): the observation #" + QString("").setNum(obsIdx) +
1108  " at the baseline <" + baselineName + "> observing " + sourceName + " source at " +
1110  " contains wrong sigma (inf) for the single band delay", true);
1111  isSbdSigmaInf = true;
1112  f = 1.0;
1113  // image->setR8(dSbSigmaDelay_, 0,0,0, obsIdx, f);
1114  };
1115  if (isnan(f) != 0)
1116  {
1118  "::getDataFromDbhImage(): the observation #" + QString("").setNum(obsIdx) +
1119  " at the baseline <" + baselineName + "> observing " + sourceName + " source at " +
1121  " contains wrong sigma (nan) for the single band delay", true);
1122  isSbdSigmaNan = true;
1123  f = 1.0;
1124  // image->setR8(dSbSigmaDelay_, 0,0,0, obsIdx, f);
1125  };
1126  o->sbDelay().setSigma(1.0e-6*f);
1127  //
1128  // group delay sigma:
1130  f = image->getR8(dObservedDelaySigma_, 0, 0, 0, obsIdx);
1131  else
1132  f = 1.0;
1133  if (isinf(f) != 0)
1134  {
1136  "::getDataFromDbhImage(): the observation #" + QString("").setNum(obsIdx) +
1137  " at the baseline <" + baselineName + "> observing " + sourceName + " source at " +
1139  " contains wrong sigma (inf) for the group delay", true);
1140  isGrdSigmaInf = true;
1141  f = 1.0e-6;
1142  // image->setR8(dObservedDelaySigma_, 0,0,0, obsIdx, f);
1143  };
1144  if (isnan(f) != 0)
1145  {
1147  "::getDataFromDbhImage(): the observation #" + QString("").setNum(obsIdx) +
1148  " at the baseline <" + baselineName + "> observing " + sourceName + " source at " +
1150  " contains wrong sigma (nan) for the group delay", true);
1151  isGrdSigmaNan = true;
1152  f = 1.0e-6;
1153  // image->setR8(dObservedDelaySigma_, 0,0,0, obsIdx, f);
1154  };
1155  o->grDelay().setSigma(f);
1156  //
1157  // delay rate sigma:
1158  if (dSigmaDelayRate_)
1159  f = image->getR8(dSigmaDelayRate_, 0, 0, 0, obsIdx);
1160  else
1161  f = 1.0;
1162  if (isinf(f) != 0)
1163  {
1165  "::getDataFromDbhImage(): the observation #" + QString("").setNum(obsIdx) +
1166  " at the baseline <" + baselineName + "> observing " + sourceName + " source at " +
1168  " contains wrong sigma (inf) for the group delay", true);
1169  isPhrSigmaInf = true;
1170  f = 1.0e-6;
1171  // image->setR8(dSigmaDelayRate_, 0,0,0, obsIdx, f);
1172  };
1173  if (isnan(f) != 0)
1174  {
1176  "::getDataFromDbhImage(): the observation #" + QString("").setNum(obsIdx) +
1177  " at the baseline <" + baselineName + "> observing " + sourceName + " source at " +
1179  " contains wrong sigma (nan) for the group delay", true);
1180  isPhrSigmaNan = true;
1181  f = 1.0e-6;
1182  // image->setR8(dSigmaDelayRate_, 0,0,0, obsIdx, f);
1183  };
1184  o->phDRate().setSigma(f);
1185  //
1186  if (guiExpected &&
1187  (isSbdSigmaNan || isSbdSigmaInf ||
1188  isGrdSigmaNan || isGrdSigmaInf ||
1189  isPhrSigmaNan || isPhrSigmaInf ))
1190  {
1191  QString s1(""), s2(""), s3("");
1192  s1 = (isSbdSigmaNan || isGrdSigmaNan || isPhrSigmaNan)?"(nan)":"(inf)";
1193  if (isSbdSigmaNan || isSbdSigmaInf)
1194  s2 = "single band delay, ";
1195  if (isGrdSigmaNan || isGrdSigmaInf)
1196  s2+= "group delay, ";
1197  if (isPhrSigmaNan || isPhrSigmaInf)
1198  s2+= "delay rate, ";
1199  s2 = s2.left(s2.size() - 2);
1200  if (o->getFourfitOutputFName().size())
1201  s3 = "\n\tfourfit file name: " + obs->getScanName().trimmed() + "/" + o->getFourfitOutputFName();
1202 
1203  QMessageBox::warning(NULL, "Warning: wrong value",
1204  "The observation #" + QString("").setNum(obsIdx) + " contains wrong sigma " + s1 + " for " + s2 +
1205  ".\n\nThe observation identities:\n" + "\t[" + baselineName + "] @" + sourceName +
1206  "\n\tepoch: " + epoch.toString(SgMJD::F_YYYYMMDDHHMMSSSS) + s3 +
1207  "\n\nBatch SOLVE will likely fail to deal with this session, report to the correlator.");
1208  };
1209  //
1210  // --------------------------------------------------------------------------------------------------
1211  if (have2getAll)
1212  {
1213  // it is a primary band:
1215  //
1216  // theo consensus delay:
1217  if (hasConsensusDelay_)
1218  obs->setCalcConsensusDelay(1.0e-6* (image->getR8(dConsensusDelay_, 0, 0, 0, obsIdx) +
1219  image->getR8(dConsensusDelay_, 1, 0, 0, obsIdx)) );
1220  // theo consensus rate:
1221  if (hasConsensusRate_)
1222  obs->setCalcConsensusRate(image->getR8(dConsensusRate_, 0, 0, 0, obsIdx));
1223 
1225  {
1226  obs->setCalcConsBendingDelay(image->getR8(dConsBendingDelay_, 0, 0, 0, obsIdx));
1227  obs->setCalcConsBendingRate (image->getR8(dConsBendingDelay_, 1, 0, 0, obsIdx));
1228  };
1230  {
1231  obs->setCalcConsBendingSunDelay(image->getR8(dSun1BendingContrib_, 0, 0, 0, obsIdx));
1232  obs->setCalcConsBendingSunRate (image->getR8(dSun1BendingContrib_, 1, 0, 0, obsIdx));
1233  };
1235  {
1236  obs->setCalcConsBendingSunHigherDelay(image->getR8(dSun2BendingContrib_, 0, 0, 0, obsIdx));
1237  obs->setCalcConsBendingSunHigherRate (image->getR8(dSun2BendingContrib_, 1, 0, 0, obsIdx));
1238  };
1239  //
1240  if (hasMslmIonContrib_)
1241  {
1242  obs->setCalcGpsIonoCorrectionDelay(image->getR8(dMslmIonContrib_, 0, 0, 0, obsIdx));
1243  obs->setCalcGpsIonoCorrectionRate (image->getR8(dMslmIonContrib_, 1, 0, 0, obsIdx));
1244  };
1245  //
1246  //
1247  // contributions:
1248  if (hasOloadContrib_)
1249  {
1250  obs->setCalcOceanTideDelay(image->getR8(dOloadContrib_, 0, 0, 0, obsIdx));
1251  obs->setCalcOceanTideRate (image->getR8(dOloadContrib_, 1, 0, 0, obsIdx));
1252  };
1253  calcOcnLdDelH1 = calcOcnLdDelH2 = calcOcnLdDelV1 = calcOcnLdDelV2 = 0.0;
1255  {
1256  calcOcnLdDelH1 =-image->getR8(dOloadHorzContrib_, 0, 0, 0, obsIdx);
1257  calcOcnLdDelH2 = image->getR8(dOloadHorzContrib_, 1, 0, 0, obsIdx);
1258  calcOcnLdDelV1 =-image->getR8(dOloadVertContrib_, 0, 0, 0, obsIdx);
1259  calcOcnLdDelV2 = image->getR8(dOloadVertContrib_, 1, 0, 0, obsIdx);
1260  };
1261  if (hasUt1Ortho_)
1262  {
1263  obs->setCalcHiFyUt1Delay(image->getR8(dUt1Ortho_, 0, 0, 0, obsIdx));
1264  obs->setCalcHiFyUt1Rate (image->getR8(dUt1Ortho_, 1, 0, 0, obsIdx));
1265  };
1266  if (hasWobOrtho_)
1267  {
1268  obs->setCalcHiFyPxyDelay(image->getR8(dWobOrtho_, 0, 0, 0, obsIdx));
1269  obs->setCalcHiFyPxyRate (image->getR8(dWobOrtho_, 1, 0, 0, obsIdx));
1270  };
1271  if (hasPtdContrib_)
1272  {
1273  obs->setCalcPoleTideDelay(image->getR8(dPtdContrib_, 0, 0, 0, obsIdx));
1274  obs->setCalcPoleTideRate (image->getR8(dPtdContrib_, 1, 0, 0, obsIdx));
1275  };
1276  if (hasEtdContrib_)
1277  {
1278  obs->setCalcEarthTideDelay(image->getR8(dEtdContrib_, 0, 0, 0, obsIdx));
1279  obs->setCalcEarthTideRate (image->getR8(dEtdContrib_, 1, 0, 0, obsIdx));
1280  };
1281  if (hasOptlContib_)
1282  {
1283  obs->setCalcOceanPoleTideLdDelay(image->getR8(dOptlContib_, 0, 0, 0, obsIdx));
1284  obs->setCalcOceanPoleTideLdRate (image->getR8(dOptlContib_, 1, 0, 0, obsIdx));
1285  };
1286  if (hasWobXContrib_)
1287  {
1288  obs->setCalcPxDelay(image->getR8(dWobXContrib_, 0, 0, 0, obsIdx));
1289  obs->setCalcPxRate (image->getR8(dWobXContrib_, 1, 0, 0, obsIdx));
1290  };
1291  if (hasWobYContrib_)
1292  {
1293  obs->setCalcPyDelay(image->getR8(dWobYContrib_, 0, 0, 0, obsIdx));
1294  obs->setCalcPyRate (image->getR8(dWobYContrib_, 1, 0, 0, obsIdx));
1295  }
1296  if (hasWobNutatContrib_)
1297  obs->setCalcWobNutatContrib(image->getR8(dWobNutatContrib_, 0, 0, 0, obsIdx));
1298  if (hasWobLibra_)
1299  {
1300  obs->setCalcHiFyPxyLibrationDelay(image->getR8(dWobLibra_, 0, 0, 0, obsIdx));
1301  obs->setCalcHiFyPxyLibrationRate (image->getR8(dWobLibra_, 1, 0, 0, obsIdx));
1302  };
1303  if (hasUt1Libra_)
1304  {
1305  obs->setCalcHiFyUt1LibrationDelay(image->getR8(dUt1Libra_, 0, 0, 0, obsIdx));
1306  obs->setCalcHiFyUt1LibrationRate (image->getR8(dUt1Libra_, 1, 0, 0, obsIdx));
1307  };
1308  if (hasNut06xys_)
1309  {
1310  obs->setCalcCipXv(image->getR8(dNut06xys_, 0, 0, 0, obsIdx));
1311  obs->setCalcCipYv(image->getR8(dNut06xys_, 1, 0, 0, obsIdx));
1312  obs->setCalcCipSv(image->getR8(dNut06xys_, 2, 0, 0, obsIdx));
1313  };
1314  if (hasNutWahr_)
1315  {
1316  obs->setCalcNutWahr_dPsiV(image->getR8(dNutWahr_, 0, 0, 0, obsIdx));
1317  obs->setCalcNutWahr_dEpsV(image->getR8(dNutWahr_, 1, 0, 0, obsIdx));
1318  };
1319  if (hasNut2006_)
1320  {
1321  obs->setCalcNut2006_dPsiV(image->getR8(dNut2006_, 0, 0, 0, obsIdx));
1322  obs->setCalcNut2006_dEpsV(image->getR8(dNut2006_, 1, 0, 0, obsIdx));
1323  };
1324  if (hasOceOld_)
1325  {
1326  obs->setCalcOceanTideOldDelay(image->getR8(dOceOld_, 0, 0, 0, obsIdx));
1327  obs->setCalcOceanTideOldRate (image->getR8(dOceOld_, 1, 0, 0, obsIdx));
1328  };
1329  if (hasPtdOld_)
1330  {
1331  obs->setCalcPoleTideOldDelay(image->getR8(dPtdOld_, 0, 0, 0, obsIdx));
1332  obs->setCalcPoleTideOldRate (image->getR8(dPtdOld_, 1, 0, 0, obsIdx));
1333  };
1334  if (hasFeedCorr_)
1335  {
1336  obs->setCalcFeedCorrDelay(image->getR8(dFeedCorr_, 0, 0, 0, obsIdx));
1337  obs->setCalcFeedCorrRate (image->getR8(dFeedCorr_, 1, 0, 0, obsIdx));
1338  };
1339  if (hasTiltRemvr_)
1340  {
1341  obs->setCalcTiltRemvrDelay(image->getR8(dTiltRemvr_, 0, 0, 0, obsIdx));
1342  obs->setCalcTiltRemvrRate (image->getR8(dTiltRemvr_, 1, 0, 0, obsIdx));
1343  };
1344  if (hasNdryCont_)
1345  {
1346  calcNdryContribDel1 =-image->getR8(dNdryCont_, 0, 0, 0, obsIdx);
1347  calcNdryContribDel2 = image->getR8(dNdryCont_, 1, 0, 0, obsIdx);
1348  calcNdryContribRat1 =-image->getR8(dNdryCont_, 0, 1, 0, obsIdx);
1349  calcNdryContribRat2 = image->getR8(dNdryCont_, 1, 1, 0, obsIdx);
1350  };
1351  if (hasNwetCont_)
1352  {
1353  calcNwetContribDel1 =-image->getR8(dNwetCont_, 0, 0, 0, obsIdx);
1354  calcNwetContribDel2 = image->getR8(dNwetCont_, 1, 0, 0, obsIdx);
1355  calcNwetContribRat1 =-image->getR8(dNwetCont_, 0, 1, 0, obsIdx);
1356  calcNwetContribRat2 = image->getR8(dNwetCont_, 1, 1, 0, obsIdx);
1357  };
1358  if (hasNgradParts_)
1359  {
1360  calcNgradNPartDel1 = image->getR8(dNgradParts_, 0, 0, 0, obsIdx);
1361  calcNgradEPartDel1 = image->getR8(dNgradParts_, 0, 1, 0, obsIdx);
1362  calcNgradNPartDel2 = image->getR8(dNgradParts_, 1, 0, 0, obsIdx);
1363  calcNgradEPartDel2 = image->getR8(dNgradParts_, 1, 1, 0, obsIdx);
1364  calcNgradNPartRat1 = image->getR8(dNgradParts_, 0, 0, 1, obsIdx);
1365  calcNgradEPartRat1 = image->getR8(dNgradParts_, 0, 1, 1, obsIdx);
1366  calcNgradNPartRat2 = image->getR8(dNgradParts_, 1, 0, 1, obsIdx);
1367  calcNgradEPartRat2 = image->getR8(dNgradParts_, 1, 1, 1, obsIdx);
1368  };
1369  if (hasUnPhaseCal_)
1370  {
1371  calcUnPhaseCal1 =-image->getR8(dUnPhaseCal_, 0, 0, 0, obsIdx);
1372  calcUnPhaseCal2 = image->getR8(dUnPhaseCal_, 1, 0, 0, obsIdx);
1373  };
1374  if (hasAxOffsetCont_)
1375  {
1376  calcAxisOffsetDel1 =-image->getR8(dAxOffsetCont_, 0, 0, 0, obsIdx);
1377  calcAxisOffsetDel2 = image->getR8(dAxOffsetCont_, 1, 0, 0, obsIdx);
1378  calcAxisOffsetRat1 =-image->getR8(dAxOffsetCont_, 0, 1, 0, obsIdx);
1379  calcAxisOffsetRat2 = image->getR8(dAxOffsetCont_, 1, 1, 0, obsIdx);
1380  };
1381  //
1382  // partials:
1383  // dTau by dR stations:
1384  if (hasSitPart_)
1385  {
1386  double rx, ry, rz;
1387  // delay:
1388  rx = image->getR8(dSitPart_, 0, 0, 0, obsIdx);
1389  ry = image->getR8(dSitPart_, 1, 0, 0, obsIdx);
1390  rz = image->getR8(dSitPart_, 2, 0, 0, obsIdx);
1391  obs->setDdel_dR_1(Sg3dVector(rx, ry, rz));
1392  rx = image->getR8(dSitPart_, 0, 1, 0, obsIdx);
1393  ry = image->getR8(dSitPart_, 1, 1, 0, obsIdx);
1394  rz = image->getR8(dSitPart_, 2, 1, 0, obsIdx);
1395  obs->setDdel_dR_2(Sg3dVector(rx, ry, rz));
1396  // rate:
1397  rx = image->getR8(dSitPart_, 0, 0, 1, obsIdx);
1398  ry = image->getR8(dSitPart_, 1, 0, 1, obsIdx);
1399  rz = image->getR8(dSitPart_, 2, 0, 1, obsIdx);
1400  obs->setDrat_dR_1(Sg3dVector(rx, ry, rz));
1401  rx = image->getR8(dSitPart_, 0, 1, 1, obsIdx);
1402  ry = image->getR8(dSitPart_, 1, 1, 1, obsIdx);
1403  rz = image->getR8(dSitPart_, 2, 1, 1, obsIdx);
1404  obs->setDrat_dR_2(Sg3dVector(rx, ry, rz));
1405  };
1406  // sources
1407  if (hasStarPart_)
1408  {
1409  obs->setDdel_dRA( image->getR8(dStarPart_, 0, 0, 0, obsIdx) );
1410  obs->setDdel_dDN( image->getR8(dStarPart_, 1, 0, 0, obsIdx) );
1411  obs->setDrat_dRA( image->getR8(dStarPart_, 0, 1, 0, obsIdx) );
1412  obs->setDrat_dDN( image->getR8(dStarPart_, 1, 1, 0, obsIdx) );
1413  };
1414  // dUT1:
1415  if (hasUT1Part_)
1416  {
1417  obs->setDdel_dUT1 (-image->getR8(dUT1Part_, 0, 0, 0, obsIdx)*86400.0 );
1418 // obs->setDTau_dUT1dot(-image->getR8(dUT1Part_, 1, 0, 0, obsIdx)*86400.0 );
1419  obs->setDrat_dUT1 (-image->getR8(dUT1Part_, 1, 0, 0, obsIdx)*86400.0 );
1420  };
1421  // Polar motion:
1422  if (hasWobblePart_)
1423  {
1424  obs->setDdel_dPx( image->getR8(dWobblePart_, 0, 0, 0, obsIdx) );
1425  obs->setDdel_dPy( image->getR8(dWobblePart_, 1, 0, 0, obsIdx) );
1426  obs->setDrat_dPx( image->getR8(dWobblePart_, 0, 1, 0, obsIdx) );
1427  obs->setDrat_dPy( image->getR8(dWobblePart_, 1, 1, 0, obsIdx) );
1428  };
1429  // Angles of nutation:
1430  if (hasNut06xyp_)
1431  {
1432  obs->setDdel_dCipX( image->getR8(dNut06xyp_, 0, 0, 0, obsIdx) );
1433  obs->setDdel_dCipY( image->getR8(dNut06xyp_, 1, 0, 0, obsIdx) );
1434  obs->setDrat_dCipX( image->getR8(dNut06xyp_, 0, 1, 0, obsIdx) );
1435  obs->setDrat_dCipY( image->getR8(dNut06xyp_, 1, 1, 0, obsIdx) );
1436  }
1437  else if (hasNutationPart2K_)
1438  {
1439  obs->setDdel_dCipX( image->getR8(dNutationPart2K_, 0, 0, 0, obsIdx) );
1440  obs->setDdel_dCipY( image->getR8(dNutationPart2K_, 1, 0, 0, obsIdx) );
1441  obs->setDrat_dCipX( image->getR8(dNutationPart2K_, 0, 1, 0, obsIdx) );
1442  obs->setDrat_dCipY( image->getR8(dNutationPart2K_, 1, 1, 0, obsIdx) );
1443  }
1444  else if (hasNutationPart_)
1445  {
1446  obs->setDdel_dCipX( image->getR8(dNutationPart_, 0, 0, 0, obsIdx) );
1447  obs->setDdel_dCipY( image->getR8(dNutationPart_, 1, 0, 0, obsIdx) );
1448  obs->setDrat_dCipX( image->getR8(dNutationPart_, 0, 1, 0, obsIdx) );
1449  obs->setDrat_dCipY( image->getR8(dNutationPart_, 1, 1, 0, obsIdx) );
1450  };
1451  };
1452  //
1453  // ambiguity spacing:
1454  if (dGrpAmbiguity_)
1455  o->grDelay().setAmbiguitySpacing(image->getR8(dGrpAmbiguity_, 0, 0, 0, obsIdx));
1456  // ambiguity resolution:
1457  if (hasNAmbig_)
1458  o->grDelay().setNumOfAmbiguities(image->getI2(dNAmbig_, 0, 0, 0, obsIdx));
1459  if (hasNAmbigSecBand_ && obs->passiveObses().size()>0)
1460  obs->passiveObses().at(0)->grDelay().setNumOfAmbiguities(
1461  image->getI2(dNAmbigSecBand_, 0, 0, 0, obsIdx));
1462  if (hasGrpAmbiguitySecBand_ && obs->passiveObses().size()>0) // just check and complain:
1463  {
1464  double s=image->getR8(dGrpAmbiguitySecBand_, 0, 0, 0, obsIdx);
1465  if (s != obs->passiveObses().at(0)->grDelay().getAmbiguitySpacing())
1467  "::getDataFromDbhImage(): secondary band ambiguity spacing, " +
1468  QString("").setNum(obs->passiveObses().at(0)->grDelay().getAmbiguitySpacing()) +
1469  ", is different from value of GRPAMB_S LCode, " +
1470  QString("").setNum(s) + "; the difference is " +
1471  QString("").setNum((obs->passiveObses().at(0)->grDelay().getAmbiguitySpacing() - s)*1.0E9) +
1472  "ns", true);
1473  };
1474  //
1475  //
1476  int qFactor;
1477  bool isOk;
1478  str = image->getStr(dQualityCode_, 0, 0, obsIdx);
1479  qFactor = str.toInt(&isOk);
1480  if (!isOk)
1481  {
1482  qFactor = -1;
1483  o->setErrorCode(str.simplified());
1484  }
1485  else if (hasFrngErr_)
1486  o->setErrorCode(image->getStr(dFrngErr_, 0, 0, obsIdx).simplified());
1487  else
1488  o->setErrorCode("");
1489  o->setQualityFactor(qFactor);
1490 
1491  if (hasQualityCodeSecBand_ && obs->passiveObses().size()>0)
1492  {
1493  str = image->getStr(dQualityCodeSecBand_, 0, 0, obsIdx);
1494  if (str != " ")
1495  {
1496  qFactor = str.toInt(&isOk);
1497  if (!isOk)
1498  qFactor = -1;
1499  obs->passiveObses().at(0)->setQualityFactor(qFactor);
1500  };
1501  };
1502  //
1503  //
1504  if (dDelayUFlag_)
1505  o->grDelay().setUnweightFlag(image->getI2(dDelayUFlag_, 0, 0, 0, obsIdx));
1506  //
1508  have2getAll && // some second band versions could have wrong DELFLAGs, e.g., 99DEC14SA_V004
1509  (o->grDelay().getUnweightFlag()==1 || o->grDelay().getUnweightFlag()==2) &&
1510  importingVersion>=4) // otherwice, where the flag came from?
1512  //
1513  if (dRateUFlag_)
1514  o->phDRate().setUnweightFlag(image->getI2(dRateUFlag_, 0, 0, 0, obsIdx));
1516  o->setReferenceFrequency((refFreq=image->getR8(dReferenceFrequency_, 0, 0, 0, obsIdx)));
1517  if (hasNumOfChannels_)
1518  o->setNumOfChannels((numOfChannels=image->getI2(dNumOfChannels_, 0, 0, 0, obsIdx)));
1519  if (dCorrCoef_)
1520  o->setCorrCoeff(image->getR8(dCorrCoef_, 0, 0, 0, obsIdx));
1521  if (dSnr_)
1522  o->setSnr(image->getR8(dSnr_, 0, 0, 0, obsIdx));
1523  if (dTotalPhase_)
1524  o->setTotalPhase(image->getR8(dTotalPhase_, 0, 0, 0, obsIdx)*DEG2RAD);
1525  // check for ionospheric correction, if it is already calculated, get it:
1526  if (hasIonCorr_ && hasIonRms_)
1527  {
1528  o->grDelay().setIonoValue(image->getR8(dIonCorr_, 0, 0, 0, obsIdx));
1529  o->phDRate().setIonoValue(image->getR8(dIonCorr_, 1, 0, 0, obsIdx));
1530  o->grDelay().setIonoSigma(image->getR8(dIonRms_, 0, 0, 0, obsIdx));
1531  o->phDRate().setIonoSigma(image->getR8(dIonRms_, 1, 0, 0, obsIdx));
1532  };
1533  //
1534  // collect data necessary to evaluate the effective frequencies (for ionospheric correction):
1535  o->allocateChannelsSetupStorages(numOfChannels);
1536  SgVector& numOfAccPeriodsByChan_USB = *o->numOfAccPeriodsByChan_USB();
1537  SgVector& numOfAccPeriodsByChan_LSB = *o->numOfAccPeriodsByChan_LSB();
1538  SgVector& numOfSamplesByChan_USB = *o->numOfSamplesByChan_USB();
1539  SgVector& numOfSamplesByChan_LSB = *o->numOfSamplesByChan_LSB();
1540  SgVector& refFreqByChan = *o->refFreqByChan();
1541  SgVector& fringeAmplitudeByChan = *o->fringeAmplitudeByChan();
1542  SgMatrix& phaseCalData_1 = *o->phaseCalData_1ByChan();
1543  SgMatrix& phaseCalData_2 = *o->phaseCalData_2ByChan();
1544  double sampleRate=0.0, effFreq4GR=0.0, effFreq4PH=0.0, effFreq4RT=0.0;
1545  //
1546  for (int i=0; i<numOfChannels; i++)
1547  {
1548  if (dNumOfAccPeriods_)
1549  {
1550  numOfAccPeriodsByChan_LSB.setElement(i, image->getI2(dNumOfAccPeriods_, 0, i, 0, obsIdx));
1551  numOfAccPeriodsByChan_USB.setElement(i, image->getI2(dNumOfAccPeriods_, 1, i, 0, obsIdx));
1552  }
1553  if (hasNumOfSamples_)
1554  {
1555  numOfSamplesByChan_LSB.setElement(i, image->getR8(dNumOfSamples_, 0, i, 0, obsIdx));
1556  numOfSamplesByChan_USB.setElement(i, image->getR8(dNumOfSamples_, 1, i, 0, obsIdx));
1557  };
1558  if (dRefFreqByChannel_)
1559  refFreqByChan.setElement(i, image->getR8(dRefFreqByChannel_, i, 0, 0, obsIdx)); // MHz
1560  if (dAmpByFrq_)
1561  fringeAmplitudeByChan.setElement(i, image->getR8(dAmpByFrq_, 0, i, 0, obsIdx));
1562  if (dPhaseCalOffset_)
1563  {
1564  phaseCalData_1.setElement (SgVlbiObservable::PCCI_OFFSET,i,
1565  image->getI2(dPhaseCalOffset_, 0, i, 0, obsIdx)*DEG2RAD/100.0);
1566  phaseCalData_2.setElement (SgVlbiObservable::PCCI_OFFSET,i,
1567  image->getI2(dPhaseCalOffset_, 1, i, 0, obsIdx)*DEG2RAD/100.0);
1568  };
1569  if (hasCalByFrq_)
1570  {
1571  phaseCalData_1.setElement (SgVlbiObservable::PCCI_AMPLITUDE,i,
1572  image->getI2(dCalByFrq_, 0, 0, i, obsIdx));
1573  phaseCalData_2.setElement (SgVlbiObservable::PCCI_AMPLITUDE,i,
1574  image->getI2(dCalByFrq_, 0, 1, i, obsIdx));
1575  phaseCalData_1.setElement (SgVlbiObservable::PCCI_PHASE,i,
1576  image->getI2(dCalByFrq_, 1, 0, i, obsIdx)*DEG2RAD/100.0);
1577  phaseCalData_2.setElement (SgVlbiObservable::PCCI_PHASE,i,
1578  image->getI2(dCalByFrq_, 1, 1, i, obsIdx)*DEG2RAD/100.0);
1579  phaseCalData_1.setElement (SgVlbiObservable::PCCI_FREQUENCY,i,
1580  image->getI2(dCalByFrq_, 2, 0, i, obsIdx));
1581  phaseCalData_2.setElement (SgVlbiObservable::PCCI_FREQUENCY,i,
1582  image->getI2(dCalByFrq_, 2, 1, i, obsIdx));
1583  };
1584  };
1585  if (hasCalByFrq_)
1586  o->calcPhaseCalDelay();
1587  if (dSampleRate_)
1588  sampleRate = image->getR8(dSampleRate_, 0, 0, 0, obsIdx);
1589  else if (dRecSetup_)
1590  sampleRate = image->getI2(dRecSetup_, 0, 0, 0, obsIdx)*1000.0;
1591  if (maxNumOfChannels && numOfChannels)
1592  evaluateEffectiveFreqs(numOfAccPeriodsByChan_USB, numOfAccPeriodsByChan_LSB, refFreqByChan,
1593  fringeAmplitudeByChan, numOfSamplesByChan_USB, numOfSamplesByChan_LSB,
1594  sampleRate, refFreq, numOfChannels,
1595  effFreq4GR, effFreq4PH, effFreq4RT, band->getCorrelatorType(), o->strId());
1596  else
1597  effFreq4GR = effFreq4PH = effFreq4RT = refFreq;
1598  o->grDelay().setEffFreq(effFreq4GR);
1599  o->phDelay().setEffFreq(effFreq4PH);
1600  o->phDRate().setEffFreq(effFreq4RT);
1601  // o->releaseChannelsSetupStorages();
1602  // end of channel dependent data
1603  //
1604  //
1605  // for ionospheric corrections:
1606  if (have2getAll && hasEffFreqsSecBand_)
1607  {
1608  double d=image->getR8(dEffFreqsSecBand_, 0,0,0, obsIdx);
1609  o->grDelay().setQ2( d*d/(effFreq4GR*effFreq4GR - d*d) );
1610  // evaluate the ionospheric correction for the aux band if the value of the correction for
1611  // the prime band and the effective frequencies are known:
1612  if (hasIonCorr_ && hasIonRms_ && obs->passiveObses().size()>0)
1613  obs->passiveObses().at(0)->grDelay().setIonoValue(
1614  o->grDelay().getIonoValue()*effFreq4GR*effFreq4GR/d/d);
1615  };
1616  //
1617  // per band statistics:
1618  band->incNumTotal(DT_DELAY);
1619  band->incNumTotal(DT_RATE);
1620  bandStation1Info->incNumTotal(DT_DELAY);
1621  bandStation1Info->incNumTotal(DT_RATE);
1622  bandStation2Info->incNumTotal(DT_DELAY);
1623  bandStation2Info->incNumTotal(DT_RATE);
1624  bandSourceInfo->incNumTotal(DT_DELAY);
1625  bandSourceInfo->incNumTotal(DT_RATE);
1626  bandBaselineInfo->incNumTotal(DT_DELAY);
1627  bandBaselineInfo->incNumTotal(DT_RATE);
1628  //
1629  // Aux observations:
1630  if (have2getAll)
1631  {
1632  // ========================= auxiliary observation ==========================
1633  //
1634  // auxiliary observations (meteo, cables, etc.):
1635  // should be: baseline- and band- independent; could be missed in the file
1636  //
1637  if (hasCableData_)
1638  {
1639  cableCorrection1 = image->getR8(dCableCalibration_, 0, 0, 0, obsIdx);
1640  cableCorrection2 = image->getR8(dCableCalibration_, 1, 0, 0, obsIdx);
1641  };
1643  {
1644  meteo1.setTemperature(image->getR8(dMeteoTemperature_, 0, 0, 0, obsIdx));
1645  meteo2.setTemperature(image->getR8(dMeteoTemperature_, 1, 0, 0, obsIdx));
1646  };
1648  {
1649  meteo1.setPressure(image->getR8(dMeteoPressure_, 0, 0, 0, obsIdx));
1650  meteo2.setPressure(image->getR8(dMeteoPressure_, 1, 0, 0, obsIdx));
1651  };
1653  {
1654  meteo1.setRelativeHumidity(image->getR8(dMeteoHumidity_, 0, 0, 0, obsIdx));
1655  meteo2.setRelativeHumidity(image->getR8(dMeteoHumidity_, 1, 0, 0, obsIdx));
1656  };
1657  if (hasAzimuthData_)
1658  {
1659  azimuthAngle1 = image->getR8(dAzimuths_, 0, 0, 0, obsIdx);
1660  azimuthAngle2 = image->getR8(dAzimuths_, 1, 0, 0, obsIdx);
1661  azimuthAngleRate1 = image->getR8(dAzimuths_, 0, 1, 0, obsIdx);
1662  azimuthAngleRate2 = image->getR8(dAzimuths_, 1, 1, 0, obsIdx);
1663  };
1664  if (hasElevationData_)
1665  {
1666  elevationAngle1 = image->getR8(dElevations_, 0, 0, 0, obsIdx);
1667  elevationAngle2 = image->getR8(dElevations_, 1, 0, 0, obsIdx);
1668  elevationAngleRate1 = image->getR8(dElevations_, 0, 1, 0, obsIdx);
1669  elevationAngleRate2 = image->getR8(dElevations_, 1, 1, 0, obsIdx);
1670  };
1671  if (hasParAngle_)
1672  {
1673  parallacticAngle1 = image->getR8(dParAngle_, 0, 0, 0, obsIdx)*DEG2RAD;
1674  parallacticAngle2 = image->getR8(dParAngle_, 1, 0, 0, obsIdx)*DEG2RAD;
1675  };
1676  partAxisOffsetDel1 = partAxisOffsetDel2 = 0.0;
1677  partAxisOffsetRat1 = partAxisOffsetRat2 = 0.0;
1678  if (hasAxsOfsPart_)
1679  {
1680  partAxisOffsetDel1 =-image->getR8(dAxsOfsPart_, 0, 0, 0, obsIdx);
1681  partAxisOffsetDel2 = image->getR8(dAxsOfsPart_, 1, 0, 0, obsIdx);
1682  partAxisOffsetRat1 =-image->getR8(dAxsOfsPart_, 0, 1, 0, obsIdx);
1683  partAxisOffsetRat2 = image->getR8(dAxsOfsPart_, 1, 1, 0, obsIdx);
1684  };
1685  if (hasNdryPart_)
1686  {
1687  calcNdryPartDel1 =-image->getR8(dNdryPart_, 0, 0, 0, obsIdx);
1688  calcNdryPartDel2 = image->getR8(dNdryPart_, 1, 0, 0, obsIdx);
1689  calcNdryPartRat1 =-image->getR8(dNdryPart_, 0, 1, 0, obsIdx);
1690  calcNdryPartRat2 = image->getR8(dNdryPart_, 1, 1, 0, obsIdx);
1691  };
1692  if (hasNwetPart_)
1693  {
1694  calcNwetPartDel1 =-image->getR8(dNwetPart_, 0, 0, 0, obsIdx);
1695  calcNwetPartDel2 = image->getR8(dNwetPart_, 1, 0, 0, obsIdx);
1696  calcNwetPartRat1 =-image->getR8(dNwetPart_, 0, 1, 0, obsIdx);
1697  calcNwetPartRat2 = image->getR8(dNwetPart_, 1, 1, 0, obsIdx);
1698  };
1699 
1700  //
1701  // the first station:
1702  auxObsByScan = station1Info->auxObservationByScanId();
1703  if (!auxObsByScan->contains(scanId)) // new scan, insert data:
1704  {
1705  auxObs = new SgVlbiAuxObservation;
1706  auxObs->setMJD(epoch);
1707  auxObs->setCableCalibration( cableCorrection1); // does not alter the sign
1708  auxObs->setCalcNdryCont4Delay( calcNdryContribDel1); // the sign has been altered
1709  auxObs->setCalcNdryCont4Rate ( calcNdryContribRat1); // the sign has been altered
1710  auxObs->setCalcNwetCont4Delay( calcNwetContribDel1); // the sign has been altered
1711  auxObs->setCalcNwetCont4Rate ( calcNwetContribRat1); // the sign has been altered
1712  auxObs->setCalcUnPhaseCal( calcUnPhaseCal1); // the sign has been altered
1713  auxObs->setCalcAxisOffset4Delay(calcAxisOffsetDel1); // ?? the sign has been changed for Stn#2?
1714  auxObs->setCalcAxisOffset4Rate (calcAxisOffsetRat1); // ?? the sign has been changed for Stn#2?
1715  auxObs->setCalcOLoadHorz4Delay(calcOcnLdDelH1); // the sign has been altered
1716  auxObs->setCalcOLoadVert4Delay(calcOcnLdDelV1); // the sign has been altered
1717  auxObs->setDdel_dAxsOfs (partAxisOffsetDel1); // ?? the sign has been changed for Stn#2?
1718  auxObs->setDrat_dAxsOfs (partAxisOffsetRat1); // ?? the sign has been changed for Stn#2?
1719  auxObs->setDdel_dTzdGrdN(calcNgradNPartDel1); // not flipped???
1720  auxObs->setDdel_dTzdGrdE(calcNgradEPartDel1); // not flipped???
1721  auxObs->setDrat_dTzdGrdN(calcNgradNPartRat1); // not flipped???
1722  auxObs->setDrat_dTzdGrdE(calcNgradEPartRat1); // not flipped???
1723  auxObs->setDdel_dTzdDry(calcNdryPartDel1); // the sign has been altered
1724  auxObs->setDrat_dTzdDry(calcNdryPartRat1); // the sign has been altered
1725  auxObs->setDdel_dTzdWet(calcNwetPartDel1); // the sign has been altered
1726  auxObs->setDrat_dTzdWet(calcNwetPartRat1); // the sign has been altered
1727 
1728  if (!hasCableData_)
1731  {
1732  auxObs->setMeteoData(meteo1);
1734  };
1735  if (hasAzimuthData_)
1736  {
1737  auxObs->setAzimuthAngle(azimuthAngle1);
1738  auxObs->setAzimuthAngleRate(azimuthAngleRate1);
1739  };
1740  if (hasElevationData_)
1741  {
1742  auxObs->setElevationAngle(elevationAngle1);
1743  auxObs->setElevationAngleRate(elevationAngleRate1);
1744  };
1745  if (hasParAngle_)
1746  auxObs->setParallacticAngle(parallacticAngle1);
1747  // add the observation to the list:
1748  auxObsByScan->insert(scanId, auxObs);
1749  }
1750  else // check it, data should be identical:
1751  {
1752  auxObsE = auxObsByScan->value(scanId);
1753  //
1754  // checking:
1755  // let a user know about unconsistency in the database:
1756  if (!auxObsE->isAttr(SgVlbiAuxObservation::Attr_CABLE_CAL_BAD) &&
1757  hasCableData_ && auxObsE->getCableCalibration()!=cableCorrection1)
1759  "::getDataFromDbhImage(): got diff value for cable cal; epoch " +
1761  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1762  auxObsE->getCableCalibration(), cableCorrection1,
1763  auxObsE->getCableCalibration()-cableCorrection1, obsIdx) +
1764  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1765  station2Info->getKey() + " @ " + sourceInfo->getKey());
1766  // check meteoparameters:
1767  if (!auxObsE->meteoData().isAttr(SgMeteoData::Attr_ARTIFICIAL_DATA))
1768  {
1769  // check temperature:
1771  fabs(auxObsE->getMeteoData().getTemperature()-meteo1.getTemperature())>1.0e-12)
1773  "::getDataFromDbhImage(): got diff value for meteo.T; epoch " +
1775  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1776  auxObsE->getMeteoData().getTemperature(), meteo1.getTemperature(),
1777  auxObsE->getMeteoData().getTemperature()-meteo1.getTemperature(), obsIdx) +
1778  ", station1: " + station1Name + " from " + station1Info->getKey() + ":" +
1779  station2Info->getKey() + " @ " + sourceInfo->getKey());
1780  // check pressure:
1781  if (hasMeteoPressureData_ &&
1782  fabs(auxObsE->getMeteoData().getPressure()-meteo1.getPressure())>1.0e-12)
1784  "::getDataFromDbhImage(): got diff value for meteo.P; epoch " +
1786  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1787  auxObsE->getMeteoData().getPressure(), meteo1.getPressure(),
1788  auxObsE->getMeteoData().getPressure()-meteo1.getPressure(), obsIdx) +
1789  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1790  station2Info->getKey() + " @ " + sourceInfo->getKey());
1791  // check relative humidity:
1792  if (hasMeteoRelHumidityData_ &&
1793  fabs(auxObsE->getMeteoData().getRelativeHumidity()-meteo1.getRelativeHumidity())>1.0e-12)
1795  "::getDataFromDbhImage(): got diff value for meteo.R; epoch " +
1797  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1798  auxObsE->getMeteoData().getRelativeHumidity(), meteo1.getRelativeHumidity(),
1799  auxObsE->getMeteoData().getRelativeHumidity()-meteo1.getRelativeHumidity(), obsIdx) +
1800  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1801  station2Info->getKey() + " @ " + sourceInfo->getKey());
1802  };
1803  // check azimuth:
1804  if (hasAzimuthData_ && fabs(auxObsE->getAzimuthAngle()-azimuthAngle1)>1.0e-12)
1806  "::getDataFromDbhImage(): got diff value for azimuth; epoch " +
1808  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g mas); idx=%d",
1809  auxObsE->getAzimuthAngle(), azimuthAngle1,
1810  (auxObsE->getAzimuthAngle()-azimuthAngle1)*RAD2MAS, obsIdx) +
1811  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1812  station2Info->getKey() + " @ " + sourceInfo->getKey());
1813  // check elevation:
1814  if (hasElevationData_ && fabs(auxObsE->getElevationAngle()-elevationAngle1)>1.0e-12)
1816  "::getDataFromDbhImage(): got diff value for elevation; epoch " +
1818  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g mas); idx=%d",
1819  auxObsE->getElevationAngle(), elevationAngle1,
1820  (auxObsE->getElevationAngle()-elevationAngle1)*RAD2MAS, obsIdx) +
1821  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1822  station2Info->getKey() + " @ " + sourceInfo->getKey());
1823  if (hasParAngle_ && fabs(auxObsE->getParallacticAngle()-parallacticAngle1)>1.0e-12)
1825  "::getDataFromDbhImage(): got diff value for parallactic angle; epoch " +
1827  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g mas); idx=%d",
1828  auxObsE->getParallacticAngle(), parallacticAngle1,
1829  (auxObsE->getParallacticAngle()-parallacticAngle1)*RAD2MAS, obsIdx) +
1830  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1831  station2Info->getKey() + " @ " + sourceInfo->getKey());
1832  // check oload data:
1833  if (hasOloadHorzContrib_ && fabs(auxObsE->getCalcOLoadHorz4Delay()-calcOcnLdDelH1)>1.0e-15)
1835  "::getDataFromDbhImage(): got diff value for horizontal ocean loading; epoch " +
1837  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g ps); idx=%d",
1838  auxObsE->getCalcOLoadHorz4Delay(), calcOcnLdDelH1,
1839  (auxObsE->getCalcOLoadHorz4Delay()-calcOcnLdDelH1)*1.0e12, obsIdx) +
1840  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1841  station2Info->getKey() + " @ " + sourceInfo->getKey());
1842  if (hasOloadVertContrib_ && fabs(auxObsE->getCalcOLoadVert4Delay()-calcOcnLdDelV1)>1.0e-15)
1844  "::getDataFromDbhImage(): got diff value for vertical ocean loading; epoch " +
1846  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g ps); idx=%d",
1847  auxObsE->getCalcOLoadVert4Delay(), calcOcnLdDelV1,
1848  (auxObsE->getCalcOLoadVert4Delay()-calcOcnLdDelV1)*1.0e12, obsIdx) +
1849  ", station1 " + station1Name + " from " + station1Info->getKey() + ":" +
1850  station2Info->getKey() + " @ " + sourceInfo->getKey());
1851  //
1852  // updating:
1853  // if previous file did not contain cable cals (e.g., S-band), and now we got them:
1855  {
1856  auxObsE->setCableCalibration(cableCorrection1);
1857  auxObsE->delAttr(SgVlbiAuxObservation::Attr_CABLE_CAL_BAD);
1858  };
1859  // also, set up meteo, if it is available:
1860  if (auxObsE->meteoData().isAttr(SgMeteoData::Attr_ARTIFICIAL_DATA) &&
1862  {
1863  auxObsE->setMeteoData(meteo1);
1864  auxObsE->meteoData().delAttr(SgMeteoData::Attr_ARTIFICIAL_DATA);
1865  };
1866  // set up azimuth & elevation angles, if they were not set yet:
1867  if (hasAzimuthData_)
1868  {
1869  auxObsE->setAzimuthAngle(azimuthAngle1);
1870  auxObsE->setAzimuthAngleRate(azimuthAngleRate1);
1871  };
1872  if (hasElevationData_)
1873  {
1874  auxObsE->setElevationAngle(elevationAngle1);
1875  auxObsE->setElevationAngleRate(elevationAngleRate1);
1876  };
1877  if (hasParAngle_)
1878  auxObsE->setParallacticAngle(parallacticAngle1);
1879  //
1880  /*
1881  if (hasNgradParts_)
1882  {
1883  auxObsE->setDdel_dTzdGrdN(calcNgradNPart1);
1884  auxObsE->setDdel_dTzdGrdE(calcNgradEPart1);
1885  };
1886  */
1887  };
1888  //
1889  // the second station:
1890  auxObsByScan = station2Info->auxObservationByScanId();
1891  if (!auxObsByScan->contains(scanId)) // new scan, insert data:
1892  {
1893  auxObs = new SgVlbiAuxObservation;
1894  auxObs->setMJD(epoch);
1895  auxObs->setCableCalibration(cableCorrection2);
1896  auxObs->setCalcNdryCont4Delay(calcNdryContribDel2);
1897  auxObs->setCalcNdryCont4Rate (calcNdryContribRat2);
1898  auxObs->setCalcNwetCont4Delay(calcNwetContribDel2);
1899  auxObs->setCalcNwetCont4Rate (calcNwetContribRat2);
1900  auxObs->setCalcUnPhaseCal(calcUnPhaseCal2);
1901  auxObs->setCalcAxisOffset4Delay(calcAxisOffsetDel2);
1902  auxObs->setCalcAxisOffset4Rate (calcAxisOffsetRat2);
1903  auxObs->setCalcOLoadHorz4Delay(calcOcnLdDelH2);
1904  auxObs->setCalcOLoadVert4Delay(calcOcnLdDelV2);
1905  auxObs->setDdel_dAxsOfs ( partAxisOffsetDel2); // ?? sign ?
1906  auxObs->setDrat_dAxsOfs ( partAxisOffsetRat2); // ?? sign ?
1907  auxObs->setDdel_dTzdGrdN(calcNgradNPartDel2);
1908  auxObs->setDdel_dTzdGrdE(calcNgradEPartDel2);
1909  auxObs->setDrat_dTzdGrdN(calcNgradNPartRat2);
1910  auxObs->setDrat_dTzdGrdE(calcNgradEPartRat2);
1911  auxObs->setDdel_dTzdDry(calcNdryPartDel2); // the sign has been altered
1912  auxObs->setDrat_dTzdDry(calcNdryPartRat2); // the sign has been altered
1913  auxObs->setDdel_dTzdWet(calcNwetPartDel2); // the sign has been altered
1914  auxObs->setDrat_dTzdWet(calcNwetPartRat2); // the sign has been altered
1915  if (!hasCableData_)
1918  {
1919  auxObs->setMeteoData(meteo2);
1921  };
1922  if (hasAzimuthData_)
1923  {
1924  auxObs->setAzimuthAngle(azimuthAngle2);
1925  auxObs->setAzimuthAngleRate(azimuthAngleRate2);
1926  };
1927  if (hasElevationData_)
1928  {
1929  auxObs->setElevationAngle(elevationAngle2);
1930  auxObs->setElevationAngleRate(elevationAngleRate2);
1931  };
1932  if (hasParAngle_)
1933  auxObs->setParallacticAngle(parallacticAngle2);
1934  // add the observation to the list:
1935  auxObsByScan->insert(scanId, auxObs);
1936  }
1937  else // check it, data should be identical:
1938  {
1939  auxObsE = auxObsByScan->value(scanId);
1940  //
1941  // checking:
1942  // let a user know about unconsistency of the databases:
1943  if (!auxObsE->isAttr(SgVlbiAuxObservation::Attr_CABLE_CAL_BAD) &&
1944  hasCableData_ && auxObsE->getCableCalibration()!=cableCorrection2)
1946  "::getDataFromDbhImage(): got diff value for cable cal; epoch " +
1948  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1949  auxObsE->getCableCalibration(), cableCorrection2,
1950  auxObsE->getCableCalibration()-cableCorrection2, obsIdx) +
1951  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
1952  station2Info->getKey() + " @ " + sourceInfo->getKey());
1953  // check meteoparameters:
1954  if (!auxObsE->meteoData().isAttr(SgMeteoData::Attr_ARTIFICIAL_DATA))
1955  {
1956  // check temperature:
1957  if (hasMeteoTemperatureData_ &&
1958  fabs(auxObsE->getMeteoData().getTemperature()-meteo2.getTemperature())>1.0e-12)
1960  "::getDataFromDbhImage(): got diff value for meteo.T; epoch " +
1962  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1963  auxObsE->getMeteoData().getTemperature(), meteo2.getTemperature(),
1964  auxObsE->getMeteoData().getTemperature()-meteo2.getTemperature(), obsIdx) +
1965  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
1966  station2Info->getKey() + " @ " + sourceInfo->getKey());
1967  // check pressure:
1968  if (hasMeteoPressureData_ &&
1969  fabs(auxObsE->getMeteoData().getPressure()-meteo2.getPressure())>1.0e-12)
1971  "::getDataFromDbhImage(): got diff value for meteo.P; epoch " +
1973  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1974  auxObsE->getMeteoData().getPressure(), meteo2.getPressure(),
1975  auxObsE->getMeteoData().getPressure()-meteo2.getPressure(), obsIdx) +
1976  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
1977  station2Info->getKey() + " @ " + sourceInfo->getKey());
1978  // check relative humidity:
1979  if (hasMeteoRelHumidityData_ &&
1980  fabs(auxObsE->getMeteoData().getRelativeHumidity()-meteo2.getRelativeHumidity())>1.0e-12)
1982  "::getDataFromDbhImage(): got diff value for meteo.R; epoch " +
1984  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g); idx=%d",
1985  auxObsE->getMeteoData().getRelativeHumidity(), meteo2.getRelativeHumidity(),
1986  auxObsE->getMeteoData().getRelativeHumidity()-meteo2.getRelativeHumidity(), obsIdx) +
1987  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
1988  station2Info->getKey() + " @ " + sourceInfo->getKey());
1989  };
1990  // check azimuth:
1991  if (hasAzimuthData_ && fabs(auxObsE->getAzimuthAngle()-azimuthAngle2)>1.0e-12)
1993  "::getDataFromDbhImage(): got diff value for azimuth; epoch " +
1995  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g mas); idx=%d",
1996  auxObsE->getAzimuthAngle(), azimuthAngle2,
1997  (auxObsE->getAzimuthAngle()-azimuthAngle2)*RAD2MAS, obsIdx) +
1998  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
1999  station2Info->getKey() + " @ " + sourceInfo->getKey());
2000  // check elevation:
2001  if (hasElevationData_ && fabs(auxObsE->getElevationAngle()-elevationAngle2)>1.0e-12)
2003  "::getDataFromDbhImage(): got diff value for elevation; epoch " +
2005  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g mas); idx=%d",
2006  auxObsE->getElevationAngle(), elevationAngle2,
2007  (auxObsE->getElevationAngle()-elevationAngle2)*RAD2MAS, obsIdx) +
2008  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
2009  station2Info->getKey() + " @ " + sourceInfo->getKey());
2010  // check parallactic angle:
2011  if (hasParAngle_ && fabs(auxObsE->getParallacticAngle()-parallacticAngle2)>1.0e-12)
2013  "::getDataFromDbhImage(): got diff value for parallactic angle; epoch " +
2015  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g mas); idx=%d",
2016  auxObsE->getParallacticAngle(), parallacticAngle2,
2017  (auxObsE->getParallacticAngle()-parallacticAngle2)*RAD2MAS, obsIdx) +
2018  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
2019  station2Info->getKey() + " @ " + sourceInfo->getKey());
2020  // check oload data:
2021  if (hasOloadHorzContrib_ && fabs(auxObsE->getCalcOLoadHorz4Delay()-calcOcnLdDelH2)>1.0e-15)
2023  "::getDataFromDbhImage(): got diff value for horizontal ocean loading; epoch " +
2025  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g ps); idx=%d",
2026  auxObsE->getCalcOLoadHorz4Delay(), calcOcnLdDelH2,
2027  (auxObsE->getCalcOLoadHorz4Delay()-calcOcnLdDelH2)*1.0e12, obsIdx) +
2028  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
2029  station2Info->getKey() + " @ " + sourceInfo->getKey());
2030  if (hasOloadVertContrib_ && fabs(auxObsE->getCalcOLoadVert4Delay()-calcOcnLdDelV2)>1.0e-15)
2032  "::getDataFromDbhImage(): got diff value for vertical ocean loading; epoch " +
2034  QString().sprintf(" (was: %.6g, became: %.6g, diff: %.6g ps); idx=%d",
2035  auxObsE->getCalcOLoadVert4Delay(), calcOcnLdDelV2,
2036  (auxObsE->getCalcOLoadVert4Delay()-calcOcnLdDelV2)*1.0e12, obsIdx) +
2037  ", station2 " + station2Name + " from " + station1Info->getKey() + ":" +
2038  station2Info->getKey() + " @ " + sourceInfo->getKey());
2039  //
2040  // updating:
2041  // if previous file did not contain cable cals (e.g., S-band), and now we got them:
2043  {
2044  auxObsE->setCableCalibration(cableCorrection2);
2045  auxObsE->delAttr(SgVlbiAuxObservation::Attr_CABLE_CAL_BAD);
2046  };
2047  // also, set up meteo, if it is available:
2048  if (auxObsE->meteoData().isAttr(SgMeteoData::Attr_ARTIFICIAL_DATA) &&
2050  {
2051  auxObsE->setMeteoData(meteo2);
2052  auxObsE->meteoData().delAttr(SgMeteoData::Attr_ARTIFICIAL_DATA);
2053  };
2054  // set up azimuth & elevation angles, if they were not setuped yet:
2055  // if (auxObsE->getAzimuthAngle()<-9.0 && hasAzimuthData_)
2056  if (hasAzimuthData_)
2057  {
2058  auxObsE->setAzimuthAngle(azimuthAngle2);
2059  auxObsE->setAzimuthAngleRate(azimuthAngleRate2);
2060  };
2061  if (hasElevationData_)
2062  {
2063  auxObsE->setElevationAngle(elevationAngle2);
2064  auxObsE->setElevationAngleRate(elevationAngleRate2);
2065  };
2066  if (hasParAngle_)
2067  auxObsE->setParallacticAngle(parallacticAngle2);
2068  //
2069  /*
2070  if (hasNgradParts_)
2071  {
2072  auxObsE->setDdel_dTzdGrdN(calcNgradNPart2);
2073  auxObsE->setDdel_dTzdGrdE(calcNgradEPart2);
2074  };
2075  */
2076  };
2077  // cummulative statistics (do we need it?):
2078  station1Info->incNumTotal(DT_DELAY);
2079  station1Info->incNumTotal(DT_RATE);
2080  station2Info->incNumTotal(DT_DELAY);
2081  station2Info->incNumTotal(DT_RATE);
2082  sourceInfo->incNumTotal(DT_DELAY);
2083  sourceInfo->incNumTotal(DT_RATE);
2084  baselineInfo->incNumTotal(DT_DELAY);
2085  baselineInfo->incNumTotal(DT_RATE);
2086  }; // end of "have2getAll"
2087  };
2088  //
2089  // here we will check DBH header for conistency with observations and
2090  // absorb some aux info (e.g., cable signs)
2091  //
2092  // first, check reported numbers:
2093  int dbhNumOfStations=0, dbhNumOfSources=0;
2094  // stations:
2095  if (hasNSites_)
2096  {
2097  dbhNumOfStations = image->getI2(dNSites_, 0,0,0);
2098  if (dbhNumOfStations!=stationsByName_.size())
2100  "::getDataFromDbhImage(): the actual number of stations " +
2101  QString().sprintf("(%d) is not equal to the reported in DBH file (%d)",
2102  stationsByName_.size(), dbhNumOfStations));
2103  }
2104  else
2106  "::getDataFromDbhImage(): cannot find lcode '" + rNSites_.lCode_ + "' in the image");
2107  // sources:
2108  if (hasNStars_)
2109  {
2110  dbhNumOfSources = image->getI2(dNStars_, 0,0,0);
2111  if (dbhNumOfSources!=sourcesByName_.size())
2113  "::getDataFromDbhImage(): the actual number of radio sources " +
2114  QString().sprintf("(%d) is not equal to the reported in DBH file (%d)",
2115  sourcesByName_.size(), dbhNumOfSources));
2116  }
2117  else
2119  "::getDataFromDbhImage(): cannot find lcode '" + rNStars_.lCode_ + "' in the image");
2120  // observations:
2121  /*
2122  if (hasNObs_ && have2getAll)
2123  {
2124  dbhNumOfObservations = image->getI2(dNObs_, 0,0,0);
2125  if (dbhNumOfObservations!=band->observables().size())
2126  logger->write(SgLogger::WRN, SgLogger::IO_DBH, className() +
2127  ": getDataFromDbhImage(): the actual number of observations " +
2128  QString().sprintf("(%d) is not equal to the reported in DBH file (%d)",
2129  band->observables().size(), dbhNumOfObservations));
2130  }
2131  else
2132  logger->write(SgLogger::WRN, SgLogger::IO_DBH, className() +
2133  ": getDataFromDbhImage(): cannot find lcode '" + rNObs_.lCode_ + "' in the image");
2134  */
2135  //
2136  //
2137  //
2138  if (have2getAll)
2139  {
2142  // Preparation:
2143  //
2144  // make a setup of local clocks and zenith delays:
2145  for (StationsByName_it it = stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2146  {
2147  station1Info = it.value();
2148  station1Info->setPcClocks(parametersDescriptor_->getClock0());
2149  station1Info->setPcZenith(parametersDescriptor_->getZenith());
2150  };
2151  //
2152  // PWL contraints setup:
2153  //
2154  bool hasUniqStnClcConfigSn(false), hasUniqStnZenConfigSn(false);
2155  bool hasUniqStnClcConfigSe(false), hasUniqStnZenConfigSe(false);
2156  double scale4ClcApriori, scale4ZenApriori;
2157  double oldClcPwlApriori, oldZenPwlApriori;
2158  double newClcPwlApriori, newZenPwlApriori;
2159  scale4ClcApriori = 36.0*24.0;
2160  scale4ZenApriori = 1.0e-12*24.0*vLight*100.0;
2161  oldClcPwlApriori = parametersDescriptor_->getClock0().getPwlAPriori();
2162  oldZenPwlApriori = parametersDescriptor_->getZenith().getPwlAPriori();
2163  //
2165  hasUniqStnClcConfigSe = true;
2167  hasUniqStnClcConfigSn = true;
2168  else if (hasClockConstr_ && dClockConstr_->dim1()==1 &&
2169  fabs(oldClcPwlApriori/scale4ClcApriori - image->getR8(dClockConstr_, i,0,0)) > 1.0e-3)
2170  {
2171  newClcPwlApriori = image->getR8(dClockConstr_, 0,0,0)*scale4ClcApriori;
2173  pc.setPwlAPriori(newClcPwlApriori);
2176  "::getDataFromDbhImage(): changed clocks PWL constraints from " +
2177  QString("").setNum(oldClcPwlApriori) + " to " + QString("").setNum(newClcPwlApriori));
2178  };
2179  //
2181  hasUniqStnZenConfigSe = true;
2183  hasUniqStnZenConfigSn = true;
2184  else if (hasAtmConstr_ && dAtmConstr_->dim1()==1 &&
2185  fabs(oldZenPwlApriori/scale4ZenApriori - image->getR8(dAtmConstr_, i,0,0)) > 1.0e-3)
2186  {
2187  newZenPwlApriori = image->getR8(dAtmConstr_, 0,0,0)*scale4ZenApriori;
2189  pc.setPwlAPriori(newZenPwlApriori);
2192  "::getDataFromDbhImage(): changed zenith PWL constraints from " +
2193  QString("").setNum(oldZenPwlApriori) + " to " + QString("").setNum(newZenPwlApriori));
2194  };
2195  //
2196  // intervals:
2197  // clocks:
2198  if (hasClockIntrv_)
2199  {
2200  if (dClockIntrv_->dim1()==1 && dClockIntrv_->dim2()==1 && dClockIntrv_->dim3()==1)
2201  {
2202  double ci=image->getR8(dClockIntrv_, 0,0,0)/24.0;
2204  double oldCi=pc.getPwlStep();
2205  if (fabs(oldCi - ci) > 1.0e-3)
2206  {
2207  pc.setPwlStep(ci);
2210  "::getDataFromDbhImage(): changed clocks PWL interval from " +
2211  QString("").setNum(oldCi*24.0) + " to " + QString("").setNum(ci*24.0) + " hr(s)");
2212  };
2213  }
2214  else
2216  "::getDataFromDbhImage(): got a multidimensional CLK_INTV: " +
2217  QString("").sprintf("(%d:%d:%d)",
2219  };
2220  //
2221  // zenith delays:
2222  if (hasAtmIntrv_)
2223  {
2224  if (dAtmIntrv_->dim1()==1 && dAtmIntrv_->dim2()==1 && dAtmIntrv_->dim3()==1)
2225  {
2226  double ci=image->getR8(dAtmIntrv_, 0,0,0)/24.0;
2228  double oldCi=pc.getPwlStep();
2229  if (fabs(oldCi - ci) > 1.0e-3)
2230  {
2231  pc.setPwlStep(ci);
2234  "::getDataFromDbhImage(): changed zenith delay PWL interval from " +
2235  QString("").setNum(oldCi*24.0) + " to " + QString("").setNum(ci*24.0) + " hr(s)");
2236  };
2237  }
2238  else
2240  "::getDataFromDbhImage(): got a multidimensional ATM_INTV: " +
2241  QString("").sprintf("(%d:%d:%d)", dAtmIntrv_->dim1(), dAtmIntrv_->dim2(), dAtmIntrv_->dim3()));
2242  };
2243  //
2244  //
2245  //
2246  // collect info about sources:
2247  if (hasStarNames_)
2248  {
2249  if (dStarNames_->dim2()!=sourcesByName_.size())
2251  "::getDataFromDbhImage(): the dimension of the '" + rStarNames_.lCode_ + "' lCode " +
2252  QString().sprintf("(%d) is not equal to the actual number of sources (%d)",
2253  dStarNames_->dim2(), sourcesByName_.size()));
2254  for (int i=0; i<dStarNames_->dim2(); i++)
2255  {
2256  sourceName = image->getStr(dStarNames_, i,0);
2257  if (sourcesByName_.contains(sourceName))
2258  {
2259  sourceInfo = sourcesByName_.value(sourceName);
2260  bandSourceInfo = band->sourcesByName().value(sourceName);
2261  double ra(0.0), dn(0.0);
2262  // coordinates:
2263  if (hasStar2000_)
2264  {
2265  ra = image->getR8(dStar2000_, 0,i,0);
2266  dn = image->getR8(dStar2000_, 1,i,0);
2267  sourceInfo->setRA(ra);
2268  sourceInfo->setDN(dn);
2269  bandSourceInfo->setRA(ra);
2270  bandSourceInfo->setDN(dn);
2271  }
2272  else
2274  "::getDataFromDbhImage(): cannot find lcode '" + rStar2000_.lCode_ + "' in the image");
2275  }
2276  else // complain:
2278  "::getDataFromDbhImage(): cannot find source '" + sourceName + "' in the list of sources");
2279  };
2280  }
2281  else
2283  "::getDataFromDbhImage(): cannot find lcode '" + rStarNames_.lCode_ + "' in the image");
2284  //
2285  //
2286  // collect info about stations:
2287  //
2288  if (hasSiteNames_)
2289  {
2290  if (dSiteNames_->dim2() != stationsByName_.size())
2292  "::getDataFromDbhImage(): the dimension of the '" + rSiteNames_.lCode_ + "' lCode " +
2293  QString().sprintf("(%d) is not equal to the actual number of stations (%d)",
2294  dSiteNames_->dim2(), stationsByName_.size()));
2295  // clear info's station list:
2296  calcInfo_.stations().clear();
2297  for (int i=0; i<dSiteNames_->dim2(); i++)
2298  {
2299  station1Name = image->getStr(dSiteNames_, i,0);
2300  if (stationsByName_.contains(station1Name))
2301  {
2302  station1Info = stationsByName_.value(station1Name);
2304  double axisOffset = 0.0;
2305  Sg3dVector r(v3Zero);
2306  // axis offset type:
2307  switch (hasAxisTypes_?image->getI2(dAxisTypes_, i,0,0):0)
2308  {
2309  case 1:
2311  break;
2312  case 2:
2314  break;
2315  case 3:
2317  break;
2318  case 4:
2320  break;
2321  case 5:
2323  break;
2324  default:
2326  "::getDataFromDbhImage(): got unknown value for the lCode '" + rAxisTypes_.lCode_ + "'");
2327  break;
2328  };
2329  station1Info->setMntType(mnt);
2331  "::getDataFromDbhImage(): set up mounting type [" + sMntTypes[mnt] + "] for the antenna " +
2332  station1Info->getKey());
2333  // axis offset:
2334  if (hasAxisOffsets_)
2335  {
2336  axisOffset = image->getR8(dAxisOffsets_, i,0,0);
2337  station1Info->setAxisOffset(axisOffset);
2339  "::getDataFromDbhImage(): the value of axiss offset for the antenna " +
2340  station1Info->getKey() + " has been set up to " + QString("").setNum(axisOffset));
2341  }
2342  else
2344  "::getDataFromDbhImage(): cannot find lcode '" + rAxisOffsets_.lCode_ + "' in the image");
2345  // coordinates:
2346  if (hasSiteRecs_)
2347  {
2348  r(X_AXIS) = image->getR8(dSiteRecs_, 0,i,0);
2349  r(Y_AXIS) = image->getR8(dSiteRecs_, 1,i,0);
2350  r(Z_AXIS) = image->getR8(dSiteRecs_, 2,i,0);
2351  station1Info->setR(r);
2352  calcInfo_.stations().append(station1Info);
2353  }
2354  else
2356  "::getDataFromDbhImage(): cannot find lcode '" + rSiteRecs_.lCode_ + "' in the image");
2357  //
2358  // Pick up the ocean loading coefficients:
2360  {
2361  for (int iWave=0; iWave<11; iWave++)
2362  {
2363  station1Info->setOLoadAmplitude(iWave, 0, image->getR8(dOloadAmpVert_, iWave,i,0));
2364  station1Info->setOLoadAmplitude(iWave, 1, image->getR8(dOloadAmpHorz_, iWave,i,0));
2365  station1Info->setOLoadAmplitude(iWave, 2, image->getR8(dOloadAmpHorz_, iWave,i,1));
2366  station1Info->setOLoadPhase(iWave, 0, image->getR8(dOloadPhsVert_, iWave,i,0));
2367  station1Info->setOLoadPhase(iWave, 1, image->getR8(dOloadPhsHorz_, iWave,i,0));
2368  station1Info->setOLoadPhase(iWave, 2, image->getR8(dOloadPhsHorz_, iWave,i,1));
2369  };
2371  "::getDataFromDbhImage(): set up ocean loading coefficients for the station " +
2372  station1Info->getKey());
2373  };
2374  if (hasTectPlateNames_)
2375  {
2376  station1Info->setTectonicPlateName(image->getStr(dTectPlateNames_, i,0));
2378  "::getDataFromDbhImage(): tectonic plate name was set to [" +
2379  station1Info->getTectonicPlateName() + "] for the station " + station1Info->getKey());
2380  };
2381  //
2382  if (hasUniqStnClcConfigSn &&
2383  fabs(oldClcPwlApriori/scale4ClcApriori - image->getR8(dClockConstr_, i,0,0)) > 1.0e-3)
2384  {
2385  newClcPwlApriori = image->getR8(dClockConstr_, i,0,0)*scale4ClcApriori;
2386  station1Info->pcClocks()->setPwlAPriori(newClcPwlApriori);
2389  "::getDataFromDbhImage(): set a unique clock setup for station '" + station1Name +
2390  "' and changed constraints from " + QString("").setNum(oldClcPwlApriori) + " to " +
2391  QString("").setNum(newClcPwlApriori));
2392  };
2393  if (hasUniqStnZenConfigSn &&
2394  fabs(oldZenPwlApriori/scale4ZenApriori - image->getR8(dAtmConstr_, i,0,0)) > 1.0e-3)
2395  {
2396  newZenPwlApriori = image->getR8(dAtmConstr_, i,0,0)*scale4ZenApriori;
2397  station1Info->pcZenith()->setPwlAPriori(newZenPwlApriori);
2400  "::getDataFromDbhImage(): set a unique zenith setup for station '" + station1Name +
2401  "' and changed constraints from " + QString("").setNum(oldZenPwlApriori) + " to " +
2402  QString("").setNum(newZenPwlApriori));
2403  };
2404  //
2405  }
2406  else // complain:
2408  "::getDataFromDbhImage(): cannot find station '" + station1Name +
2409  "' in the list of stations");
2410  };
2411  }
2412  else
2414  "::getDataFromDbhImage(): cannot find lcode '" + rSiteNames_.lCode_ + "' in the image");
2415  //
2416  // constraints, can be represented by theirs own namelists:
2417  if (hasUniqStnClcConfigSe)
2418  for (int i=0; i<dCcSites_->dim2(); i++)
2419  {
2420  station1Name = image->getStr(dCcSites_, i,0);
2421  if (stationsByName_.contains(station1Name))
2422  {
2423  station1Info = stationsByName_.value(station1Name);
2424  if (fabs(oldClcPwlApriori/scale4ClcApriori - image->getR8(dClockConstr_, i,0,0)) > 1.0e-3)
2425  {
2426  newClcPwlApriori = image->getR8(dClockConstr_, i,0,0)*scale4ClcApriori;
2427  station1Info->pcClocks()->setPwlAPriori(newClcPwlApriori);
2430  "::getDataFromDbhImage(): set a unique clock setup for station '" + station1Name +
2431  "' and changed constraints from " + QString("").setNum(oldClcPwlApriori/scale4ClcApriori) +
2432  " to " + QString("").setNum(newClcPwlApriori/scale4ClcApriori) );
2433  };
2434  };
2435  };
2436  if (hasUniqStnZenConfigSe)
2437  for (int i=0; i<dAcSites_->dim2(); i++)
2438  {
2439  station1Name = image->getStr(dAcSites_, i,0);
2440  if (stationsByName_.contains(station1Name))
2441  {
2442  station1Info = stationsByName_.value(station1Name);
2443  if (fabs(oldZenPwlApriori/scale4ZenApriori - image->getR8(dAtmConstr_, i,0,0)) > 1.0e-3)
2444  {
2445  newZenPwlApriori = image->getR8(dAtmConstr_, i,0,0)*scale4ZenApriori;
2446  station1Info->pcZenith()->setPwlAPriori(newZenPwlApriori);
2449  "::getDataFromDbhImage(): set a unique zenith setup for station '" + station1Name +
2450  "' and changed constraints from " + QString("").setNum(oldZenPwlApriori/scale4ZenApriori) +
2451  " to " + QString("").setNum(newZenPwlApriori/scale4ZenApriori));
2452  };
2453  };
2454  };
2455  //
2456  //
2457  // baselines selection status:
2459  {
2460  int bitArray;
2461  SgVlbiBaselineInfo *bi, *biR;
2462  for (int i=0; i<dSiteNames_->dim2(); i++)
2463  {
2464  station1Name = image->getStr(dSiteNames_, i,0);
2465  if (stationsByName_.contains(station1Name))
2466  {
2467  for (int j=0; j<dSiteNames_->dim2(); j++)
2468  {
2469  station2Name = image->getStr(dSiteNames_, j,0);
2470  if (stationsByName_.contains(station2Name))
2471  {
2472  bitArray = image->getI2(dBaselinesSelStatus_, dSiteNames_->dim2()*j + i,0,0);
2473  if (baselinesByName_.contains(station1Name + ":" + station2Name))
2474  bi = baselinesByName_.value(station1Name + ":" + station2Name);
2475  else
2476  bi = NULL;
2477  if (baselinesByName_.contains (station2Name + ":" + station1Name))
2478  biR = baselinesByName_.value(station2Name + ":" + station1Name);
2479  else
2480  biR = NULL;
2481  // check for deselect flag:
2482  if (!(bitArray & (1<<1)))
2483  {
2484  if (bi)
2486  if (biR)
2488  };
2489  // check for baseline clocks flag:
2490  if ((bitArray & (1<<3)))
2491  {
2492  if (bi)
2494  if (biR)
2496  };
2497  };
2498  };
2499  };
2500  };
2501  };
2502  //
2503  // reweightinig sigmas:
2504  if (hasError_Bl_ && hasError_K_)
2505  {
2506  SgVlbiBaselineInfo *bi;
2507  for (int i=0; i<dError_Bl_->dim3(); i++)
2508  {
2509  station1Name = image->getStr(dError_Bl_, 0,i);
2510  station2Name = image->getStr(dError_Bl_, 1,i);
2511  if (baselinesByName_.contains(station1Name + ":" + station2Name))
2512  {
2513  bi = baselinesByName_.value(station1Name + ":" + station2Name);
2514  bi->setSigma2add(DT_DELAY, image->getR8(dError_K_, 0,i,0));
2515  bi->setSigma2add(DT_RATE, image->getR8(dError_K_, 1,i,0));
2516  }
2517  else
2519  "::getDataFromDbhImage(): cannot find baseline '" + station1Name + ":" + station2Name +
2520  "' in the map of baselines");
2521  };
2522  }
2523  else
2524  {
2525  for (BaselinesByName_it ij=baselinesByName_.begin(); ij!=baselinesByName_.end(); ++ij)
2526  {
2527  ij.value()->setSigma2add(DT_DELAY, config_->getInitAuxSigma4Delay());
2528  ij.value()->setSigma2add(DT_RATE, config_->getInitAuxSigma4Rate());
2529  };
2530  };
2531  //
2532  // sources selection status:
2534  {
2535  int bitArray;
2536  SgVlbiSourceInfo *si;
2537  for (int i=0; i<dStarNames_->dim2(); i++)
2538  {
2539  sourceName = image->getStr(dStarNames_, i,0);
2540  if (sourcesByName_.contains(sourceName))
2541  {
2542  si = sourcesByName_.value(sourceName);
2543  bitArray = image->getI2(dSourcesSelStatus_, i,0,0);
2544  // check for deselect flag:
2545  if (!(bitArray & (1<<0)))
2547  };
2548  };
2549  };
2550  //
2551  // cable calibration signs:
2553  {
2554  QMap<QString, double> signsByName;
2555  for (int i=0; i<dCableStations_->dim2(); i++)
2556  {
2557  QString stnName=image->getStr(dCableStations_, i, 0);
2558  QString stnSign=image->getStr(dCableSigns_, 0, 0).mid(2*i, 2);
2559  if (stnName.simplified().length()>1)
2560  {
2561  if (signsByName.contains(stnName))
2563  "::getDataFromDbhImage(): got duplicate station " + stnName +
2564  " in the list of cable calibration signs");
2565  else
2566  {
2567  double d;
2568  if (stnSign.contains("-"))
2569  d = -1.0;
2570  else if (stnSign.contains("+"))
2571  d = 1.0;
2572  else
2573  d = 0.0;
2574  signsByName[stnName] = d;
2575  };
2576  };
2577  };
2578  // apply the signs to the stations:
2579  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2580  {
2581  QString stnName=it.value()->getKey();
2582  if (signsByName.contains(stnName))
2583  {
2584  // store a sign in separate place (may be we will need it later):
2585  it.value()->setCableCalMultiplierDBCal(signsByName[stnName]);
2587  "::getDataFromDbhImage(): according to dbcal the station " + stnName +
2588  (signsByName[stnName]!=0?(" has a sign `" +
2589  QString(signsByName[stnName]==1?"+":"-") +
2590  "' of cable calibration"):" has no cable calibration sign"));
2591  }
2592  else // no cable sign ==> no cable data at all.
2593  {
2595  "::getDataFromDbhImage(): the station " + stnName + " has no cable cal sign");
2596  it.value()->addAttr(SgVlbiStationInfo::Attr_IGNORE_CABLE_CAL);
2597  };
2598  };
2599  };
2600  // a priori clock model (if available):
2601  if (hasAcmNames_ && hasAcmOffsets_ && hasAcmRates_) // ACM stuff
2602  {
2603  int n=4;
2604  bool isOk=true;
2605  if (hasAcmNumber_)
2606  n = image->getI2(dAcmNumber_, 0,0,0);
2607  // check the dimensions:
2608 
2609  if (!(dAcmNames_->dim2()==n || (dAcmNames_->dim2()==4 && n<=4)))
2610  {
2611  isOk = false;
2613  "::getDataFromDbhImage(): get unexpected dimension of " + dAcmNames_->getLCode() + ": " +
2614  QString("").setNum(dAcmNames_->dim2()) + "; have to be " + QString("").setNum(n));
2615  };
2616  if (!(dAcmOffsets_->dim1()==n || (dAcmOffsets_->dim1()==4 && n<=4)))
2617  {
2618  isOk = false;
2620  "::getDataFromDbhImage(): get unexpected dimension of " + dAcmOffsets_->getLCode() + ": " +
2621  QString("").setNum(dAcmOffsets_->dim1()) + "; have to be " + QString("").setNum(n));
2622  };
2623  if (!(dAcmRates_->dim1()==n || (dAcmRates_->dim1()==4 && n<=4)))
2624  {
2625  isOk = false;
2627  "::getDataFromDbhImage(): get unexpected dimension of " + dAcmRates_->getLCode() + ": " +
2628  QString("").setNum(dAcmRates_->dim1()) + "; have to be " + QString("").setNum(n));
2629  };
2630  if (hasAcmEpochs_ && !(dAcmEpochs_->dim2()==n || (dAcmEpochs_->dim2()==4 && n<=4)))
2631  {
2632  isOk = false;
2634  "::getDataFromDbhImage(): get unexpected dimension of " + dAcmEpochs_->getLCode() + ": " +
2635  QString("").setNum(dAcmEpochs_->dim2()) + "; have to be " + QString("").setNum(n));
2636  };
2637  //
2638  if (isOk)
2639  for (int i=0; i<n; i++)
2640  {
2641  QString stnName=image->getStr(dAcmNames_, i, 0);
2642  if (stnName.simplified().size())
2643  {
2645  "::getDataFromDbhImage(): processing ACM for [" + stnName + "] station");
2646  if (stationsByName_.contains(stnName))
2647  {
2648  station1Info = stationsByName_.value(stnName);
2649  // the ACM with non-zero epochs will go to a clock break model:
2650  if (hasAcmEpochs_ && image->getI2(dAcmEpochs_, 0,i,0))
2651  {
2652  year = image->getI2(dAcmEpochs_, 0,i,0);
2653  month = image->getI2(dAcmEpochs_, 1,i,0);
2654  day = image->getI2(dAcmEpochs_, 2,i,0);
2655  hour = image->getI2(dAcmEpochs_, 3,i,0);
2656  minute = image->getI2(dAcmEpochs_, 4,i,0);
2657  second = image->getI2(dAcmEpochs_, 5,i,0);
2658  // add a static clock break:
2660  *clockBreak=
2661  new SgParameterBreak(SgMJD(year, month, day, hour, minute, second),
2662  image->getR8(dAcmOffsets_, i,0,0)*1.0e9, // ns
2663  image->getR8(dAcmRates_ , i,0,0)*1.0e12); // ps/s
2665  if (station1Info->clockBreaks().addBreak(clockBreak))
2667  "::getDataFromDbhImage(): a priori clock model was added to the station " +
2668  station1Info->getKey() + " as a static clock break that occurred on " +
2669  clockBreak->toString());
2670  else
2672  "::getDataFromDbhImage(): adding new clock break at " + station1Info->getKey() +
2673  " station on " + clockBreak->toString() + " failed");
2674  }
2675  // otherwice, add it as a permanent shift:
2676  else
2677  {
2678  station1Info->setNeed2useAPrioriClocks(true);
2679  station1Info->setAPrioriClockTerm_0(image->getR8(dAcmOffsets_, i,0,0));
2680  station1Info->setAPrioriClockTerm_1(image->getR8(dAcmRates_, i,0,0));
2681  };
2682  }
2683  else
2685  "::getDataFromDbhImage(): the station [" + stnName + "] was not found in the map");
2686  };
2687  }
2688  else
2690  "::getDataFromDbhImage(): a priori clock model was found but the dimensions looks strange");
2691  }
2692  else
2694  "::getDataFromDbhImage(): no any a priori clock model found");
2695  // flags for cable calibrations (if available):
2697  {
2698  bool isCableCalMatched(false);
2699  int cableCalFlagIdx(-1);
2700  for (int i=0; i<dCalList_->dim2(); i++)
2701  if (image->getStr(dCalList_, i,0) == "CABL DEL")
2702  {
2703  isCableCalMatched = true;
2704  cableCalFlagIdx = i;
2705  };
2706  if (isCableCalMatched)
2707  {
2708  QString str;
2709  // use order of stations from CALSITES list:
2710  for (int i=0; i<dCalSites_->dim2(); i++)
2711  {
2712  str = image->getStr(dCalSites_, i,0);
2713  if (stationsByName_.contains(str))
2714  {
2715  SgVlbiStationInfo *si=stationsByName_.value(str);
2716  // just alternate cable cal flag:
2717  int nFlag=image->getI2(dCalFlags_, i,0,0,-1);
2718  if (nFlag & 1<<cableCalFlagIdx)
2720  else
2722  }
2723  else
2725  "::getDataFromDbhImage(): cannot find " + str +
2726  " (an entry from CALSITES LCode) in the list of stations");
2727  };
2728  }
2729  else
2731  "::getDataFromDbhImage(): there is no \"CABL DEL\" flag in the LCode CAL LIST");
2732  };
2733  // set up a reference clock site, if available:
2734  QString clockSiteName("");
2735  if (dClockSite_)
2736  {
2737  clockSiteName = image->getStr(dClockSite_, 0, 0);
2738  for (StationsByName_it it=band->stationsByName().begin(); it!=band->stationsByName().end(); ++it)
2739  {
2740  if (clockSiteName == it.value()->getKey())
2741  {
2742  it.value()->addAttr(SgVlbiStationInfo::Attr_REFERENCE_CLOCKS);
2744  "::getDataFromDbhImage(): Reference Clock attribute has been assigned to the station " +
2745  it.value()->getKey() + "; band: " + band->getKey());
2746  };
2747  };
2748  };
2749  // reference clock site finished.
2750  // clock break:
2751  if (hasClockBreakStatus_ && image->getStr(dClockBreakStatus_, 0,0) == "YE")
2752  {
2753  int numOfClockBreaks = image->getI2(dClkBrkNum_, 0,0,0);
2754  if (numOfClockBreaks != dClkBrkEpochs_->dim1())
2755  {
2757  "::getDataFromDbhImage(): declared number of clock breaks (" +
2758  QString("").setNum(numOfClockBreaks) + ") is not equal to BRK_EPOC dimension " +
2759  QString("").setNum(dClkBrkEpochs_->dim1()));
2760  numOfClockBreaks = std::min(numOfClockBreaks, (int)(dClkBrkEpochs_->dim1()));
2761  };
2762  if (numOfClockBreaks != dClkBrkNames_->dim2())
2763  {
2765  "::getDataFromDbhImage(): declared number of clock breaks (" +
2766  QString("").setNum(numOfClockBreaks) + ") is not equal to BRK_SNAM dimension " +
2767  QString("").setNum(dClkBrkNames_->dim2()));
2768  numOfClockBreaks = std::min(numOfClockBreaks, (int)(dClkBrkNames_->dim2()));
2769  };
2770  QString stnName("");
2771  for (int i=0; i<numOfClockBreaks; i++)
2772  {
2773  double t;
2774  t = image->getR8(dClkBrkEpochs_, i,0,0) - 2400000.5; // JD => MJD
2775  t = round(t*DAY2SEC*10.0)/10.0/DAY2SEC; // round it up to 0.1sec
2776  SgMJD tBreak(t);
2777  stnName = image->getStr(dClkBrkNames_, i,0);
2778  SgVlbiStationInfo *stn2Correct=NULL;
2779  if (stationsByName_.contains(stnName))
2780  stn2Correct = stationsByName_.value(stnName);
2781  // databases does not know where the clock break occurred, made it session-wide and dynamic:
2782  if (stn2Correct)
2783  {
2784  SgParameterBreak *clockBreak=new SgParameterBreak(tBreak, 0.0);
2786  if (stn2Correct->clockBreaks().addBreak(clockBreak))
2788  "::getDataFromDbhImage(): a clock break at station " + stn2Correct->getKey() +
2789  " that occurred on " + tBreak.toString() + " has been added to the session");
2790  else
2792  "::getDataFromDbhImage(): adding new clock break at " + stn2Correct->getKey() +
2793  " station on " + tBreak.toString() + " failed");
2794  };
2795  if (band->stationsByName().contains(stnName))
2796  stn2Correct = band->stationsByName().value(stnName);
2797  if (false && stn2Correct) // that's for future
2798  {
2799  SgParameterBreak *clockBreak=new SgParameterBreak(SgMJD(t), 0.0);
2800  if (stn2Correct->clockBreaks().addBreak(clockBreak))
2802  "::getDataFromDbhImage(): a clock break at station " + stn2Correct->getKey() +
2803  " that occurred on " + tBreak.toString() + " has been added to the band");
2804  else
2806  "::getDataFromDbhImage(): adding new clock break at " + stn2Correct->getKey() +
2807  " station on " + tBreak.toString() + " failed");
2808  };
2809  };
2810  };
2811  // end of clock breaks.
2812  // check for leap seconds:
2813  if (hasTai_2_Utc_)
2814  {
2815  double ls=image->getR8(dTai_2_Utc_, 1,0,0);
2816  if (fabs(getLeapSeconds()) < 1.0e-6) // practically, == 0.0
2817  {
2818  setLeapSeconds(ls);
2820  "::getDataFromDbhImage(): a leap seconds LCode has been detected; " + QString().setNum(ls) +
2821  " leap seconds were assigned");
2822  }
2823  else if (fabs(getLeapSeconds() - ls) > 1.0e-6) // just check and complain
2825  "::getDataFromDbhImage(): a leap seconds from the database (" + QString().setNum(ls) +
2826  ") is not the same as in the session (" + QString().setNum(getLeapSeconds()) + "). Ignored.");
2827  };
2828  //
2829  // pick up ERP table for interpolation (if exists):
2830  if (hasFut1_inf_ && hasFut1_pts_)
2831  {
2832  double t0=image->getR8(dFut1_inf_, 0,0,0);
2833  double dt=image->getR8(dFut1_inf_, 1,0,0);
2834  int numOfPts=image->getR8(dFut1_inf_, 2,0,0);
2835  if (t0 > 2390000.0)
2836  t0 -= 2400000.5;
2837  if (dFut1_pts_->dim1()<numOfPts)
2838  numOfPts = dFut1_pts_->dim1();
2840  delete args4Ut1Interpolation_;
2841  args4Ut1Interpolation_ = new SgVector(numOfPts);
2843  delete tabs4Ut1Interpolation_;
2844  tabs4Ut1Interpolation_ = new SgMatrix(numOfPts, 1);
2845  for (int i=0; i<numOfPts; i++)
2846  {
2847  args4Ut1Interpolation_->setElement(i, t0 + dt*i);
2848  // LCODE contains TAI-UT1, revert the sign:
2849  tabs4Ut1Interpolation_->setElement(i, 0, -image->getR8(dFut1_pts_, i,0,0));
2850  };
2851  hasUt1Interpolation_ = true;
2853  "::getDataFromDbhImage(): loaded " + QString().setNum(numOfPts) +
2854  " records for UT1 interpolation");
2855  }
2856  else
2857  {
2859  {
2860  delete args4Ut1Interpolation_;
2861  args4Ut1Interpolation_ = NULL;
2862  };
2864  {
2865  delete tabs4Ut1Interpolation_;
2866  tabs4Ut1Interpolation_ = NULL;
2867  };
2868  hasUt1Interpolation_ = false;
2869  };
2870  if (hasFwob_inf_ && hasFwob_pts_)
2871  {
2872  double t0=image->getR8(dFwob_inf_, 0,0,0);
2873  double dt=image->getR8(dFwob_inf_, 1,0,0);
2874  int numOfPts=image->getR8(dFwob_inf_, 2,0,0);
2875  if (t0 > 2390000.0)
2876  t0 -= 2400000.5;
2877  if (dFwob_pts_->dim2()<numOfPts)
2878  numOfPts = dFwob_pts_->dim2();
2880  delete args4PxyInterpolation_;
2881  args4PxyInterpolation_ = new SgVector(numOfPts);
2883  delete tabs4PxyInterpolation_;
2884  tabs4PxyInterpolation_ = new SgMatrix(numOfPts, 2);
2885  for (int i=0; i<numOfPts; i++)
2886  {
2887  args4PxyInterpolation_->setElement(i, t0 + dt*i);
2888  tabs4PxyInterpolation_->setElement(i, 0, image->getR8(dFwob_pts_, 0,i,0));
2889  tabs4PxyInterpolation_->setElement(i, 1, image->getR8(dFwob_pts_, 1,i,0));
2890  };
2891  hasPxyInterpolation_ = true;
2893  "::getDataFromDbhImage(): loaded " + QString().setNum(numOfPts) +
2894  " records for polar motion interpolation");
2895  }
2896  else
2897  {
2899  {
2900  delete args4PxyInterpolation_;
2901  args4PxyInterpolation_ = NULL;
2902  };
2904  {
2905  delete tabs4PxyInterpolation_;
2906  tabs4PxyInterpolation_ = NULL;
2907  };
2908  hasPxyInterpolation_ = false;
2909  };
2910  if (hasTidalUt1_)
2911  {
2912  QString ut1Type("");
2913  int n=image->getI2(dTidalUt1_, 0,0,0);
2914  switch (n)
2915  {
2916  case 1:
2918  ut1Type = "Seriesfull of tides";
2919  break;
2920  case -1: // UT1R
2922  ut1Type = "Only short period tidal terms are removed";
2923  break;
2924  case -2: // UT1S
2926  ut1Type = "All tidal terms are removed";
2927  break;
2928  default:
2930  "::getDataFromDbhImage(): got undocumented value for the LCode TIDALUT1: " +
2931  QString().setNum(n) + "; the UT1 type has been reverted to default");
2932  break;
2933  };
2935  "::getDataFromDbhImage(): the type of the UT1 inner series has been set to " + ut1Type);
2936  };
2937  //
2938  //
2939  // if aux.obs were loaded, set up the flag:
2942  if (hasIonCorr_ && hasIonRms_)
2943  {
2946 // addAttr(Attr_FF_ION_C_CALCULATED);
2947  };
2948  //
2949  // checks for available "contributions":
2950  if (hasOloadContrib_)
2951  hasOceanTideContrib_ = true;
2952  if (hasPtdContrib_)
2953  hasPoleTideContrib_ = true;
2954  if (hasEtdContrib_)
2955  hasEarthTideContrib_ = true;
2956  if (hasWobXContrib_)
2957  hasWobblePxContrib_ = true;
2958  if (hasWobYContrib_)
2959  hasWobblePyContrib_ = true;
2960  if (hasWobNutatContrib_)
2961  hasWobbleNutContrib_ = true;
2962  if (hasWobOrtho_)
2964  if (hasUt1Ortho_)
2965  hasUt1HighFreqContrib_ = true;
2966  if (hasFeedCorr_)
2967  hasFeedCorrContrib_ = true;
2968  if (hasTiltRemvr_)
2969  hasTiltRemvrContrib_ = true;
2970  if (hasWobLibra_)
2971  hasPxyLibrationContrib_ = true;
2972  if (hasUt1Libra_)
2973  hasUt1LibrationContrib_ = true;
2974  if (hasOptlContib_)
2975  hasOceanPoleTideContrib_ = true;
2976  if (hasMslmIonContrib_)
2977  hasGpsIonoContrib_ = true;
2978  if (hasPtdOld_)
2979  hasPoleTideOldContrib_ = true;
2980  if (hasOceOld_)
2981  hasOceanTideOldContrib_ = true;
2982  if (hasNdryCont_)
2983  hasNdryContrib_ = true;
2984  if (hasNwetCont_)
2985  hasNwetContrib_ = true;
2986  if (hasUnPhaseCal_)
2987  hasUnPhaseCalContrib_ = true;
2988  if (hasNgradParts_)
2989  hasGradPartials_ = true;
2991  hasCipPartials_ = true;
2992  else
2993  hasCipPartials_ = false;
2994  //
2995  // check for calibration set up:
2996  if (hasObcFlags_ && hasObcList_)
2997  {
2998  int flags=image->getI2(dObcFlags_, 0,0,0);
2999  QList<QString> calList;
3000  for (int i=0; i<dObcList_->dim2(); i++)
3001  calList << image->getStr(dObcList_, i,0);
3002  applyObsCalibrationSetup(flags, calList);
3003  calList.clear();
3004  };
3005  };
3006  //--
3007 
3008  band->setTCreation(image->fileCreationEpoch());
3009  band->setInputFileName(image->fileName());
3010  band->setInputFileVersion(image->fileVersion());
3011  // if (hasCalcVersionValue_)
3012  // band->setCalcVersionValue(image->getR8(dCalcVersionValue_, 0,0,0));
3013  //
3014  // quick'n'dirty:
3015  int idx(0);
3016  o = observations_.at(idx)->observable(bandKey);
3017  while (!o && idx<observations_.size())
3018  o = observations_.at(idx++)->observable(bandKey);
3019  if (o)
3020  band->setFrequency(o->getReferenceFrequency());
3021  //
3022  // pick up history:
3023  band->history().importDbhHistoryBlock(image);
3024  //
3025  // ok, this is a primary band:
3026  if (have2getAll)
3027  {
3028  primaryBand_ = band;
3030 
3031  if (hasError_Bl_ && hasError_K_)
3033 
3034  if (hasConsensusDelay_)
3036  };
3037 
3038  SgMJD finisEpoch(SgMJD::currentMJD());
3040  "::getDataFromDbhImage(): data have been read from DBH database \"" + image->fileName() +
3041  "\", elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
3042 
3043  return isOk;
3044 };
3045 
3046 
3047 
3048 //
3050 {
3051  SgMJD startEpoch(SgMJD::currentMJD());
3052  bool isOk(true);
3053  bool isFormatActual;
3054  bool needIonFrqOutput;
3055  bool needEccOutput;
3056  bool need2CreateStnDepndntCals;
3057  bool need2CreateFlybyCals;
3058  bool need2CreateObcCals;
3059  bool need2MoveSecBandInfo(false);
3060  int numOfReferenceClockStations;
3061  int numOfClockBreaks;
3062  int numOfAcms;
3063  int numOfStations;
3064  int cableCalFlagIdx;
3065  int numOfBaselineClocks;
3066  QMultiMap<SgMJD, QString> cBreakByEpoch;
3067  //
3068 
3069  cableCalFlagIdx = 0;
3070 
3071  // write first part into history block (to mimic SOLVE behavior):
3073  //
3074  // Now, make output.
3075  // first, lookup parameters:
3076  for (int i=0; i<numOfDxT; i++)
3077  dbhDxTable[i].isPresent_ = (dbhDxTable[i].d_=image->lookupDescriptor(dbhDxTable[i].lCode_)) != NULL;
3078  // figure out what we have to export:
3079  needIonFrqOutput = !(hasGrIonFrq_ && hasPhIonFrq_);
3080  needEccOutput = !(hasEccCoords_ && hasEccNames_ && hasEccTypes_);
3081  need2MoveSecBandInfo= !(hasNAmbigSecBand_ && hasQualityCodeSecBand_ && hasEffFreqsSecBand_ &&
3087  need2MoveSecBandInfo = true; // move it anyway!
3088  // but if we have only one band, nothing to move:
3089  need2MoveSecBandInfo = need2MoveSecBandInfo && bands_.size()>1;
3090  need2CreateStnDepndntCals = !(hasCalList_ && hasCalSites_ && hasCalFlags_);
3091  need2CreateFlybyCals = !(hasFclList_ && hasFclFlags_);
3092 //need2CreateObcCals = !(hasObcList_ && hasObcFlags_);
3093  need2CreateObcCals = true;
3094  // adjust dimensions:
3095  if (hasCalSites_)
3096  {
3100  };
3101  if (hasCalFlags_)
3102  {
3106  };
3107 
3108  // form lists of stations/sources/baselines:
3109  QList<SgVlbiStationInfo*> stations;
3110  QList<SgVlbiSourceInfo*> sources;
3111  QList<SgVlbiBaselineInfo*> baselines;
3112  // keep the same order as in the DBH file:
3113  for (int i=0; i<dSiteNames_->dim2(); i++)
3114  {
3115  QString stationName = image->getStr(dSiteNames_, i,0);
3116  if (stationsByName_.contains(stationName))
3117  stations.append(stationsByName_.value(stationName));
3118  };
3119  numOfStations = stations.size();
3120  for (int i=0; i<dStarNames_->dim2(); i++)
3121  {
3122  QString sourceName = image->getStr(dStarNames_, i,0);
3123  if (sourcesByName_.contains(sourceName))
3124  sources.append(sourcesByName_.value(sourceName));
3125  };
3126  for (BaselinesByName_it it=baselinesByName_.begin(); it!=baselinesByName_.end(); ++it)
3127  baselines.append(it.value());
3128 
3129  // calc numbers of clock-reference stations and clock breaks:
3130  numOfReferenceClockStations = 0;
3131  numOfClockBreaks = 0;
3132  numOfAcms = 0;
3133  for (int i=0; i<stations.size(); i++)
3134  {
3135  SgVlbiStationInfo *si=stations.at(i);
3137  numOfReferenceClockStations++;
3138  if (si->clockBreaks().size())
3139  {
3141  for (int j=0; j<si->clockBreaks().size(); j++)
3142  {
3143  SgParameterBreak *pb=si->clockBreaks().at(j);
3144  // session-wide static clock breaks are going to ACM:
3146  cBreakByEpoch.insert(pb->getEpoch4Export(), si->getKey());
3147  else
3148  numOfAcms++;
3149  };
3150  };
3151  if (si->getNeed2useAPrioriClocks())
3152  numOfAcms++;
3153  };
3155  "::putDataIntoDbhImage(): the number of ACMs is " + QString("").setNum(numOfAcms));
3156  //
3157  // check for clock break flags at the each band:
3158  for (int iBand=0; iBand<bands_.size(); iBand++)
3159  {
3160  SgVlbiBand *band=bands_.at(iBand);
3161  for (StationsByName_it it=band->stationsByName().begin(); it!=band->stationsByName().end(); ++it)
3162  {
3163  SgVlbiStationInfo *si=it.value();
3164  if (si->clockBreaks().size())
3165  {
3166  if (stationsByName_.contains(si->getKey()))
3167  si->calcCBEpochs4Export( *stationsByName_.value(si->getKey())->auxObservationByScanId() );
3168  for (int j=0; j<si->clockBreaks().size(); j++)
3169  {
3170  SgMJD cbEpoch=si->clockBreaks().at(j)->getEpoch4Export();
3171  if (!cBreakByEpoch.contains(cbEpoch))
3172  cBreakByEpoch.insert(cbEpoch, si->getKey());
3173  else if (si->getKey() != cBreakByEpoch.find(cbEpoch).value())
3174  cBreakByEpoch.insert(cbEpoch, si->getKey());
3175  };
3176  };
3177  };
3178  };
3179  numOfClockBreaks = cBreakByEpoch.size();
3180 
3181  if (!need2CreateStnDepndntCals) // checking, continue:
3182  {
3183  bool have2rewriteSDC=false;
3184  // dimensions, if they are not equal, reset the three LCodes
3185  if (rCalSites_.dimensions_[1] != stationsByName_.size())
3186  {
3187  have2rewriteSDC = true;
3189  "::putDataIntoDbhImage(): rCalSites_.dimensions_[1] != stationsByName_.size(), " +
3190  QString("").setNum(rCalSites_.dimensions_[1]) + "!=" +
3191  QString("").setNum(stationsByName_.size()));
3192  };
3193  if (rCalFlags_.dimensions_[0] != stationsByName_.size())
3194  {
3195  have2rewriteSDC = true;
3197  "::putDataIntoDbhImage(): rCalFlags_.dimensions_[0] != stationsByName_.size(), " +
3198  QString("").setNum(rCalFlags_.dimensions_[0]) + "!=" +
3199  QString("").setNum(stationsByName_.size()));
3200  };
3201  bool isCableCalMatched=false;
3202  for (int i=0; i<rCalList_.dimensions_[1]; i++)
3203  if (image->getStr(dCalList_, i,0) == "CABL DEL")
3204  {
3205  isCableCalMatched = true;
3206  cableCalFlagIdx = i;
3207  };
3208  if (!isCableCalMatched)
3209  have2rewriteSDC = true;
3210  if (have2rewriteSDC)
3211  {
3212  // complain!
3214  "::putDataIntoDbhImage(): looks like we have to reset station dependent calibration flags, "
3215  "LCodes: CALSITES, CAL LIST and CAL FLGS");
3216  need2CreateStnDepndntCals = true;
3217  };
3218  };
3219  // figure out how many baselines have clock offset:
3220  numOfBaselineClocks = 0;
3221  for (int i=0; i<baselines.size(); i++)
3222  if (baselines.at(i)->isAttr(SgVlbiBaselineInfo::Attr_ESTIMATE_CLOCKS))
3223  numOfBaselineClocks++;
3224  //
3225  // end of checking
3226  //
3227  // adjust dimensions of some descriptors:
3228  //
3229  rError_K_ .dimensions_[1] = baselinesByName_.size();
3231  rBaselinesSelStatus_.dimensions_[0] = numOfStations*numOfStations;
3232  rSourcesSelStatus_.dimensions_[0] = sources.size();
3233  rBlDepClocks_.dimensions_[1] = numOfBaselineClocks;
3234  //
3235  if (numOfAcms)
3236  {
3237  rAcmNames_ .dimensions_[1] = useOldAcm?4:numOfAcms;
3238  rAcmOffsets_.dimensions_[0] = useOldAcm?4:numOfAcms;
3239  rAcmRates_ .dimensions_[0] = useOldAcm?4:numOfAcms;
3240  rAcmEpochs_ .dimensions_[1] = useOldAcm?4:numOfAcms;
3241  };
3242  if (useOldAcm && 4<numOfAcms)
3244  "::putDataIntoDbhImage(): number of stations with a priori clock models (" +
3245  QString("").setNum(numOfAcms) + ") is greater than 4, some parameters will not be stored");
3246  //
3247  if (numOfReferenceClockStations>0)
3248  rRefClockSites_.dimensions_[1] = numOfReferenceClockStations;
3249  if (numOfClockBreaks)
3250  {
3251  rClkBrkEpochs_.dimensions_[0] = numOfClockBreaks;
3252  rClkBrkFlags_.dimensions_[0] = numOfClockBreaks;
3253  rClkBrkNames_.dimensions_[1] = numOfClockBreaks;
3254  };
3255  // clock and zenith delay constraints:
3256  rAtmConstr_.dimensions_[0] = numOfStations;
3257  rClockConstr_.dimensions_[0] = numOfStations;
3258 
3259  //
3260  //
3261  // form the list of descriptors which have to be modified:
3262  QList<DbhDescriptorX*> listOfDescriptors;
3263  //
3264  // TOC #1 (header):
3265  listOfDescriptors.append(&rNObs_);
3266  listOfDescriptors.append(&rN4Obs_);
3267  listOfDescriptors.append(&rNRefClocks_);
3268  // ionosphere correction:
3269  listOfDescriptors.append(&rIonCorr_);
3270  listOfDescriptors.append(&rIonRms_);
3271  // number of ambiguities:
3272  listOfDescriptors.append(&rNAmbig_);
3273  // troposphere and clocks attributes:
3274  listOfDescriptors.append(&rAtmConstr_);
3275  listOfDescriptors.append(&rAtmIntrv_);
3276  listOfDescriptors.append(&rClockConstr_);
3277  listOfDescriptors.append(&rClockIntrv_);
3278  listOfDescriptors.append(&rBatchCnt_);
3279  listOfDescriptors.append(&rSolData_);
3280  listOfDescriptors.append(&rSupMet_);
3281  listOfDescriptors.append(&rAtmPartFlag_);
3282  if (numOfBaselineClocks > 0)
3283  listOfDescriptors.append(&rBlDepClocks_);
3284  listOfDescriptors.append(&rError_K_);
3285  listOfDescriptors.append(&rError_Bl_);
3286  listOfDescriptors.append(&rBaselinesSelStatus_);
3287  listOfDescriptors.append(&rSourcesSelStatus_);
3288  listOfDescriptors.append(&rIonBits_);
3289  listOfDescriptors.append(&rUserAction4Suppression_);
3290  if (numOfReferenceClockStations)
3291  {
3292  listOfDescriptors.append(&rRefClockSites_);
3293  listOfDescriptors.append(&rClockSite_);
3294  };
3295  listOfDescriptors.append(&rEl_Cut_);
3296  listOfDescriptors.append(&rAtmCflg_);
3297  listOfDescriptors.append(&rClkCflg_);
3298  if (numOfAcms)
3299  {
3300  listOfDescriptors.append(&rAcmNames_);
3301  listOfDescriptors.append(&rAcmOffsets_);
3302  listOfDescriptors.append(&rAcmRates_);
3303  listOfDescriptors.append(&rAcmEpochs_);
3304  listOfDescriptors.append(&rAcmNumber_);
3305  };
3306  if (numOfClockBreaks)
3307  {
3308  listOfDescriptors.append(&rClkBrkEpochs_);
3309  listOfDescriptors.append(&rClkBrkNum_);
3310  listOfDescriptors.append(&rClkBrkFlags_);
3311  listOfDescriptors.append(&rClkBrkNames_);
3313  }
3314  else if (isAttr(Attr_HAS_CLOCK_BREAKS))
3316  listOfDescriptors.append(&rClockBreakStatus_);
3317  // store eccentricities in the database (if they do not there yet):
3318  if (needEccOutput)
3319  {
3321  rEccNames_.dimensions_ [1] = stationsByName_.size();
3322  rEccTypes_.dimensions_ [0] = stationsByName_.size();
3323  listOfDescriptors.append(&rEccCoords_);
3324  listOfDescriptors.append(&rEccNames_);
3325  listOfDescriptors.append(&rEccTypes_);
3326  };
3327  if (need2CreateStnDepndntCals)
3328  {
3329  rCalSites_.dimensions_ [1] = stationsByName_.size();
3330  rCalFlags_.dimensions_ [0] = stationsByName_.size();
3331  // just to be sure:
3332  rCalList_. dimensions_ [0] = 4;
3333  rCalList_. dimensions_ [1] = 6;
3334  rCalList_. dimensions_ [2] = 1;
3335  listOfDescriptors.append(&rCalList_);
3336  listOfDescriptors.append(&rCalSites_);
3337  listOfDescriptors.append(&rCalFlags_);
3338  };
3339  if (need2CreateFlybyCals)
3340  {
3341  rFclFlags_.dimensions_ [0] = 7;
3342  rFclFlags_.dimensions_ [1] = stationsByName_.size();
3343  rFclFlags_.dimensions_ [2] = 1;
3344  // just to be sure:
3345  rFclList_. dimensions_ [0] = 4;
3346  rFclList_. dimensions_ [1] = 8;
3347  rFclList_. dimensions_ [2] = 1;
3348  listOfDescriptors.append(&rFclList_);
3349  listOfDescriptors.append(&rFclFlags_);
3350  };
3351  if (need2CreateObcCals)
3352  {
3353  rObcFlags_.dimensions_ [0] = 1;
3354  rObcFlags_.dimensions_ [1] = 1;
3355  rObcFlags_.dimensions_ [2] = 1;
3356  // just to be sure:
3357  rObcList_. dimensions_ [0] = 4;
3358  rObcList_. dimensions_ [1] = calcInfo_.getDversion()<11.0 ? 12 : 14;
3359  rObcList_. dimensions_ [2] = 1;
3360  listOfDescriptors.append(&rObcList_);
3361  listOfDescriptors.append(&rObcFlags_);
3362  };
3363  //
3364  //
3365  // TOC #2:
3366  listOfDescriptors.append(&rIonCode_);
3367  if (needIonFrqOutput)
3368  {
3369  listOfDescriptors.append(&rGrIonFrq_);
3370  listOfDescriptors.append(&rPhIonFrq_);
3371  };
3372  if (need2MoveSecBandInfo)
3373  {
3374  listOfDescriptors.append(&rNAmbigSecBand_);
3375  listOfDescriptors.append(&rQualityCodeSecBand_);
3376  listOfDescriptors.append(&rEffFreqsSecBand_);
3377  listOfDescriptors.append(&rRateObsSecBand_);
3378  listOfDescriptors.append(&rSigmaRateObsSecBand_);
3379  listOfDescriptors.append(&rDelayObsSecBand_);
3380  listOfDescriptors.append(&rSigmaDelayObsSecBand_);
3381  listOfDescriptors.append(&rPhaseObsSecBand_);
3382  listOfDescriptors.append(&rSigmaPhaseObsSecBand_);
3383  listOfDescriptors.append(&rTotalPhaseSecBand_);
3384  listOfDescriptors.append(&rRefFreqSecBand_);
3385  listOfDescriptors.append(&rSnrSecBand_);
3386  listOfDescriptors.append(&rCorrCoefSecBand_);
3387  listOfDescriptors.append(&rSBDelaySecBand_);
3388  listOfDescriptors.append(&rSigmaSBDelaySecBand_);
3389  listOfDescriptors.append(&rGrpAmbiguitySecBand_);
3390  listOfDescriptors.append(&rFourFitFileNameSecBand_);
3391  listOfDescriptors.append(&rPhAmbig_S_);
3392  };
3393 
3394  //
3395  //
3396  // check for their presence:
3397  isFormatActual = true;
3398  for (int i=0; i<listOfDescriptors.size(); i++)
3399  {
3401  if (!(d=image->lookupDescriptor(listOfDescriptors.at(i)->lCode_)))
3402  isFormatActual = listOfDescriptors.at(i)->isPresent_ = false;
3403  else if ( d->dim1() != listOfDescriptors.at(i)->dimensions_[0] ||
3404  d->dim2() != listOfDescriptors.at(i)->dimensions_[1] ||
3405  d->dim3() != listOfDescriptors.at(i)->dimensions_[2])
3406  {
3407  isFormatActual = false;
3408  listOfDescriptors.at(i)->isPresent_ = true;
3409  listOfDescriptors.at(i)->isDimensionsFixed_ = false;
3410  }
3411  else
3412  {
3413  listOfDescriptors.at(i)->isPresent_ = true;
3414  listOfDescriptors.at(i)->isDimensionsFixed_ = true;
3415  };
3416  };
3417  // modify the format:
3418  if (!isFormatActual)
3419  {
3420  // delete LCODEs that changed dimensions:
3421  image->startFormatModifying();
3422  for (int i=0; i<listOfDescriptors.size(); i++)
3423  {
3424  DbhDescriptorX* rec=listOfDescriptors.at(i);
3425  if (rec->isPresent_ && !rec->isDimensionsFixed_)
3426  {
3428  image->delDescriptor(d);
3429  rec->isPresent_ = false;
3430  delete d;
3431  };
3432  };
3433  image->finisFormatModifying();
3434  // add new LCODEs:
3435  image->startFormatModifying();
3436  for (int i=0; i<listOfDescriptors.size(); i++)
3437  {
3438  DbhDescriptorX* rec=listOfDescriptors.at(i);
3439  if (!rec->isPresent_)
3440  {
3442  d->setType(rec->type_);
3443  d->setDimensions(rec->dimensions_[0], rec->dimensions_[1], rec->dimensions_[2]);
3444  d->setNTc(rec->numOfTc_);
3445  image->addDescriptor(d);
3446  delete d;
3447  };
3448  };
3449  image->finisFormatModifying();
3450  };
3451  // at last, look up for actual descriptors:
3452  for (int i=0; i<listOfDescriptors.size(); i++)
3453  listOfDescriptors.at(i)->d_ = image->lookupDescriptor(listOfDescriptors.at(i)->lCode_);
3454 
3455  //
3456  // update the image:
3457  //
3458  // first, deal with the header (TOC#1):
3459  //
3460  //-----------------------------------------------------------------------------------------------------
3461  //
3462  // general info:
3463  image->setI2 (dNObs_, 0,0,0, -1, primaryBand_->observables().size());
3464  image->setI2 (dNRefClocks_, 0,0,0, -1, numOfReferenceClockStations);
3465  //
3466  // here, "7" is "G-Gxs combination":
3467  image->setI2 (dSolData_, 0,0,0, -1, 7);
3468  // SUPMET Codes (we do not need it, just to keep SOLVE happy):
3469  // PARAMETER ( SUPMET__PRE98 = 501 ) ! pre-98 method of observ. suppression
3470  // PARAMETER ( SUPMET__PRE91 = 502 ) ! pre-91 method of observ. suppression
3471  // PARAMETER ( SUPMET__COMB1 = 503 ) ! combination method of suppression
3472  // PARAMETER ( SUPMET__SNGBA = 504 ) ! single band method of suppression
3473  // PARAMETER ( SUPMET__META = 505 ) ! advanced Meta-Solve strategey
3474  image->setI2 (dSupMet_, 0,0,0, -1, 503);
3475  //
3476  // no choice:
3477  image->setI2 (dAtmPartFlag_, 0,0,0, -1, 7);
3478  //
3479  // set up observation calibrations:
3480  int flag;
3481  QList<QString> calList;
3482  formObsCalibrationSetup(flag, calList);
3483  image->setI2 (dObcFlags_, 0,0,0, -1, flag);
3484  //
3485  image->setJ4 (dN4Obs_, 0,0,0, -1, primaryBand_->observables().size());
3486  image->setR8 (dClockIntrv_, 0,0,0, -1, parametersDescriptor_->getClock0().getPwlStep()*24.0);
3487  image->setR8 (dAtmIntrv_, 0,0,0, -1, parametersDescriptor_->getZenith().getPwlStep()*24.0);
3488  // hardcoded, we do not have elevation cut off implementation:
3489  image->setStr(dEl_Cut_, 0,0, -1, "ALL 0.00000");
3490  image->setStr(dAtmCflg_, 0,0, -1, "YE");
3491  image->setStr(dClkCflg_, 0,0, -1, "YE");
3492  image->setStr(dBatchCnt_, 0,0, -1, "YEYE");
3493 
3494  if (need2CreateStnDepndntCals)
3495  {
3496  image->setStr(dCalList_, 0,0, -1, sCalList[0]);
3497  image->setStr(dCalList_, 1,0, -1, sCalList[1]);
3498  image->setStr(dCalList_, 2,0, -1, sCalList[2]);
3499  image->setStr(dCalList_, 3,0, -1, sCalList[3]);
3500  image->setStr(dCalList_, 4,0, -1, sCalList[4]);
3501  image->setStr(dCalList_, 5,0, -1, sCalList[5]);
3502  };
3503  if (need2CreateFlybyCals)
3504  for (int i=0; i<8; i++)
3505  image->setStr(dFclList_, i,0, -1, sFclList[i]);
3506 
3507  if (need2CreateObcCals)
3508  for (int i=0; i<calList.size(); i++)
3509  image->setStr(dObcList_, i,0, -1, calList.at(i));
3510  calList.clear();
3511  //
3512  //-----------------------------------------------------------------------------------------------------
3513  //
3514  // stations:
3515  // init a priori clock model:
3516  if (numOfAcms)
3517  {
3518  image->setI2 (dAcmNumber_, 0,0,0, -1, numOfAcms);
3519  for (int i=0; i<(useOldAcm?4:numOfAcms); i++)
3520  {
3521  image->setStr(dAcmNames_, i,0, -1, QString(" "));
3522  image->setR8 (dAcmOffsets_, i,0,0, -1, 0.0);
3523  image->setR8 (dAcmRates_, i,0,0, -1, 0.0);
3524  image->setI2 (dAcmEpochs_, 0,i,0, -1, 0.0);
3525  image->setI2 (dAcmEpochs_, 1,i,0, -1, 0.0);
3526  image->setI2 (dAcmEpochs_, 2,i,0, -1, 0.0);
3527  image->setI2 (dAcmEpochs_, 3,i,0, -1, 0.0);
3528  image->setI2 (dAcmEpochs_, 4,i,0, -1, 0.0);
3529  image->setI2 (dAcmEpochs_, 5,i,0, -1, 0.0);
3530  };
3531  };
3532  //
3533  QString sEccTypes("");
3534  int maxObsAtRefClck=0, clkSiteIdx=-1, rfIdx=0, acmIdx=0;
3535  for (int i=0; i<stations.size(); i++)
3536  {
3537  SgVlbiStationInfo *si=stations.at(i);
3538  //
3539  // a priori clock model parameters:
3540  if (si->getNeed2useAPrioriClocks())
3541  {
3542  image->setStr(dAcmNames_, acmIdx,0, -1, si->getKey());
3543  image->setR8 (dAcmOffsets_, acmIdx,0,0, -1, si->getAPrioriClockTerm_0());
3544  image->setR8 (dAcmRates_, acmIdx,0,0, -1, si->getAPrioriClockTerm_1());
3545  if (!useOldAcm || (useOldAcm&&acmIdx<4))
3546  acmIdx++;
3547  };
3548  for (int j=0; j<si->clockBreaks().size(); j++)
3549  {
3550  SgParameterBreak *pb=si->clockBreaks().at(j);
3552  {
3553  int year, month, day, hour, minute;
3554  double second;
3555  SgMJD::MJD_reverse(pb->getDate(), pb->getTime(), year, month, day, hour, minute, second);
3556  image->setStr(dAcmNames_, acmIdx,0, -1, si->getKey());
3557  image->setR8 (dAcmOffsets_, acmIdx,0,0, -1, pb->getA0()*1.0e-9); // ns
3558  image->setR8 (dAcmRates_, acmIdx,0,0, -1, pb->getA1()*1.0e-12); // ps/s
3559  image->setI2 (dAcmEpochs_, 0,acmIdx,0, -1, year);
3560  image->setI2 (dAcmEpochs_, 1,acmIdx,0, -1, month);
3561  image->setI2 (dAcmEpochs_, 2,acmIdx,0, -1, day);
3562  image->setI2 (dAcmEpochs_, 3,acmIdx,0, -1, hour);
3563  image->setI2 (dAcmEpochs_, 4,acmIdx,0, -1, minute);
3564  image->setI2 (dAcmEpochs_, 5,acmIdx,0, -1, round(second));
3565  if (!useOldAcm || (useOldAcm&&acmIdx<4))
3566  acmIdx++;
3567  };
3568  };
3569  //
3570  // reference clock stations:
3571  if (si->isAttr(SgVlbiStationInfo::Attr_REFERENCE_CLOCKS) && numOfReferenceClockStations)
3572  {
3573  if (maxObsAtRefClck < si->numTotal(DT_DELAY))
3574  {
3575  maxObsAtRefClck = si->numTotal(DT_DELAY);
3576  clkSiteIdx = i;
3577  };
3578  image->setStr(dRefClockSites_, rfIdx++,0, -1, si->getKey());
3579  };
3580  //
3581  // Eccentricities:
3582  if (needEccOutput && si->eccRec())
3583  {
3584  image->setStr(dEccNames_, i,0, -1,
3585  QString("").sprintf("%-8s%0d", qPrintable(si->getKey()), si->getCdpNumber()) );
3586  sEccTypes += si->eccRec()->getEccType()==SgEccRec::ET_XYZ ? "XY" : "NE";
3587  image->setR8 (dEccCoords_, 0,i,0, -1, si->eccRec()->getDR().at(X_AXIS));
3588  image->setR8 (dEccCoords_, 1,i,0, -1, si->eccRec()->getDR().at(Y_AXIS));
3589  image->setR8 (dEccCoords_, 2,i,0, -1, si->eccRec()->getDR().at(Z_AXIS));
3590  };
3591  //
3592  // station calibrations flags (if they did not exist in the database yet):
3593  if (need2CreateStnDepndntCals)
3594  {
3595  // it is simple, we use just cable cal here:
3596  image->setStr(dCalSites_, i,0, -1, si->getKey());
3597  image->setI2 (dCalFlags_, i,0,0,-1, si->isAttr(SgVlbiStationInfo::Attr_IGNORE_CABLE_CAL)?0:1);
3598  };
3599  // flyby:
3600  if (need2CreateFlybyCals) // it is simple too, we have NMF only:
3601  image->setI2 (dFclFlags_, 0,i,0,-1, 1<<(8-1));
3602  //
3603  // clocks constraints per station (new or missed CC_SITES LCODE):
3604  if (!hasCcSites_)
3605  image->setR8 (dClockConstr_, i,0,0, -1,
3608  /864.0);
3609  // zenith delays constraints per station (new or missed AC_SITES LCODE):
3610  if (!hasAcSites_)
3611  image->setR8 (dAtmConstr_, i,0,0, -1,
3614  /(1.0e-12*24.0*vLight*100.0));
3615  };
3616  // constraints, continue:
3617  if (hasCcSites_)
3618  for (int i=0; i<dCcSites_->dim2(); i++)
3619  {
3620  QString name("");
3621  name = image->getStr(dCcSites_, i,0);
3622  if (stationsByName_.contains(name))
3623  {
3624  SgVlbiStationInfo *si=stationsByName_.value(name);
3625  image->setR8 (dClockConstr_, i,0,0, -1,
3628  /864.0);
3629  }
3630  else
3632  "::putDataIntoDbhImage(): cannot find station '" + name + "' from CC_SITES in the map");
3633  };
3634  if (hasAcSites_)
3635  for (int i=0; i<dAcSites_->dim2(); i++)
3636  {
3637  QString name("");
3638  name = image->getStr(dCcSites_, i,0);
3639  if (stationsByName_.contains(name))
3640  {
3641  SgVlbiStationInfo *si=stationsByName_.value(name);
3642  image->setR8 (dAtmConstr_, i,0,0, -1,
3645  /(1.0e-12*24.0*vLight*100.0));
3646  }
3647  else
3649  "::putDataIntoDbhImage(): cannot find station '" + name + "' from AC_SITES in the map");
3650  };
3651  //
3652  //
3653  if (clkSiteIdx>-1)
3654  image->setStr(dClockSite_, 0,0, -1, stations.at(clkSiteIdx)->getKey());
3655  if (needEccOutput)// actually, the dimensions [N, 1, 1] for A2 in DBH means one string 2xN chars length
3656  image->setStr(dEccTypes_, 0,0, -1, sEccTypes);
3657  //
3658  // clock breaks:
3659  if (numOfClockBreaks)
3660  {
3661  contemporaryHistory_.addHistoryRecord("Detected " + QString().setNum(numOfClockBreaks) +
3662  " clock break" + (numOfClockBreaks==1?"":"s"), SgMJD::currentMJD().toUtc());
3663  image->setI2 (dClkBrkNum_, 0,0,0, -1, numOfClockBreaks);
3664  image->setStr(dClockBreakStatus_, 0,0, -1, "YE");
3665  int cbIdx=0;
3666  for (QMultiMap<SgMJD, QString>::iterator it=cBreakByEpoch.begin();
3667  it!=cBreakByEpoch.end(); ++it)
3668  {
3669  QString cbName=it.value();
3670  SgMJD cbEpoch=it.key();
3671  image->setR8 (dClkBrkEpochs_, cbIdx,0,0, -1, cbEpoch.toDouble() + 2400000.5); // MJD => JD
3672  image->setI2 (dClkBrkFlags_, cbIdx,0,0, -1, 7);
3673  image->setStr(dClkBrkNames_, cbIdx,0, -1, cbName);
3674  cbIdx++;
3676  "::putDataIntoDbhImage(): registered a clock break epoch " +
3677  cbEpoch.toString() + " for the station " + cbName);
3678  // it's a little bit more informative then current SOLVE:
3679  contemporaryHistory_.addHistoryRecord("A clock break marker has been set for " + cbName + " at " +
3680  cbEpoch.toString(), SgMJD::currentMJD().toUtc());
3681  };
3682  }
3683  else
3684  image->setStr(dClockBreakStatus_, 0,0, -1, "NO");
3685  //
3686  // station dependent calibrations:
3687  if (!need2CreateStnDepndntCals)
3688  {
3689  QString str;
3690  // use order of stations from CALSITES list:
3691  for (int i=0; i<rCalSites_.dimensions_[1]; i++)
3692  {
3693  str = image->getStr(dCalSites_, i,0);
3694  if (stationsByName_.contains(str))
3695  {
3696  SgVlbiStationInfo *si=stationsByName_.value(str);
3697  // just alternate cable cal flag:
3698  int nFlag=image->getI2(dCalFlags_, i,0,0,-1);
3700  nFlag &= ~(1<<cableCalFlagIdx);
3701  else
3702  nFlag |= 1<<cableCalFlagIdx;
3703  image->setI2 (dCalFlags_, i,0,0,-1, nFlag);
3704  }
3705  else
3707  "::putDataIntoDbhImage(): cannot find " + str +
3708  " (an entry from CALSITES LCode) in the list of stations");
3709  };
3710  };
3711  //
3712  //-----------------------------------------------------------------------------------------------------
3713  //
3714  // sources:
3715  for (int i=0; i<sources.size(); i++)
3716  {
3717  SgVlbiSourceInfo *si=sources.at(i);
3718  int bitArray;
3719  bitArray = 0;
3720  // first bit (participating in the solution):
3722  {
3723  bitArray |= (1<<0);
3724  };
3725  // second bit:
3726  bitArray |= (1<<1);
3727  // third and fourth bits (estimation of right ascension and declination):
3728  if (parametersDescriptor_ &&
3731  si->numProcessed(DT_DELAY)>0)
3732  {
3733  bitArray |= (1<<2);
3734  bitArray |= (1<<3);
3735  };
3736  image->setI2(dSourcesSelStatus_, i,0,0, -1, bitArray);
3737  };
3738  //
3739  //-----------------------------------------------------------------------------------------------------
3740  //
3741  // baselines:
3742  int j=0;
3743  for (int i=0; i<baselines.size(); i++)
3744  {
3745  QString st1Name, st2Name;
3746  SgVlbiBaselineInfo *bi=baselines.at(i);
3747  st1Name = bi->getKey().left(8);
3748  st2Name = bi->getKey().right(8);
3749  image->setR8 (dError_K_, 0,i,0, -1, bi->getSigma2add(DT_DELAY));
3750  image->setR8 (dError_K_, 1,i,0, -1, bi->getSigma2add(DT_RATE));
3751  image->setStr(dError_Bl_, 0,i, -1, st1Name);
3752  image->setStr(dError_Bl_, 1,i, -1, st2Name);
3754  {
3755  image->setStr(dBlDepClocks_, j,0, -1, st1Name + st2Name);
3756  j++;
3757  };
3758  };
3759  // baselines too:
3760  for (int i=0; i<numOfStations; i++)
3761  {
3762  for (int j=0; j<numOfStations; j++)
3763  {
3764  QString st1Name(stations.at(i)->getKey()), st2Name(stations.at(j)->getKey());
3765  int bitArray;
3766  bitArray = 0;
3767  SgVlbiBaselineInfo *bi, *biR;
3768 
3769  if (baselinesByName_.contains(st1Name + ":" + st2Name))
3770  bi = baselinesByName_.value(st1Name + ":" + st2Name);
3771  else
3772  bi = NULL;
3773  if (baselinesByName_.contains (st2Name + ":" + st1Name))
3774  biR = baselinesByName_.value(st2Name + ":" + st1Name);
3775  else
3776  biR = NULL;
3777  // set the first bit:
3778  if (bi && bi->numTotal(DT_DELAY))
3779  {
3780  bitArray |= (1<<0);
3781  bitArray |= (1<<2);
3782  };
3783  //
3784  // bi and biR can be NULLs!
3785  //
3786  // set the second and third bits:
3787  SgVlbiStationInfo *s1i=NULL, *s2i=NULL;
3788  if (stationsByName_.contains(st1Name))
3789  s1i = stationsByName_.value(st1Name);
3790  if (stationsByName_.contains(st2Name))
3791  s2i = stationsByName_.value(st2Name);
3792  if ( ((bi && !bi ->isAttr(SgVlbiBaselineInfo::Attr_NOT_VALID)) ||
3794  && (s1i && !s1i->isAttr(SgVlbiStationInfo::Attr_NOT_VALID))
3795  && (s2i && !s2i->isAttr(SgVlbiStationInfo::Attr_NOT_VALID)) )
3796  {
3797  bitArray |= (1<<1);
3798  };
3799  // set the fourth and fifth bits:
3800  if ((bi &&
3803  (biR &&
3806  {
3807  bitArray |= (1<<3);
3808  // bitArray |= (1<<4);
3809  };
3810  image->setI2(dBaselinesSelStatus_, (numOfStations*j + i),0,0, -1, bitArray);
3811  };
3812  };
3813  //-------------------------- TOC #>1:
3814  //
3815  // then, update the observations:
3816  // update data:
3817  QString pbKey=primaryBand_->getKey();
3818  QString sbKey(""), str("");
3819  bool has2ndBand;
3820  has2ndBand = bands_.size() > 1;
3821  if (has2ndBand)
3822  {
3823  int bandIdx=0;
3824  sbKey = bands_.at(bandIdx++)->getKey();
3825  while (sbKey==pbKey && bandIdx<bands_.size()) // pick up a first non-prime band:
3826  sbKey = bands_.at(bandIdx++)->getKey();
3827  };
3828  for (int iObs=0; iObs<observations_.size(); iObs++)
3829  {
3830  SgVlbiObservation *obs=observations_.at(iObs);
3831  SgVlbiObservable *pbObs=obs->observable(pbKey);
3832  SgVlbiObservable *sbObs=has2ndBand?obs->observable(sbKey):NULL;
3833  if (pbObs) // can be NULL
3834  {
3835  int idx(pbObs->getMediaIdx());
3836  int ionCode(has2ndBand?-1:0);
3837  int ionBits(has2ndBand?1<<1:0); // No matching group data for GION
3838 
3839  // ionospheric corrections
3841  {
3842  image->setR8(dIonCorr_, 0,0,0, idx, pbObs->grDelay().getIonoValue());
3843  image->setR8(dIonCorr_, 1,0,0, idx, pbObs->phDRate().getIonoValue());
3844  image->setR8(dIonRms_, 0,0,0, idx, pbObs->grDelay().getIonoSigma());
3845  image->setR8(dIonRms_, 1,0,0, idx, pbObs->phDRate().getIonoSigma());
3846  };
3847  // ambiguity resolution:
3849  image->setI2(dNAmbig_, 0,0,0, idx, pbObs->grDelay().getNumOfAmbiguities());
3850  //
3851  if (needIonFrqOutput)
3852  {
3853  image->setR8(dGrIonFrq_, 0,0,0, idx, pbObs->grDelay().getEffFreq());
3854  image->setR8(dPhIonFrq_, 0,0,0, idx, pbObs->phDelay().getEffFreq());
3855  };
3856  //
3857  //
3858  if (obs->isAttr(SgObservation::Attr_NOT_VALID) && pbObs->grDelay().getUnweightFlag()==0)
3859  {
3860  pbObs->grDelay().setUnweightFlag(1);
3861  image->setI2(dDelayUFlag_, 0,0,0, idx, pbObs->grDelay().getUnweightFlag());
3862  };
3863  //
3864  if (has2ndBand && !sbObs && pbObs->grDelay().getUnweightFlag()==0)
3865  {
3866  pbObs->grDelay().setUnweightFlag(8);
3867  image->setI2(dDelayUFlag_, 0,0,0, idx, pbObs->grDelay().getUnweightFlag());
3868  };
3869  //
3870  if (!obs->isAttr(SgObservation::Attr_PROCESSED) && pbObs->grDelay().getUnweightFlag()==0)
3871  {
3872  pbObs->grDelay().setUnweightFlag(2);
3873  image->setI2(dDelayUFlag_, 0,0,0, idx, pbObs->grDelay().getUnweightFlag());
3874  };
3875  //
3876  if (!obs->isAttr(SgObservation::Attr_NOT_VALID) &&
3878  pbObs->grDelay().getUnweightFlag()!=0)
3879  {
3880  pbObs->grDelay().setUnweightFlag(0);
3881  image->setI2(dDelayUFlag_, 0,0,0, idx, pbObs->grDelay().getUnweightFlag());
3882  };
3883  //
3884  // just mimic SOLVE:
3885  if (need2MoveSecBandInfo)
3886  image->setJ4(dPhAmbig_S_, 0,0,0, idx, 1840672182);
3887  //
3888  //
3889  if (sbObs) // can be NULL too
3890  {
3891  ionCode = 0;
3892  str.sprintf("%2d", sbObs->getQualityFactor()>=0?sbObs->getQualityFactor():0);
3893  image->setI2 (dNAmbigSecBand_, 0,0,0, idx, sbObs->grDelay().getNumOfAmbiguities());
3894  image->setStr(dQualityCodeSecBand_, 0,0, idx, str);
3895  image->setR8 (dEffFreqsSecBand_, 0,0,0, idx, sbObs->grDelay().getEffFreq());
3896  image->setR8 (dEffFreqsSecBand_, 1,0,0, idx, sbObs->phDelay().getEffFreq());
3897  image->setR8 (dEffFreqsSecBand_, 2,0,0, idx, sbObs->phDRate().getEffFreq());
3898  image->setR8 (dRateObsSecBand_, 0,0,0, idx, sbObs->phDRate().getValue());
3899  image->setR8 (dSigmaRateObsSecBand_, 0,0,0, idx, sbObs->phDRate().getSigma());
3900  image->setR8 (dDelayObsSecBand_, 0,0,0, idx,(sbObs->grDelay().getValue() +
3901  sbObs->grDelay().ambiguity())*1.0e6);
3902  image->setR8 (dSigmaDelayObsSecBand_, 0,0,0, idx, sbObs->grDelay().getSigma());
3903  image->setR8 (dPhaseObsSecBand_, 0,0,0, idx, 0.0);
3904  image->setR8 (dSigmaPhaseObsSecBand_, 0,0,0, idx, 0.0);
3905  image->setR8 (dTotalPhaseSecBand_, 0,0,0, idx, sbObs->getTotalPhase()/DEG2RAD); // ->degree
3906  image->setR8 (dRefFreqSecBand_, 0,0,0, idx, sbObs->getReferenceFrequency());
3907  image->setR8 (dSnrSecBand_, 0,0,0, idx, sbObs->getSnr());
3908  image->setR8 (dCorrCoefSecBand_, 0,0,0, idx, sbObs->getCorrCoeff());
3909  image->setR8 (dSBDelaySecBand_, 0,0,0, idx, sbObs->sbDelay().getValue()*1.0e6);
3910  image->setR8 (dSigmaSBDelaySecBand_, 0,0,0, idx, sbObs->sbDelay().getSigma()*1.0e6);
3911  image->setR8 (dGrpAmbiguitySecBand_, 0,0,0, idx, sbObs->grDelay().getAmbiguitySpacing());
3912  image->setStr(dFourFitFileNameSecBand_, 0,0, idx, sbObs->getFourfitOutputFName());
3913 
3914  // set up ION Bits:
3915  int qCodeSb=sbObs->getQualityFactor();
3916  if (qCodeSb>7 && (obs->isAttr(SgObservation::Attr_NOT_VALID)))
3917  ionBits = 1 << 0;
3918  else if (qCodeSb<1)
3919  {
3920  ionBits = 1 << 5;
3921  // adjust DELUFLAG for observations with QF==0 at the opposite band:
3922  if (!obs->isAttr(SgObservation::Attr_PROCESSED) && pbObs->grDelay().getUnweightFlag()==0)
3923  {
3924  pbObs->grDelay().setUnweightFlag(4);
3925  image->setI2(dDelayUFlag_, 0,0,0, idx, pbObs->grDelay().getUnweightFlag());
3926  };
3927  }
3928  else
3929  ionBits = 1 << 3;
3930  };
3931  //
3932  if (pbObs->grDelay().getUnweightFlag()==0 && (sbObs || !has2ndBand))
3933  image->setI2(dUserAction4Suppression_, 0,0,0, idx, -32768);
3934  else if (pbObs->grDelay().getUnweightFlag()==1)
3935  image->setI2(dUserAction4Suppression_, 0,0,0, idx, -32767);
3936  else
3937  image->setI2(dUserAction4Suppression_, 0,0,0, idx, -32763);
3938  //
3939  image->setI2(dIonCode_, 0,0,0, idx, ionCode);
3940  image->setI2(dIonBits_, 0,0,0, idx, ionBits);
3941  };
3942  };
3943  //
3944  //
3945  image->prepare2save(); //
3946  //
3949  //
3950 
3951  SgMJD finisEpoch(SgMJD::currentMJD());
3953  "::putDataIntoDbhImage(): data have been stored in DBH database \"" + image->fileName() +
3954  "\", elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
3955 
3956  return isOk;
3957 };
3958 
3959 
3960 
3961 //
3963 {
3964  // collect the history records that were generated automatically:
3965  for (int i=0; i<primaryBand_->history().size(); i++)
3966  {
3968  if (rec->getVersion() == primaryBand_->getInputFileVersion() + 1 && !rec->getIsEditable())
3969  history.addHistoryRecord(rec->getText(), rec->getEpoch());
3970  };
3971  //
3973  history.addHistoryRecord("Analyzed by " + ids->getUserName() + " (hereafter " +
3974  ids->getUserDefaultInitials() + ") at " + ids->getAcFullName() + ". Contact info: <" +
3975  ids->getUserEmailAddress() + ">", SgMJD::currentMJD().toUtc());
3976  // ids->getUserDefaultInitials() + ") at " + ids->getAcFullName() + ".");
3977  // history.addHistoryRecord("Contact info: <" + ids->getUserEmailAddress() + ">");
3978  //
3979  //
3980  // collect the history records that were added by the user:
3981  for (int i=0; i<primaryBand_->history().size(); i++)
3982  {
3984  // that was added by user, keep content only:
3985  if (rec->getIsEditable())
3986  history.addHistoryRecord(ids->getUserDefaultInitials() + "> " + rec->getText(),
3987  SgMJD::currentMJD().toUtc());
3988  };
3989  //
3990  //
3991  // made standard report about the solution:
3992  if (tFinis_-tStart_ < 3.0/24.0 &&
3993  numOfStations_ <= 4 &&
3994  parametersDescriptor_->getPolusUT1Mode() != SgParameterCfg::PM_NONE) // it looks like INT session
3995  {
3996  //"INT12###/GSFC F-solve update. -SLB-"
3997  history.addHistoryRecord(officialName_ + "/" + ids->getAcAbbrevName() + " nuSolve update. -" +
3998  ids->getUserDefaultInitials() + "-", SgMJD::currentMJD().toUtc());
3999  //"Delays only, 6 parameters, ##.### psec fit,"
4000  history.addHistoryRecord("Delays only, " + QString("").setNum(reporter_->getNumOfUnknowns()) +
4001  " parameters, " + QString("").sprintf("%.3f", primaryBand_->wrms(DT_DELAY)*1.0E12) +
4002  " psec fit,", SgMJD::currentMJD().toUtc());
4003  //"## obs, ##.## microsec UT1 formal error."
4004  SgParameter *p=NULL;
4005  if (reporter_->parByName()->contains("EOP: dUT1, ms"))
4006  p = reporter_->parByName()->value("EOP: dUT1, ms");
4007  history.addHistoryRecord(QString("").setNum(reporter_->getNumOfObservations()) + " obs, " +
4008  QString("").sprintf("%.2f", (p ? p->getSigma()*DAY2SEC*1.0e6 : 999.9)) +
4009  " microsec UT1 formal error.", SgMJD::currentMJD().toUtc());
4010  }
4011  else // regular session:
4012  {
4013  //"r45*: GSFC analysis (SB)"
4014  history.addHistoryRecord(officialName_ + ": " + ids->getAcAbbrevName() + " analysis (" +
4015  ids->getUserDefaultInitials() + ")", SgMJD::currentMJD().toUtc());
4016  //"G-Gxs solution, 60/60 clocks/atms, 2/40 constraints, 24-hr gradients."
4017  QString str("G-Gxs solution");
4020  {
4021  double clc_int, wzd_int, grd_int, clc_cnt, atm_cnt;
4022  clc_int = parametersDescriptor_->getClock0().getPwlStep()*24.0*60.0;
4023  wzd_int = parametersDescriptor_->getZenith().getPwlStep()*24.0*60.0;
4025  if (grd_int > tFinis_-tStart_)
4026  grd_int = tFinis_-tStart_;
4027  grd_int *= 24.0*60.0;
4028  grd_int = round(grd_int)/60.0; // this parameter is in hours
4030  /parametersDescriptor_->getClock0().getScale()/86400.0*1.0e14;
4032  /parametersDescriptor_->getZenith().getScale()/vLight/24.0*1.0e12;
4033  str +=
4034  QString("").sprintf(", %4g/%4g clocks/atms, %4g/%4g constraints",
4035  clc_int, wzd_int, clc_cnt, atm_cnt);
4037  str += QString("").sprintf(", %4g-hr gradients", grd_int);
4038  };
4039  history.addHistoryRecord(str + ".", SgMJD::currentMJD().toUtc());
4040  //"Solve fit is * psec."
4041  history.addHistoryRecord("Solve fit is " +
4042  QString("").sprintf("%.2f", primaryBand_->wrms(DT_DELAY)*1.0E12) + " psec.",
4043  SgMJD::currentMJD().toUtc());
4044  };
4045  // history.addHistoryRecord(" ");
4046  // end of header part of history.
4047 };
4048 
4049 
4050 
4051 //
4053 {
4054  QString str;
4055 
4056  // Fly-bies:
4057  history.addHistoryRecord("The following flyby options were used in the solution:",
4058  SgMJD::currentMJD().toUtc());
4059  // stations positions and velocities:
4060  history.addHistoryRecord("Station positions flyby file: " +
4063  history.addHistoryRecord("Station velocities flyby file: " +
4066  // sources positions:
4067  history.addHistoryRecord("Source flyby file: " +
4070  // stations axis offsets:
4071  history.addHistoryRecord("Station axis offset flyby file: " +
4074  // EOP high freqs:
4075  history.addHistoryRecord("EOP high frequency variations flyby file: " +
4078  // stations mean gradients:
4079  history.addHistoryRecord("Station mean gradients flyby file: " +
4082  //
4083  history.addHistoryRecord("Nutation series flyby file : NONE", SgMJD::currentMJD().toUtc());
4084  history.addHistoryRecord("Nutation offset flyby file : NONE", SgMJD::currentMJD().toUtc());
4085  history.addHistoryRecord("Earth rotation flyby file : NONE", SgMJD::currentMJD().toUtc());
4086  history.addHistoryRecord("Tectonic plate motion file : NONE", SgMJD::currentMJD().toUtc());
4087  //
4089  history.addHistoryRecord("Group delay ambiguities were resolved (well, at least, tried to resolve)",
4090  SgMJD::currentMJD().toUtc());
4092  history.addHistoryRecord("Group delay outliers were processed and editing info has been updated.",
4093  SgMJD::currentMJD().toUtc());
4094  history.addHistoryRecord("Troposphere and cable cal status for standard solution have been stored.",
4095  SgMJD::currentMJD().toUtc());
4096  history.addHistoryRecord("Observation dependent contribution status has been stored.",
4097  SgMJD::currentMJD().toUtc());
4098  // reweighting:
4100  {
4101  history.addHistoryRecord("Reweighting updated for:", SgMJD::currentMJD().toUtc());
4102  SgVlbiBaselineInfo *bi=NULL;
4103  int n;
4104  n = 0;
4105  str = "";
4106  for (BaselinesByName_it it=baselinesByName_.begin(); it!=baselinesByName_.end(); ++it)
4107  {
4108  bi = it.value();
4110  {
4111  if (n==10)
4112  {
4113  history.addHistoryRecord(str, SgMJD::currentMJD().toUtc());
4114  n = 0;
4115  str = "";
4116  };
4117  str += bi->getKey().mid(0,2) + "-" + bi->getKey().mid(9,2) + " ";
4118  n++;
4119  };
4120  };
4121  if (n>0)
4122  history.addHistoryRecord(str, SgMJD::currentMJD().toUtc());
4123  };
4124  // solution type:
4125  history.addHistoryRecord("Solution data configuration: group delays with ionosphere corrections",
4126  SgMJD::currentMJD().toUtc());
4127  // these are saved by default:
4128  history.addHistoryRecord("Clock and atmosphere constraint information saved.",
4129  SgMJD::currentMJD().toUtc());
4130  history.addHistoryRecord("Batchmode clock parameterization saved.",
4131  SgMJD::currentMJD().toUtc());
4132  history.addHistoryRecord("Batchmode atmosphere parameterization saved.",
4133  SgMJD::currentMJD().toUtc());
4134 
4135  // ionosphere corrections:
4137  history.addHistoryRecord("Ionosphere corrections were evaluated for group delays.",
4138  SgMJD::currentMJD().toUtc());
4139 
4141  {
4142  // never saw them:
4143  history.addHistoryRecord("Barometer calibration and barometer height offset not available.",
4144  SgMJD::currentMJD().toUtc());
4145  // no cutoffs, just zeros there:
4146  history.addHistoryRecord("Elevation cutoff data stored in database.",
4147  SgMJD::currentMJD().toUtc());
4148  };
4149  // eccentricities:
4151  history.addHistoryRecord("Eccentricity data store in data base header.",
4152  SgMJD::currentMJD().toUtc());
4153 };
4154 /*=====================================================================================================*/
4155 
4156 
4157 
4158 
4159 
4160 
4161 
4162 
4163 
4164 /*=====================================================================================================*/
4165 //
4166 // constants:
4167 //
4168 
4169 
4171 {
4172  //lCode_, description_, d_, isPresent_, type_
4173  //dimensions_[3], numOfTc_, expectedVersion_, isDimensionsFixed_, isMandatory_
4174  //
4175  // First, TOC#0 (== the header):
4176  // Version #1:
4177  // R8:
4178  // I2:
4179  {"# SITES ", "Number of sites.", NULL, true, SgDbhDatumDescriptor::T_I2, // 0
4180  { 1, 1, 1}, 0, 1, true, false},
4181  {"# STARS ", "Number of radio sources.", NULL, true, SgDbhDatumDescriptor::T_I2, // 1
4182  { 1, 1, 1}, 0, 1, true, false},
4183  {"NUMB OBS", "Number of observations in file.", NULL, true, SgDbhDatumDescriptor::T_I2, // 2
4184  { 1, 1, 1}, 0, 1, true, false},
4185  // A2:
4186  {"SITNAMES", "Site names array.", NULL, true, SgDbhDatumDescriptor::T_A2, // 3
4187  { 4, 6, 1}, 0, 1, false, true },
4188  {"STRNAMES", "Source names array", NULL, true, SgDbhDatumDescriptor::T_A2, // 4
4189  { 4,71, 1}, 0, 1, false, true },
4190  // Version #2:
4191  // R8:
4192  {"AXISOFFS", "Axis offsets (m).", NULL, true, SgDbhDatumDescriptor::T_R8, // 5
4193  { 6, 1, 1}, 0, 2, false, true },
4194  {"STAR2000", "J2000 source RAs, decs (rd,rd).", NULL, true, SgDbhDatumDescriptor::T_R8, // 6
4195  { 2,71, 1}, 0, 2, false, true },
4196  {"SITERECS", "Site cartesian coords (m).", NULL, true, SgDbhDatumDescriptor::T_R8, // 7
4197  { 3, 6, 1}, 0, 2, false, true },
4198  {"SITHOCAM", "Horz ocean loading ampltudes (m)", NULL, true, SgDbhDatumDescriptor::T_R8, // 8
4199  {11, 2, 6}, 0, 2, false, false},
4200  {"SITHOCPH", "Horz ocean loading phases (rad).", NULL, true, SgDbhDatumDescriptor::T_R8, // 9
4201  {11, 2, 6}, 0, 2, false, false},
4202  {"SITOCAMP", "Vert ocean loading ampltudes (m)", NULL, true, SgDbhDatumDescriptor::T_R8, // 10
4203  {11, 6, 1}, 0, 2, false, false},
4204  {"SITOCPHS", "Vert ocean loading phases (rad).", NULL, true, SgDbhDatumDescriptor::T_R8, // 11
4205  {11, 6, 1}, 0, 2, false, false},
4206  // I2:
4207  {"AXISTYPS", "Axis type (1-eq,2-xy,3-azel,4,5)", NULL, true, SgDbhDatumDescriptor::T_I2, // 12
4208  { 6, 1, 1}, 0, 2, false, true },
4209  // Version #3:
4210  // A2:
4211  {"CBL SIGN", "Signs of cable cal application", NULL, true, SgDbhDatumDescriptor::T_A2, // 13
4212  { 6, 1, 1}, 0, 3, false, false},
4213  {"CBL STAT", "Stations for cable sign", NULL, true, SgDbhDatumDescriptor::T_A2, // 14
4214  { 4, 6, 1}, 0, 3, false, false},
4215  // Version #4:
4216  // R8:
4217  {"ATM_CNST", "Atmosphere constraint. ps/hr", NULL, true, SgDbhDatumDescriptor::T_R8, // 15
4218  { 1, 1, 1}, 0, 4, false, false},
4219  {"ATM_INTV", "Batchmode atmos interval - hours", NULL, true, SgDbhDatumDescriptor::T_R8, // 16
4220  { 1, 1, 1}, 0, 4, true, false},
4221  {"CLK_CNST", "Clock constraint-Parts in 1.e14", NULL, true, SgDbhDatumDescriptor::T_R8, // 17
4222  { 1, 1, 1}, 0, 4, false, false},
4223  {"CLK_INTV", "Batchmode clock interval - hours", NULL, true, SgDbhDatumDescriptor::T_R8, // 18
4224  { 1, 1, 1}, 0, 4, true, false},
4225  {"CLOOFACM", "A priori clock offset (sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 19
4226  { 4, 1, 1}, 0, 4, false, false},
4227  {"CLODRACM", "A priori clock drift (sec/sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 20
4228  { 4, 1, 1}, 0, 4, false, false},
4229  {"ERROR K ", "Formal error constants", NULL, true, SgDbhDatumDescriptor::T_R8, // 21
4230  { 2,15, 1}, 0, 4, false, false},
4231  {"ECCCOORD", "Eccentricity coords. (m) ", NULL, true, SgDbhDatumDescriptor::T_R8, // 22
4232  { 3, 6, 1}, 0, 4, false, false},
4233  // I2:
4234  {"# CLK_RF", "# of clock reference stations", NULL, true, SgDbhDatumDescriptor::T_I2, // 23
4235  { 1, 1, 1}, 0, 4, true, false},
4236  {"BASLSTAT", "Baselines selection status", NULL, true, SgDbhDatumDescriptor::T_I2, // 24
4237  {36, 1, 1}, 0, 4, false, false},
4238  {"SOURSTAT", "Sources selection status", NULL, true, SgDbhDatumDescriptor::T_I2, // 25
4239  {71, 1, 1}, 0, 4, false, false},
4240  // A2:
4241  {"BLDEPCKS", "Bl-dependent clock list", NULL, true, SgDbhDatumDescriptor::T_A2, // 26
4242  { 8, 3, 1}, 0, 4, false, false},
4243  {"CLK_SITE", "Batchmode clock reference site ", NULL, true, SgDbhDatumDescriptor::T_A2, // 27
4244  { 4, 1, 1}, 0, 4, false, false},
4245  {"CLK_SITS", "List of clock reference stations", NULL, true, SgDbhDatumDescriptor::T_A2, // 28
4246  { 4, 1, 1}, 0, 4, false, false},
4247  {"CLKBREAK", "Status of clock break existence ", NULL, true, SgDbhDatumDescriptor::T_A2, // 29
4248  { 1, 1, 1}, 0, 4, true, false},
4249  {"ECCNAMES", "Ecc. site and monument names.", NULL, true, SgDbhDatumDescriptor::T_A2, // 30
4250  { 9, 6, 1}, 0, 4, false, false},
4251  {"ECCTYPES", "Eccentricy types - XY or NE.", NULL, true, SgDbhDatumDescriptor::T_A2, // 31
4252  { 6, 1, 1}, 0, 4, false, false},
4253  {"EL-CUT ", "Solution elevation cutoff data. ", NULL, true, SgDbhDatumDescriptor::T_A2, // 32
4254  { 8, 1, 1}, 0, 4, true, false},
4255  {"ERROR BL", "B.L.names for formal errors", NULL, true, SgDbhDatumDescriptor::T_A2, // 33
4256  { 4, 2,15}, 0, 4, false, false},
4257  // J4:
4258  {"NUM4 OBS", "Number of observations (I*4) ", NULL, true, SgDbhDatumDescriptor::T_J4, // 34
4259  { 1, 1, 1}, 0, 4, true, false},
4260 
4261  //
4262  //
4263  // Other TOCs (== observ.record):
4264  // Version #1:
4265  // R8:
4266  {"#SAMPLES", "# of samples by sideband and cha", NULL, true, SgDbhDatumDescriptor::T_R8, // 35
4267  { 2,16, 1}, 1, 1, true, false},
4268  {"AMPBYFRQ", "Amp(0-1), phs by chan(-180to180)", NULL, true, SgDbhDatumDescriptor::T_R8, // 36
4269  { 2,16, 1}, 1, 1, true, false},
4270  {"COHERCOR", "Corr coeff (0 --> 1)............", NULL, true, SgDbhDatumDescriptor::T_R8, // 37
4271  { 1, 1, 1}, 1, 1, true, true },
4272  {"DEL OBSV", "Observed delay us in 2 parts....", NULL, true, SgDbhDatumDescriptor::T_R8, // 38
4273  { 2, 1, 1}, 1, 1, true, true },
4274  {"DELSIGMA", "Delay err (sec).................", NULL, true, SgDbhDatumDescriptor::T_R8, // 39
4275  { 1, 1, 1}, 1, 1, true, true },
4276  {"GPDLAMBG", "Group delay ambiguity (sec).....", NULL, true, SgDbhDatumDescriptor::T_R8, // 40
4277  { 1, 1, 1}, 1, 1, true, true },
4278  {"RAT OBSV", "Observd delay rate (sec per sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 41
4279  { 1, 1, 1}, 1, 1, true, true },
4280  {"RATSIGMA", "Rate formal error(sec per sec)..", NULL, true, SgDbhDatumDescriptor::T_R8, // 42
4281  { 1, 1, 1}, 1, 1, true, true },
4282  {"RECSETUP", "Samp rate(kHz),Frames/PP,PP/AP..", NULL, true, SgDbhDatumDescriptor::T_I2, // 43
4283  { 1, 1, 1}, 1, 1, true, false},
4284  {"REF FREQ", "Freq to which phase is referred.", NULL, true, SgDbhDatumDescriptor::T_R8, // 44
4285  { 1, 1, 1}, 1, 1, true, true },
4286  {"RFREQ ", "RF freq by channel (MHz)........", NULL, true, SgDbhDatumDescriptor::T_R8, // 45
4287  {16, 1, 1}, 1, 1, true, true },
4288  {"SAMPLRAT", "Sample rate (Hz)................", NULL, true, SgDbhDatumDescriptor::T_R8, // 46
4289  { 1, 1, 1}, 1, 1, true, false},
4290  {"SB DELAY", "Single band delay (microsec)....", NULL, true, SgDbhDatumDescriptor::T_R8, // 47
4291  { 1, 1, 1}, 1, 1, true, true },
4292  {"SB SIGMA", "SB delay error microseconds.....", NULL, true, SgDbhDatumDescriptor::T_R8, // 48
4293  { 1, 1, 1}, 1, 1, true, true },
4294  {"SEC TAG ", "Seconds part of UTC TAG.........", NULL, true, SgDbhDatumDescriptor::T_R8, // 49
4295  { 1, 1, 1}, 1, 1, true, true },
4296  {"SNRATIO ", "Signal to noise ratio..........", NULL, true, SgDbhDatumDescriptor::T_R8, // 50
4297  { 1, 1, 1}, 1, 1, true, true },
4298  // I2:
4299  {"#CHANELS", "No. of U-L pairs in integration.", NULL, true, SgDbhDatumDescriptor::T_I2, // 51
4300  { 1, 1, 1}, 1, 1, true, true },
4301  {"CALBYFRQ", "PC amp,phs,frq by sta,channel...", NULL, true, SgDbhDatumDescriptor::T_I2, // 52
4302  { 3, 2,16}, 1, 1, true, false},
4303  {"DELUFLAG", "Delay unweight flag ", NULL, true, SgDbhDatumDescriptor::T_I2, // 53
4304  { 1, 1, 1}, 1, 1, true, false},
4305  {"NO.OF AP", "# of AP by sideband and channel.", NULL, true, SgDbhDatumDescriptor::T_I2, // 54
4306  { 2,16, 1}, 1, 1, true, true },
4307  {"PHCALOFF", "Phase cal offset (-18000/18000).", NULL, true, SgDbhDatumDescriptor::T_I2, // 55
4308  { 2,16, 1}, 1, 1, true, false},
4309  {"RATUFLAG", "Delay rate unweight flag........", NULL, true, SgDbhDatumDescriptor::T_I2, // 56
4310  { 1, 1, 1}, 1, 1, true, false},
4311  {"UTC TAG ", "Epoch UTC YMDHM.................", NULL, true, SgDbhDatumDescriptor::T_I2, // 57
4312  { 5, 1, 1}, 1, 1, true, true },
4313  // A2:
4314  {"BASELINE", "Ref and rem site names..........", NULL, true, SgDbhDatumDescriptor::T_A2, // 58
4315  { 4, 2, 1}, 1, 1, true, true },
4316  {"QUALCODE", "FRNGE quality index 0 --> 9....", NULL, true, SgDbhDatumDescriptor::T_A2, // 59
4317  { 1, 1, 1}, 1, 1, true, true },
4318  {"STAR ID ", "Radio source name...............", NULL, true, SgDbhDatumDescriptor::T_A2, // 60
4319  { 4, 1, 1}, 1, 1, true, true },
4320 
4321  // Version #2:
4322  // R8:
4323  {"AZ-THEO ", "Azimuth array definition ", NULL, true, SgDbhDatumDescriptor::T_R8, // 61
4324  { 2, 2, 1}, 1, 2, true, true },
4325  {"CON CONT", "Consensus bending contrib. (sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 62
4326  { 2, 1, 1}, 1, 2, true, false },
4327  {"CONSNDEL", "Consensus theo. delay (microsec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 63
4328  { 2, 1, 1}, 1, 2, true, false },//true },
4329  {"EL-THEO ", "Elevation array definition ", NULL, true, SgDbhDatumDescriptor::T_R8, // 64
4330  { 2, 2, 1}, 1, 2, true, true },
4331  {"NUT PART", "Nutation partial derive. def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 65
4332  { 2, 2, 1}, 1, 2, true, false},
4333  {"NUT2KXYP", "IAU2000A Nutation X,Y Partials ", NULL, true, SgDbhDatumDescriptor::T_R8, // 66
4334  { 2, 2, 1}, 1, 2, true, false},
4335  {"OCE CONT", "Ocean loading contributions def.", NULL, true, SgDbhDatumDescriptor::T_R8, // 67
4336  { 2, 1, 1}, 1, 2, true, true },
4337  {"SIT PART", "Site partial derivative def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 68
4338  { 3, 2, 2}, 1, 2, true, true },
4339  {"STR PART", "Star partial derivatives def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 69
4340  { 2, 2, 1}, 1, 2, true, true },
4341  {"UT1 PART", "UT1 partial derivatives def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 70
4342  { 2, 2, 1}, 1, 2, true, true },
4343  {"WOB PART", "Wobble partial derivatives def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 71
4344  { 2, 2, 1}, 1, 2, true, true },
4345  // I2:
4346  // A2:
4347 
4348  // Version #3:
4349  // R8:
4350  {"ATM PRES", "Pressure in mb at site ", NULL, true, SgDbhDatumDescriptor::T_R8, // 72
4351  { 2, 2, 1}, 1, 3, true, false},
4352  {"CABL DEL", "Cable calibration data ", NULL, true, SgDbhDatumDescriptor::T_R8, // 73
4353  { 2, 2, 1}, 1, 3, true, false},
4354  {"REL.HUM.", "Rel.Hum. at local WX st (50%=.5)", NULL, true, SgDbhDatumDescriptor::T_R8, // 74
4355  { 2, 2, 1}, 1, 3, true, false},
4356  {"TEMP C ", "Temp in C at local WX station ", NULL, true, SgDbhDatumDescriptor::T_R8, // 75
4357  { 2, 2, 1}, 1, 3, true, false},
4358  // I2:
4359  // A2:
4360 
4361  // Version #4:
4362  // R8:
4363  {"GRIONFRQ", "Effective ion.frq for gr.del MHz", NULL, true, SgDbhDatumDescriptor::T_R8, // 76
4364  { 1, 1, 1}, 1, 4, true, false},
4365  {"ION CORR", "Ion correction. Add to theo. sec", NULL, true, SgDbhDatumDescriptor::T_R8, // 77
4366  { 2, 1, 1}, 1, 4, true, false},
4367  {"IONRMS ", "Ion correction to sigma. sec ", NULL, true, SgDbhDatumDescriptor::T_R8, // 78
4368  { 2, 1, 1}, 1, 4, true, false},
4369  {"PHIONFRQ", "Effective ion.frq for ph.del MHz", NULL, true, SgDbhDatumDescriptor::T_R8, // 79
4370  { 1, 1, 1}, 1, 4, true, false},
4371  // I2:
4372  {"# AMBIG ", "No. of ambiguities", NULL, true, SgDbhDatumDescriptor::T_I2, // 80
4373  { 1, 1, 1}, 1, 4, true, false},
4374  // A2:
4375 
4376  // +...
4377  // to be re-sorted:
4378  {"ATM_CFLG", "Atmosphere constraint use flag ", NULL, true, SgDbhDatumDescriptor::T_A2, // 81
4379  { 1, 1, 1}, 0, 4, true, false},
4380  {"CLK_CFLG", "Clock constraint use flag. ", NULL, true, SgDbhDatumDescriptor::T_A2, // 82
4381  { 1, 1, 1}, 0, 4, true, false},
4382  {"BRK_EPOC", "Batchmode clock break epochs", NULL, true, SgDbhDatumDescriptor::T_R8, // 83
4383  { 2, 1, 1}, 0, 4, false, false},
4384  {"BRK_NUMB", "Number of batchmode clock breaks", NULL, true, SgDbhDatumDescriptor::T_I2, // 84
4385  { 1, 1, 1}, 0, 4, true, false},
4386  {"BRK_FLAG", "Batchmode clock break flags", NULL, true, SgDbhDatumDescriptor::T_I2, // 85
4387  { 2, 1, 1}, 0, 4, false, false},
4388  {"BRK_SNAM", "Batchmode clock break stations", NULL, true, SgDbhDatumDescriptor::T_A2, // 86
4389  { 4, 2, 1}, 0, 4, false, false},
4390  {"ION CODE", "Ion corr code. -1=no good, 0=OK ", NULL, true, SgDbhDatumDescriptor::T_I2, // 87
4391  { 1, 1, 1}, 1, 4, true, false},
4392  {"#GAMBG_S", "No. of ambiguities for S-band", NULL, true, SgDbhDatumDescriptor::T_I2, // 88
4393  { 1, 1, 1}, 1, 4, true, false},
4394  {"QCODE XS", "Quality code, opposite band", NULL, true, SgDbhDatumDescriptor::T_A2, // 89
4395  { 1, 1, 1}, 1, 4, true, false},
4396 
4397  {"EFF FREQ", "Effective freqs, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 90
4398  { 3, 1, 1}, 1, 4, true, false},
4399  {"RTOBS XS", "Rate observable, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 91
4400  { 1, 1, 1}, 1, 4, true, false},
4401  {"RTERR XS", "Rate formal err, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 92
4402  { 1, 1, 1}, 1, 4, true, false},
4403  {"DLOBS XS", "Delay observable, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 93
4404  { 1, 1, 1}, 1, 4, true, false},
4405  {"DLERR XS", "Delay formal err, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 94
4406  { 1, 1, 1}, 1, 4, true, false},
4407  {"DPHAS XS", "Phase observable, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 95
4408  { 1, 1, 1}, 1, 4, true, false},
4409  {"DPHER XS", "Phase formal err, opposite band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 96
4410  { 1, 1, 1}, 1, 4, true, false},
4411  {"TOTPHA_S", "S-band Total phase (in degrees) ", NULL, true, SgDbhDatumDescriptor::T_R8, // 97
4412  { 1, 1, 1}, 1, 4, true, false},
4413  {"REF FR_S", "Fr to w.phase is referred S-band", NULL, true, SgDbhDatumDescriptor::T_R8, // 98
4414  { 1, 1, 1}, 1, 4, true, false},
4415  {"SNR_S ", "Signal to noise ratio for S-band", NULL, true, SgDbhDatumDescriptor::T_R8, // 99
4416  { 1, 1, 1}, 1, 4, true, false},
4417  {"COHCOR_S", "Corr coeff (0 --> 1) for S-band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 100
4418  { 1, 1, 1}, 1, 4, true, false},
4419  {"SB DEL_S", "Single band delay for S-band ", NULL, true, SgDbhDatumDescriptor::T_R8, // 101
4420  { 1, 1, 1}, 1, 4, true, false},
4421  {"SB SIG_S", "SB delay error S-band, mks ", NULL, true, SgDbhDatumDescriptor::T_R8, // 102
4422  { 1, 1, 1}, 1, 4, true, false},
4423  {"GRPAMB_S", "Group delay ambiguity for S-band", NULL, true, SgDbhDatumDescriptor::T_R8, // 103
4424  { 1, 1, 1}, 1, 4, true, false},
4425  {"TOTPHASE", "Total phase degrees mod 360.....", NULL, true, SgDbhDatumDescriptor::T_R8, // 104
4426  { 1, 1, 1}, 1, 1, true, true},
4427 
4428  //addons:
4429  //lCode_, description_, d_, isPresent_, type_
4430  //dimensions_[3], numOfTc_, expectedVersion_, isDimensionsFixed_, isMandatory_
4431  {"BATCHCNT", "Batchmode parms use flag.", NULL, true, SgDbhDatumDescriptor::T_A2, // 105
4432  { 2, 1, 1}, 0, 4, true, false},
4433  {"CORRTYPE", "Correlator type: MK3/MK4/K4 etc.", NULL, true, SgDbhDatumDescriptor::T_A2, // 106
4434  { 4, 1, 1}, 0, 1, true, false},
4435  {"STAT_ACM", "Stations with a priori clock mod", NULL, true, SgDbhDatumDescriptor::T_A2, // 107
4436  { 4, 4, 1}, 0, 4, false, false},
4437  {"CALC VER", "CALC version number", NULL, true, SgDbhDatumDescriptor::T_R8, // 108
4438  { 1, 1, 1}, 0, 2, true, false},
4439  {"TECTPLNM", "4-char tectonic plate names.", NULL, true, SgDbhDatumDescriptor::T_A2, // 109
4440  { 2, 6, 1}, 0, 2, false, false},
4441  {"UT1ORTHO", "ORTHO_EOP Tidal UT1 contribution", NULL, true, SgDbhDatumDescriptor::T_R8, // 110
4442  { 2, 1, 1}, 1, 2, true, false},
4443  {"WOBORTHO", "ORTHO_EOP tidal wobble contribtn", NULL, true, SgDbhDatumDescriptor::T_R8, // 111
4444  { 2, 1, 1}, 1, 2, true, false},
4445 
4446  //contributions:
4447  //lCode_, description_, d_, isPresent_, type_
4448  //dimensions_[3], numOfTc_, expectedVersion_, isDimensionsFixed_, isMandatory_
4449  {"PTD CONT", "Pole tide contributions def.", NULL, true, SgDbhDatumDescriptor::T_R8, // 112
4450  { 2, 1, 1}, 1, 2, true, false},
4451  {"ETD CONT", "Earth tide contributions def.", NULL, true, SgDbhDatumDescriptor::T_R8, // 113
4452  { 2, 1, 1}, 1, 2, true, false},
4453  {"WOBXCONT", "X Wobble contribution definition", NULL, true, SgDbhDatumDescriptor::T_R8, // 114
4454  { 2, 1, 1}, 1, 2, true, false},
4455  {"WOBYCONT", "Y Wobble contribution definition", NULL, true, SgDbhDatumDescriptor::T_R8, // 115
4456  { 2, 1, 1}, 1, 2, true, false},
4457  {"WOBNUTAT", "Short period nutation wobble con", NULL, true, SgDbhDatumDescriptor::T_R8, // 116
4458  { 2, 1, 1}, 1, 2, true, false},
4459  {"FEED.COR", "Feedhorn corr. in CORFIL scheme", NULL, true, SgDbhDatumDescriptor::T_R8, // 117
4460  { 2, 1, 1}, 1, 2, true, false},
4461  {"TILTRMVR", "Axis Tilt Contribution Remover", NULL, true, SgDbhDatumDescriptor::T_R8, // 118
4462  { 2, 1, 1}, 1, 2, true, false},
4463  {"NDRYCONT", "Nhmf (dry) atm. contribution", NULL, true, SgDbhDatumDescriptor::T_R8, // 119
4464  { 2, 2, 1}, 1, 2, true, false},
4465  {"NWETCONT", "Whmf (wet) atm. contribution", NULL, true, SgDbhDatumDescriptor::T_R8, // 120
4466  { 2, 2, 1}, 1, 2, true, false},
4467  {"NGRADPAR", "Niell dry atm. gradient partials", NULL, true, SgDbhDatumDescriptor::T_R8, // 121
4468  { 2, 2, 2}, 1, 2, true, false},
4469  {"UNPHASCL", "UnPhaseCal effect - group&rate", NULL, true, SgDbhDatumDescriptor::T_R8, // 122
4470  { 2, 2, 1}, 1, 2, true, false},
4471  {"AXO CONT", "New Axis Offset Contributions", NULL, true, SgDbhDatumDescriptor::T_R8, // 123
4472  { 2, 2, 1}, 1, 2, true, false},
4473 
4474  //contributions' flags:
4475  //lCode_, description_, d_, isPresent_, type_
4476  //dimensions_[3], numOfTc_, expectedVersion_, isDimensionsFixed_, isMandatory_
4477  {"CALSITES", "List of sites for standard cal", NULL, true, SgDbhDatumDescriptor::T_A2, // 124
4478  { 4, 1, 1}, 0, 4, false, false},
4479  {"CAL LIST", "Key to the standard cal config", NULL, true, SgDbhDatumDescriptor::T_A2, // 125
4480  { 4, 6, 1}, 0, 4, false, false},
4481  {"CAL FLGS", "Standard cal configuration", NULL, true, SgDbhDatumDescriptor::T_I2, // 126
4482  { 1, 1, 1}, 0, 4, false, false},
4483  // partials:
4484  {"AXO PART", "Axis Offset partial deriv. def.", NULL, true, SgDbhDatumDescriptor::T_R8, // 127
4485  { 2, 2, 1}, 1, 2, true, false},
4486  //
4487  {"TAI- UTC", "FJD,TAI-UTC (sec),rate off.(sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 128
4488  { 3, 1, 1}, 0, 2, true, false},
4489  {"FOURFFIL", "Fourfit output filename.", NULL, true, SgDbhDatumDescriptor::T_A2, // 129
4490  { 8, 1, 1}, 1, 1, true, false},
4491  {"FOURFFXS", "Fourfit output filename S-band", NULL, true, SgDbhDatumDescriptor::T_A2, // 130
4492  { 8, 1, 1}, 2, 4, true, false},
4493  {"ION_BITS", "ICORR for full ion tracking.", NULL, true, SgDbhDatumDescriptor::T_I2, // 131
4494  { 1, 1, 1}, 1, 4, true, false},
4495  {"UACSUP ", "User action for suppression", NULL, true, SgDbhDatumDescriptor::T_I2, // 132
4496  { 1, 1, 1}, 1, 4, true, false},
4497  //
4498  {"FUT1 INF", "Final Value TAI-UT1 array descrp", NULL, true, SgDbhDatumDescriptor::T_R8, // 133
4499  { 4, 1, 1}, 0, 2, false, false},
4500  {"FUT1 PTS", "Final Value TAI-UT1 data points.", NULL, true, SgDbhDatumDescriptor::T_R8, // 134
4501  {15, 1, 1}, 0, 2, false, false},
4502  {"FWOB INF", "Final Value wobble array descr.", NULL, true, SgDbhDatumDescriptor::T_R8, // 135
4503  { 3, 1, 1}, 0, 2, false, false},
4504  {"FWOBX&YT", "Final wobble X,Y component value", NULL, true, SgDbhDatumDescriptor::T_R8, // 136
4505  { 2,15, 1}, 0, 2, false, false},
4506  {"TIDALUT1", "Flag for tidal terms in UT1 sers", NULL, true, SgDbhDatumDescriptor::T_I2, // 137
4507  { 1, 1, 1}, 0, 2, true, false},
4508  {"#PAMBG_S", "# phase ambiguities for S-band", NULL, true, SgDbhDatumDescriptor::T_J4, // 138
4509  { 1, 1, 1}, 1, 4, true, false},
4510  //
4511  //lCode_, description_, d_, isPresent_, type_
4512  //dimensions_[3], numOfTc_, expectedVersion_, isDimensionsFixed_, isMandatory_
4513  {"SOL_DATA", "Stnd sol data. IDATYP from SOCOM", NULL, true, SgDbhDatumDescriptor::T_I2, // 139
4514  { 1, 1, 1}, 0, 4, true, false},
4515  {"SUPMET ", "Suppression method", NULL, true, SgDbhDatumDescriptor::T_I2, // 140
4516  { 1, 1, 1}, 0, 4, true, false},
4517  {"BLDEPCKS", "Bl-dependent clock list", NULL, true, SgDbhDatumDescriptor::T_A2, // 141
4518  { 8, 6, 1}, 0, 4, false, false},
4519  {"PRT FLAG", "Atmosphere partial to be applied", NULL, true, SgDbhDatumDescriptor::T_I2, // 142
4520  { 1, 1, 1}, 0, 4, true, false},
4521  {"FCL LIST", "Key to the standard flcal config", NULL, true, SgDbhDatumDescriptor::T_A2, // 143
4522  { 4, 8, 1}, 0, 4, false, false},
4523  {"FCL FLGS", "Standard flcal configuration", NULL, true, SgDbhDatumDescriptor::T_I2, // 144
4524  { 7, 2, 1}, 0, 4, false, false},
4525  {"OBCLLIST", "Key to standard contribs config", NULL, true, SgDbhDatumDescriptor::T_A2, // 145
4526  { 4,12, 1}, 0, 4, false, false},
4527  {"OBCLFLGS", "Standard contribs configuration", NULL, true, SgDbhDatumDescriptor::T_I2, // 146
4528  { 1, 1, 1}, 0, 4, true, false},
4529  {"SCANNAME", "Scan name ......................", NULL, true, SgDbhDatumDescriptor::T_A2, // 147
4530  { 5, 1, 1}, 1, 1, true, false},
4531  {"RUN CODE", "Run,code, e.g., \"329-1300\"......",NULL, true, SgDbhDatumDescriptor::T_A2, // 148
4532  { 4, 1, 1}, 1, 1, true, false},
4533  {"OCE HORZ", "Site-dep ocean cont - horizontal", NULL, true, SgDbhDatumDescriptor::T_R8, // 149
4534  { 2, 2, 1}, 1, 2, true, false },
4535  {"OCE VERT", "Site-dep ocean cont - vertical", NULL, true, SgDbhDatumDescriptor::T_R8, // 150
4536  { 2, 2, 1}, 1, 2, true, false },
4537 
4538  {"WOBLIBRA", "High freq libration wobble contr", NULL, true, SgDbhDatumDescriptor::T_R8, // 151
4539  { 2, 1, 1}, 1, 2, true, false },
4540  {"UT1LIBRA", "UT1 Libration contribution.", NULL, true, SgDbhDatumDescriptor::T_R8, // 152
4541  { 2, 1, 1}, 1, 2, true, false },
4542  {"NUT06XYS", "2000/2006 Nut/Prec X,Y,S & Rates", NULL, true, SgDbhDatumDescriptor::T_R8, // 153
4543  { 3, 2, 1}, 1, 2, true, false },
4544  {"NUT06XYP", "2000/2006 Nut/Prec X,Y Partials", NULL, true, SgDbhDatumDescriptor::T_R8, // 154
4545  { 2, 2, 1}, 1, 2, true, false },
4546  {"NUT WAHR", "Wahr nut vals - Dpsi,Deps&rates", NULL, true, SgDbhDatumDescriptor::T_R8, // 155
4547  { 2, 2, 1}, 1, 2, true, false },
4548  {"NUT2006A", "2000/2006 Nut/Prec psi/epsilon", NULL, true, SgDbhDatumDescriptor::T_R8, // 156
4549  { 2, 2, 1}, 1, 2, true, false },
4550  {"OPTLCONT", "Ocean Pole Tide Load Contributn", NULL, true, SgDbhDatumDescriptor::T_R8, // 157
4551  { 2, 1, 1}, 1, 2, true, false },
4552  {"AC_SITES", "Site list for atmos constraints", NULL, true, SgDbhDatumDescriptor::T_A2, // 158
4553  { 4, 1, 1}, 0, 4, false, false},
4554  {"CC_SITES", "Site list for clocks constraints", NULL, true, SgDbhDatumDescriptor::T_A2, // 159
4555  { 4, 1, 1}, 0, 4, false, false},
4556  //
4557  {"OCE_OLD ", "Old Ocean loading contribution.", NULL, true, SgDbhDatumDescriptor::T_R8, // 160
4558  { 2, 1, 1}, 1, 2, true, false},
4559  {"PTOLDCON", "Old Pole Tide Restorer Contrib.", NULL, true, SgDbhDatumDescriptor::T_R8, // 161
4560  { 2, 1, 1}, 1, 2, true, false},
4561  {"FRNGERR ", "Fourfit error flag blank=OK.....", NULL, true, SgDbhDatumDescriptor::T_A2, // 162
4562  { 1, 1, 1}, 1, 1, true, false},
4563  //
4564  {"UTC_ACM ", "Epochs YMDHMS f/ apriori clk mod", NULL, false,SgDbhDatumDescriptor::T_I2, // 163
4565  { 6, 1, 1}, 0, 5, true, false},
4566  {"NUM_ACM ", "# of stations w/ apriori clk mod", NULL, false,SgDbhDatumDescriptor::T_I2, // 164
4567  { 1, 1, 1}, 0, 5, true, false},
4568 
4569  {"PARANGLE", "Feedhorn rot. angle, ref and rem", NULL, false,SgDbhDatumDescriptor::T_R8, // 165
4570  { 2, 1, 1}, 1, 2, true, false},
4571  //
4572  //
4573  {"CONSNRAT", "Consensus theo. rate (sec/sec) ", NULL, true, SgDbhDatumDescriptor::T_R8, // 166
4574  { 1, 1, 1}, 1, 2, true, true },
4575  {"NDRYPART", "Nhmf2 dry partial deriv. def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 167
4576  { 2, 2, 1}, 1, 2, true, true },
4577  {"NWETPART", "Whmf2 wet partial deriv. def. ", NULL, true, SgDbhDatumDescriptor::T_R8, // 168
4578  { 2, 2, 1}, 1, 2, true, true },
4579  {"SUN CONT", "Consensus bending contrib. (sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 169
4580  { 2, 1, 1}, 1, 2, true, true },
4581  {"SUN2CONT", "High order bending contrib.(sec)", NULL, true, SgDbhDatumDescriptor::T_R8, // 170
4582  { 2, 1, 1}, 1, 2, true, true },
4583 
4584  {"MSLM ION", "MSLM/JPL GPS Iono Correctn (sec)", NULL, false,SgDbhDatumDescriptor::T_R8, // 171
4585  { 2, 1, 1}, 1, 4, true, false},
4586 
4587  //lCode_, description_, d_, isPresent_, type_
4588  //dimensions_[3], numOfTc_, expectedVersion_, isDimensionsFixed_, isMandatory_
4589  //
4590  // //
4591  // {"GROBSDEL", "Observed group delay in sec.....", NULL, true, SgDbhDatumDescriptor::T_R8, // 151
4592  // { 1, 1, 1}, 1, 1, true, false },
4593 
4594  // DO WE NEED THIS?
4595  //
4596  //MCALSTAT [ 2, 1, 1] 4 335 I2 Mode calibrations status
4597  //"MCALSTAT" (aka "Mode calibrations status") [2,1,1] =
4598  //(
4599  // ((0, 0))
4600  //);
4601  // + :
4602  //"MCALNAMS" (aka "Mode calibrations names") [4,15,1] =
4603  //(
4604  // ("SOURSTRU", "SPURPCAL", "USERMCAL", " ", " ", " ", " ", " ",
4605  // " ", " ", " ", " ", " ", " ", " ")
4606  //);
4607  //
4608  //134. AUTO_SUP [ 1, 1, 1] 4 2 J4 Automatic suppression status
4609  //135. USER_SUP [ 1, 1, 1] 4 3 J4 User observation suppression sts
4610  //136. USER_REC [ 1, 1, 1] 4 4 J4 User observation recovery status
4611 };
4612 
4613 // number of the records:
4614 const int numOfDxT = sizeof(dbhDxTable)/sizeof(DbhDescriptorX);
4615 
4616 // individual records:
4788 
4790 
4791 
4792 
4793 // individual descriptors:
5115 
5116 
5117 /*=====================================================================================================*/
5118 
5119 /*=====================================================================================================*/
const Sg3dVector v3Zero(0.0, 0.0, 0.0)
const double vLight
Definition: SgConstants.cpp:35
SgLogger * logger
Definition: SgLogger.cpp:231
#define RAD2MAS
radians to ms:
Definition: SgMathSupport.h:73
#define DAY2SEC
radians to mas:
Definition: SgMathSupport.h:69
@ Z_AXIS
Definition: SgMathSupport.h:81
@ X_AXIS
Definition: SgMathSupport.h:81
@ Y_AXIS
Definition: SgMathSupport.h:81
#define DEG2RAD
degrees to seconds:
Definition: SgMathSupport.h:49
QMap< QString, SgVlbiBaselineInfo * >::iterator BaselinesByName_it
DbhDescriptorX & rAxisOffsets_
bool & hasFrngErr_
bool & hasMslmIonContrib_
DbhDescriptorX & rWobNutatContrib_
SgDbhDatumDescriptor *& dAcmNames_
SgDbhDatumDescriptor *& dReferenceFrequency_
DbhDescriptorX & rError_K_
bool & hasNwetCont_
bool & hasFwob_pts_
bool & hasConsensusRate_
DbhDescriptorX & rClockBreakStatus_
DbhDescriptorX & rClkBrkEpochs_
DbhDescriptorX & rFut1_pts_
bool & hasStarNames_
SgDbhDatumDescriptor *& dSupMet_
DbhDescriptorX & rSigmaSBDelaySecBand_
DbhDescriptorX & rOptlContib_
DbhDescriptorX & rSupMet_
bool & hasClkBrkFlags_
bool & hasClockIntrv_
bool & hasQualityCodeSecBand_
DbhDescriptorX & rClockConstr_
DbhDescriptorX & rRefFreqSecBand_
DbhDescriptorX & rStarPart_
DbhDescriptorX & rEccTypes_
bool & hasAtmCflg_
DbhDescriptorX & rSigmaPhaseObsSecBand_
DbhDescriptorX & rConsBendingDelay_
bool & hasWobXContrib_
SgDbhDatumDescriptor *& dAxsOfsPart_
bool & hasConsensusDelay_
SgDbhDatumDescriptor *& dGrpAmbiguitySecBand_
bool & hasRefFreqByChannel_
SgDbhDatumDescriptor *& dSbSigmaDelay_
bool & hasParAngle_
bool & hasFut1_pts_
DbhDescriptorX & rQualityCodeSecBand_
bool & hasCalByFrq_
SgDbhDatumDescriptor *& dClockIntrv_
bool & hasAtmPartFlag_
bool & hasNAmbig_
SgDbhDatumDescriptor *& dEccNames_
bool & hasRefClockSites_
DbhDescriptorX & rCableCalibration_
DbhDescriptorX & rCalFlags_
DbhDescriptorX & rSigmaRateObsSecBand_
DbhDescriptorX & rSnrSecBand_
bool & hasUserAction4Suppression_
SgDbhDatumDescriptor *& dTectPlateNames_
SgDbhDatumDescriptor *& dWobOrtho_
DbhDescriptorX & rConsensusRate_
bool & hasEccCoords_
SgDbhDatumDescriptor *& dTiltRemvr_
SgDbhDatumDescriptor *& dAxisTypes_
DbhDescriptorX & rNut06xys_
DbhDescriptorX & rBaselineName_
SgDbhDatumDescriptor *& dPtdOld_
SgDbhDatumDescriptor *& dEccCoords_
bool & hasNutWahr_
DbhDescriptorX & rBaselinesSelStatus_
SgDbhDatumDescriptor *& dPhaseCalOffset_
SgDbhDatumDescriptor *& dSitPart_
bool & hasObcFlags_
DbhDescriptorX dbhDxTable[]
bool & hasNutationPart_
DbhDescriptorX & rFrngErr_
SgDbhDatumDescriptor *& dBatchCnt_
SgDbhDatumDescriptor *& dFwob_inf_
bool & hasNut06xyp_
bool & hasOloadAmpVert_
DbhDescriptorX & rClockIntrv_
bool & hasNAmbigSecBand_
SgDbhDatumDescriptor *& dNutWahr_
DbhDescriptorX & rTidalUt1_
@ O10_WAHR_NUTAT
@ O10_WOBBLE_X
@ O10_WOB_ORTHO
@ O10_WOB_NUTAT
@ O10_EARTH_TIDE
@ O10_UT1_ORTHO
@ O10_OCEAN_TIDE
@ O10_POLE_TIDE
@ O10_WOBBLE_Y
@ O10_POLE_TIDE_OLD
@ O10_FEED_ROT
@ O10_TILT_RMVR
bool & hasUt1Ortho_
bool & hasPtdOld_
DbhDescriptorX & rCalList_
SgDbhDatumDescriptor *& dNAmbig_
SgDbhDatumDescriptor *& dUt1Libra_
bool & hasCalFlags_
DbhDescriptorX & rRefClockSites_
SgDbhDatumDescriptor *& dNumOfAccPeriods_
DbhDescriptorX & rSBDelaySecBand_
DbhDescriptorX & rUnPhaseCal_
bool & hasElevationData_
DbhDescriptorX & rMeteoTemperature_
DbhDescriptorX & rSourceName_
SgDbhDatumDescriptor *& dCalcVersionValue_
DbhDescriptorX & rObcFlags_
bool & hasEccTypes_
DbhDescriptorX & rDelayObsSecBand_
SgDbhDatumDescriptor *& dCableCalibration_
SgDbhDatumDescriptor *& dSecTag_
SgDbhDatumDescriptor *& dTotalPhaseSecBand_
bool & hasError_Bl_
bool & hasNut2006_
bool & hasTidalUt1_
bool & hasNdryCont_
DbhDescriptorX & rSun1BendingContrib_
DbhDescriptorX & rClkBrkNames_
DbhDescriptorX & rTotalPhase_
bool & hasEffFreqsSecBand_
DbhDescriptorX & rCableSigns_
bool & hasWobblePart_
DbhDescriptorX & rCorrCoef_
SgDbhDatumDescriptor *& dNutationPart2K_
DbhDescriptorX & rAtmIntrv_
bool & hasCableStations_
bool & hasCcSites_
SgDbhDatumDescriptor *& dUtcTag_
SgDbhDatumDescriptor *& dClkBrkNum_
bool & hasAcSites_
SgDbhDatumDescriptor *& dAcmEpochs_
DbhDescriptorX & rIonRms_
bool & hasFourFitFileNameSecBand_
DbhDescriptorX & rFclList_
bool & hasOloadHorzContrib_
bool & hasSiteNames_
SgDbhDatumDescriptor *& dAxisOffsets_
SgDbhDatumDescriptor *& dBlDepClocks_
DbhDescriptorX & rPhaseCalOffset_
DbhDescriptorX & rSnr_
DbhDescriptorX & rEccCoords_
bool & hasStar2000_
bool & hasGrpAmbiguitySecBand_
DbhDescriptorX & rClkBrkNum_
SgDbhDatumDescriptor *& dCorrelatorType_
DbhDescriptorX & rRecSetup_
DbhDescriptorX & rSbDelay_
SgDbhDatumDescriptor *& dPhIonFrq_
bool & hasClkBrkEpochs_
bool & hasNgradParts_
bool & hasTiltRemvr_
SgDbhDatumDescriptor *& dSun2BendingContrib_
bool & hasAtmConstr_
DbhDescriptorX & rClkCflg_
SgDbhDatumDescriptor *& dSnr_
DbhDescriptorX & rNutationPart2K_
DbhDescriptorX & rNRefClocks_
bool & hasCalSites_
DbhDescriptorX & rSun2BendingContrib_
bool & hasMeteoRelHumidityData_
bool & hasUnPhaseCal_
DbhDescriptorX & rConsensusDelay_
bool & hasEccNames_
SgDbhDatumDescriptor *& dEl_Cut_
DbhDescriptorX & rSbSigmaDelay_
SgDbhDatumDescriptor *& dRefClockSites_
SgDbhDatumDescriptor *& dBaselineName_
SgDbhDatumDescriptor *& dDelayRate_
DbhDescriptorX & rRunCode_
bool & hasSigmaPhaseObsSecBand_
DbhDescriptorX & rAtmConstr_
bool & hasClkBrkNum_
SgDbhDatumDescriptor *& dConsensusDelay_
DbhDescriptorX & rAzimuths_
DbhDescriptorX & rAtmPartFlag_
const int numOfDxT
SgDbhDatumDescriptor *& dAcmRates_
SgDbhDatumDescriptor *& dWobNutatContrib_
bool & hasFclFlags_
bool & hasPtdContrib_
DbhDescriptorX & rBatchCnt_
DbhDescriptorX & rObservedDelaySigma_
bool & hasNutationPart2K_
SgDbhDatumDescriptor *& dNAmbigSecBand_
SgDbhDatumDescriptor *& dFwob_pts_
bool & hasPhIonFrq_
bool & hasAcmNumber_
DbhDescriptorX & rNut06xyp_
bool & hasPhaseCalOffset_
bool & hasRunCode_
bool & hasFourFitFileName_
bool & hasIonCorr_
DbhDescriptorX & rAmpByFrq_
DbhDescriptorX & rMeteoHumidity_
DbhDescriptorX & rOloadAmpHorz_
DbhDescriptorX & rNut2006_
bool & hasTotalPhase_
SgDbhDatumDescriptor *& dObservedDelaySigma_
SgDbhDatumDescriptor *& dFclList_
DbhDescriptorX & rCalByFrq_
bool & hasSitPart_
DbhDescriptorX & rOloadPhsHorz_
SgDbhDatumDescriptor *& dAcmNumber_
SgDbhDatumDescriptor *& dOloadVertContrib_
SgDbhDatumDescriptor *& dMeteoPressure_
DbhDescriptorX & rEccNames_
bool & hasObcList_
bool & hasDelayObsSecBand_
SgDbhDatumDescriptor *& dAmpByFrq_
SgDbhDatumDescriptor *& dAtmPartFlag_
bool & hasCableData_
DbhDescriptorX & rAxOffsetCont_
bool & hasSigmaSBDelaySecBand_
bool & hasNwetPart_
SgDbhDatumDescriptor *& dAtmConstr_
bool & hasBaselinesDepClocks_
DbhDescriptorX & rScanName_
DbhDescriptorX & rUtcTag_
DbhDescriptorX & rNSites_
SgDbhDatumDescriptor *& dSun1BendingContrib_
SgDbhDatumDescriptor *& dObcList_
bool & hasAcmRates_
SgDbhDatumDescriptor *& dNSites_
SgDbhDatumDescriptor *& dUnPhaseCal_
SgDbhDatumDescriptor *& dClockSite_
const QString sFclList[]
bool & hasWobOrtho_
DbhDescriptorX & rOceOld_
DbhDescriptorX & rError_Bl_
SgDbhDatumDescriptor *& dTidalUt1_
SgDbhDatumDescriptor *& dIonBits_
SgDbhDatumDescriptor *& dClockBreakStatus_
SgDbhDatumDescriptor *& dSnrSecBand_
bool & hasSigmaRateObsSecBand_
bool & hasWobYContrib_
SgDbhDatumDescriptor *& dEccTypes_
SgDbhDatumDescriptor *& dQualityCodeSecBand_
bool & hasNRefClocks_
SgDbhDatumDescriptor *& dCalByFrq_
SgDbhDatumDescriptor *& dRefFreqByChannel_
SgDbhDatumDescriptor *& dCableStations_
SgDbhDatumDescriptor *& dFclFlags_
bool & hasEtdContrib_
SgDbhDatumDescriptor *& dEtdContrib_
bool & hasCorrelatorType_
bool & hasTotalPhaseSecBand_
DbhDescriptorX & rFourFitFileName_
SgDbhDatumDescriptor *& dIonCode_
DbhDescriptorX & rBaselinesDepClocks_
bool & hasPhaseObsSecBand_
SgDbhDatumDescriptor *& dFourFitFileNameSecBand_
SgDbhDatumDescriptor *& dFourFitFileName_
DbhDescriptorX & rFwob_pts_
DbhDescriptorX & rRateUFlag_
SgDbhDatumDescriptor *& dWobYContrib_
SgDbhDatumDescriptor *& dBaselinesSelStatus_
DbhDescriptorX & rAxisTypes_
SgDbhDatumDescriptor *& dCorrCoef_
SgDbhDatumDescriptor *& dQualityCode_
const bool useOldAcm
SgDbhDatumDescriptor *& dStarNames_
DbhDescriptorX & rFourFitFileNameSecBand_
SgDbhDatumDescriptor *& dNgradParts_
bool & hasScanName_
SgDbhDatumDescriptor *& dNRefClocks_
DbhDescriptorX & rSigmaDelayRate_
DbhDescriptorX & rPtdContrib_
SgDbhDatumDescriptor *& dAtmCflg_
bool & hasFwob_inf_
SgDbhDatumDescriptor *& dNdryCont_
DbhDescriptorX & rPhAmbig_S_
DbhDescriptorX & rNAmbigSecBand_
SgDbhDatumDescriptor *& dClkBrkNames_
bool & hasAzimuthData_
bool & hasWobLibra_
DbhDescriptorX & rGrpAmbiguity_
bool & hasSupMet_
DbhDescriptorX & rGrIonFrq_
bool & hasWobNutatContrib_
DbhDescriptorX & rCcSites_
DbhDescriptorX & rStarNames_
SgDbhDatumDescriptor *& dSigmaDelayObsSecBand_
@ O11_WOBBLE_X
@ O11_WOBBLE_Y
@ O11_FEED_ROT
@ O11_WOB_LIBRA
@ O11_TILT_RMVR
@ O11_OCN_POLE_TIDE
@ O11_OCEAN_TIDE
@ O11_WOB_ORTHO
@ O11_UT1_ORTHO
@ O11_EARTH_TIDE
@ O11_UT1_LIBRA
@ O11_POLE_TIDE
@ O11_OCEAN_TIDE_OLD
@ O11_POLE_TIDE_OLD
bool & hasNStars_
SgDbhDatumDescriptor *& dTai_2_Utc_
SgDbhDatumDescriptor *& dRecSetup_
SgDbhDatumDescriptor *& dWobLibra_
bool & hasClkBrkNames_
DbhDescriptorX & rSiteNames_
bool & hasAcmEpochs_
const QString sMntTypes[]
DbhDescriptorX & rPhIonFrq_
bool & hasOceOld_
SgDbhDatumDescriptor *& dClkBrkEpochs_
DbhDescriptorX & rNumOfChannels_
SgDbhDatumDescriptor *& dFut1_inf_
DbhDescriptorX & rParAngle_
DbhDescriptorX & rOloadAmpVert_
DbhDescriptorX & rFclFlags_
DbhDescriptorX & rEl_Cut_
DbhDescriptorX & rNumOfAccPeriods_
SgDbhDatumDescriptor *& dOloadAmpHorz_
DbhDescriptorX & rCalcVersionValue_
DbhDescriptorX & rNdryPart_
DbhDescriptorX & rBlDepClocks_
bool & hasBlDepClocks_
SgDbhDatumDescriptor *& dPhAmbig_S_
DbhDescriptorX & rUserAction4Suppression_
DbhDescriptorX & rSecTag_
const QString sCalList[]
bool & hasFut1_inf_
SgDbhDatumDescriptor *& dOloadPhsVert_
bool & hasUt1Libra_
SgDbhDatumDescriptor *& dOloadContrib_
SgDbhDatumDescriptor *& dSigmaDelayRate_
DbhDescriptorX & rAcmNames_
bool & hasSigmaDelayObsSecBand_
SgDbhDatumDescriptor *& dOptlContib_
DbhDescriptorX & rQualityCode_
DbhDescriptorX & rEffFreqsSecBand_
DbhDescriptorX & rObcList_
SgDbhDatumDescriptor *& dMslmIonContrib_
SgDbhDatumDescriptor *& dStarPart_
bool & hasOptlContib_
SgDbhDatumDescriptor *& dFrngErr_
DbhDescriptorX & rNwetCont_
SgDbhDatumDescriptor *& dClockConstr_
DbhDescriptorX & rWobLibra_
DbhDescriptorX & rDelayRate_
DbhDescriptorX & rFwob_inf_
SgDbhDatumDescriptor *& dCorrCoefSecBand_
bool & hasEl_Cut_
DbhDescriptorX & rWobOrtho_
SgDbhDatumDescriptor *& dElevations_
SgDbhDatumDescriptor *& dIonCorr_
DbhDescriptorX & rFeedCorr_
bool & hasOloadVertContrib_
DbhDescriptorX & rAcmNumber_
bool & hasOloadAmpHorz_
bool & hasClockBreakStatus_
bool & hasIonRms_
SgDbhDatumDescriptor *& dDelayUFlag_
SgDbhDatumDescriptor *& dGrIonFrq_
bool & hasAxisOffsets_
DbhDescriptorX & rN4Obs_
DbhDescriptorX & rRefFreqByChannel_
bool & hasStarPart_
SgDbhDatumDescriptor *& dAzimuths_
DbhDescriptorX & rSourcesSelStatus_
SgDbhDatumDescriptor *& dGrpAmbiguity_
SgDbhDatumDescriptor *& dError_K_
bool & hasAxsOfsPart_
SgDbhDatumDescriptor *& dAtmIntrv_
DbhDescriptorX & rMslmIonContrib_
SgDbhDatumDescriptor *& dCableSigns_
SgDbhDatumDescriptor *& dClkBrkFlags_
DbhDescriptorX & rNwetPart_
bool & hasAxisTypes_
bool & hasSun2BendingContrib_
SgDbhDatumDescriptor *& dConsBendingDelay_
DbhDescriptorX & rFut1_inf_
DbhDescriptorX & rIonCorr_
SgDbhDatumDescriptor *& dRunCode_
SgDbhDatumDescriptor *& dUt1Ortho_
bool & hasAcmNames_
SgDbhDatumDescriptor *& dSiteRecs_
bool & hasSun1BendingContrib_
SgDbhDatumDescriptor *& dUT1Part_
DbhDescriptorX & rSampleRate_
bool & hasNumOfSamples_
DbhDescriptorX & rOloadPhsVert_
SgDbhDatumDescriptor *& dPhaseObsSecBand_
DbhDescriptorX & rWobblePart_
bool & hasAtmIntrv_
SgDbhDatumDescriptor *& dWobXContrib_
bool & hasOloadPhsHorz_
bool & hasNSites_
SgDbhDatumDescriptor *& dEffFreqsSecBand_
bool & hasNumOfChannels_
SgDbhDatumDescriptor *& dRateUFlag_
bool & hasBatchCnt_
bool & hasSolData_
DbhDescriptorX & rAxsOfsPart_
bool & hasSourcesSelStatus_
SgDbhDatumDescriptor *& dSiteNames_
SgDbhDatumDescriptor *& dNStars_
SgDbhDatumDescriptor *& dIonRms_
DbhDescriptorX & rNdryCont_
SgDbhDatumDescriptor *& dFut1_pts_
SgDbhDatumDescriptor *& dNumOfSamples_
SgDbhDatumDescriptor *& dNdryPart_
DbhDescriptorX & rGrpAmbiguitySecBand_
DbhDescriptorX & rNutWahr_
DbhDescriptorX & rAcmEpochs_
SgDbhDatumDescriptor *& dSigmaSBDelaySecBand_
SgDbhDatumDescriptor *& dPtdContrib_
SgDbhDatumDescriptor *& dNut06xys_
bool & hasCalList_
SgDbhDatumDescriptor *& dMeteoHumidity_
DbhDescriptorX & rReferenceFrequency_
SgDbhDatumDescriptor *& dRateObsSecBand_
DbhDescriptorX & rCorrCoefSecBand_
bool & hasSnrSecBand_
DbhDescriptorX & rSiteRecs_
bool & hasMeteoPressureData_
bool & hasIonBits_
DbhDescriptorX & rAcmRates_
bool & hasNObs_
bool & hasPhAmbig_S_
SgDbhDatumDescriptor *& dN4Obs_
SgDbhDatumDescriptor *& dSigmaRateObsSecBand_
DbhDescriptorX & rNgradParts_
bool & hasCableSigns_
DbhDescriptorX & rClockSite_
DbhDescriptorX & rWobYContrib_
DbhDescriptorX & rTai_2_Utc_
DbhDescriptorX & rAcSites_
SgDbhDatumDescriptor *& dOceOld_
SgDbhDatumDescriptor *& dNwetPart_
SgDbhDatumDescriptor *& dNut06xyp_
bool & hasUT1Part_
bool & hasFclList_
bool & hasOloadContrib_
SgDbhDatumDescriptor *& dNObs_
SgDbhDatumDescriptor *& dConsensusRate_
DbhDescriptorX & rRateObsSecBand_
SgDbhDatumDescriptor *& dTotalPhase_
bool & hasMeteoTemperatureData_
DbhDescriptorX & rClkBrkFlags_
SgDbhDatumDescriptor *& dNut2006_
DbhDescriptorX & rSigmaDelayObsSecBand_
DbhDescriptorX & rUt1Ortho_
bool & hasClockConstr_
DbhDescriptorX & rTectPlateNames_
bool & hasGrIonFrq_
SgDbhDatumDescriptor *& dSourceName_
bool & hasRefFreqSecBand_
bool & hasAxOffsetCont_
DbhDescriptorX & rEtdContrib_
DbhDescriptorX & rNAmbig_
DbhDescriptorX & rAcmOffsets_
DbhDescriptorX & rIonBits_
DbhDescriptorX & rPhaseObsSecBand_
bool & hasSiteRecs_
bool & hasError_K_
DbhDescriptorX & rNumOfSamples_
DbhDescriptorX & rWobXContrib_
SgDbhDatumDescriptor *& dCcSites_
DbhDescriptorX & rNStars_
SgDbhDatumDescriptor *& dStar2000_
bool & hasRateObsSecBand_
DbhDescriptorX & rOloadVertContrib_
DbhDescriptorX & rElevations_
DbhDescriptorX & rNObs_
DbhDescriptorX & rCalSites_
SgDbhDatumDescriptor *& dAcmOffsets_
bool & hasAcmOffsets_
SgDbhDatumDescriptor *& dSBDelaySecBand_
DbhDescriptorX & rTiltRemvr_
SgDbhDatumDescriptor *& dScanName_
bool & hasNut06xys_
DbhDescriptorX & rPtdOld_
SgDbhDatumDescriptor *& dSampleRate_
SgDbhDatumDescriptor *& dMeteoTemperature_
SgDbhDatumDescriptor *& dUserAction4Suppression_
SgDbhDatumDescriptor *& dCalList_
DbhDescriptorX & rAtmCflg_
SgDbhDatumDescriptor *& dError_Bl_
SgDbhDatumDescriptor *& dBaselinesDepClocks_
SgDbhDatumDescriptor *& dWobblePart_
bool & hasOloadPhsVert_
bool & hasClkCflg_
SgDbhDatumDescriptor *& dSolData_
DbhDescriptorX & rUT1Part_
SgDbhDatumDescriptor *& dSbDelay_
bool & hasSBDelaySecBand_
SgDbhDatumDescriptor *& dOloadHorzContrib_
SgDbhDatumDescriptor *& dObcFlags_
SgDbhDatumDescriptor *& dFeedCorr_
bool & hasBaselinesSelStatus_
SgDbhDatumDescriptor *& dCalSites_
DbhDescriptorX & rTotalPhaseSecBand_
bool & hasCalcVersionValue_
SgDbhDatumDescriptor *& dNwetCont_
bool & hasN4Obs_
SgDbhDatumDescriptor *& dAxOffsetCont_
DbhDescriptorX & rOloadHorzContrib_
DbhDescriptorX & rCorrelatorType_
SgDbhDatumDescriptor *& dObservedDelay_
DbhDescriptorX & rStar2000_
SgDbhDatumDescriptor *& dParAngle_
SgDbhDatumDescriptor *& dNumOfChannels_
DbhDescriptorX & rNutationPart_
DbhDescriptorX & rObservedDelay_
DbhDescriptorX & rMeteoPressure_
bool & hasTectPlateNames_
DbhDescriptorX & rDelayUFlag_
bool & hasFeedCorr_
bool & hasCorrCoefSecBand_
SgDbhDatumDescriptor *& dCalFlags_
SgDbhDatumDescriptor *& dSourcesSelStatus_
SgDbhDatumDescriptor *& dOloadPhsHorz_
bool & hasConsBendingDelay_
SgDbhDatumDescriptor *& dRefFreqSecBand_
SgDbhDatumDescriptor *& dClkCflg_
DbhDescriptorX & rOloadContrib_
DbhDescriptorX & rCableStations_
SgDbhDatumDescriptor *& dAcSites_
bool & hasTai_2_Utc_
DbhDescriptorX & rUt1Libra_
bool & hasNdryPart_
DbhDescriptorX & rSolData_
SgDbhDatumDescriptor *& dNutationPart_
DbhDescriptorX & rSitPart_
SgDbhDatumDescriptor *& dSigmaPhaseObsSecBand_
SgDbhDatumDescriptor *& dDelayObsSecBand_
SgDbhDatumDescriptor *& dOloadAmpVert_
DbhDescriptorX & rIonCode_
void evaluateEffectiveFreqs(const SgVector &numOfAccPeriodsByChan_USB, const SgVector &numOfAccPeriodsByChan_LSB, const SgVector &refFreqByChan, const SgVector &fringeAmplitudeByChan, const SgVector &numOfSamplesByChan_USB, const SgVector &numOfSamplesByChan_LSB, double sampleRate, double refFreq, int numOfChannels, double &effFreq4GR, double &effFreq4PH, double &effFreq4RT, const QString &correlatorType, const QString &oId, bool useEqualWeights=false)
QMap< QString, SgVlbiStationInfo * >::iterator StationsByName_it
@ DT_DELAY
Definition: SgWrmsable.h:44
@ DT_RATE
Definition: SgWrmsable.h:45
double at(DIRECTION i) const
Definition: Sg3dVector.h:91
bool isAttr(uint a) const
Definition: SgAttribute.h:226
void delAttr(uint a)
Definition: SgAttribute.h:210
void addAttr(uint a)
Definition: SgAttribute.h:202
bool addBreak(const SgMJD &t, double a0=0.0, double a1=0.0, double a2=0.0, bool isDynamic=false)
const QString & typeName() const
Definition: SgDbhImage.h:115
short dim2() const
Definition: SgDbhImage.h:93
const QString & getLCode() const
Definition: SgDbhImage.h:90
void setDimensions(int d1, int d2, int d3)
Definition: SgDbhImage.h:104
void setType(Type type)
Definition: SgDbhImage.h:103
short dim3() const
Definition: SgDbhImage.h:94
short dim1() const
Definition: SgDbhImage.h:92
void setNTc(int nTc)
Definition: SgDbhImage.h:107
const QString & fileName() const
Definition: SgDbhImage.cpp:178
int fileVersion() const
Definition: SgDbhImage.cpp:170
const QString & sessionID() const
Definition: SgDbhImage.cpp:194
int currentVersion() const
Definition: SgDbhImage.h:331
void startFormatModifying()
Definition: SgDbhImage.cpp:508
double getR8(SgDbhDatumDescriptor *d, int i, int j, int k, int obsNumber=-1)
Definition: SgDbhImage.cpp:347
short getI2(SgDbhDatumDescriptor *d, int i, int j, int k, int obsNumber=-1)
Definition: SgDbhImage.cpp:371
void setI2(SgDbhDatumDescriptor *d, int i, int j, int k, int obsNumber, short i2)
Definition: SgDbhImage.cpp:448
void setJ4(SgDbhDatumDescriptor *d, int i, int j, int k, int obsNumber, int j4)
Definition: SgDbhImage.cpp:440
SgMJD fileCreationEpoch() const
Definition: SgDbhImage.cpp:162
void setStr(SgDbhDatumDescriptor *d, int i, int j, int obsNumber, const QString &str)
Definition: SgDbhImage.cpp:379
void finisFormatModifying()
Definition: SgDbhImage.cpp:518
const QString & sessionDescription() const
Definition: SgDbhImage.cpp:186
bool delDescriptor(SgDbhDatumDescriptor *)
Definition: SgDbhImage.cpp:922
void setR8(SgDbhDatumDescriptor *d, int i, int j, int k, int obsNumber, double r8)
Definition: SgDbhImage.cpp:424
int numberOfObservations() const
Definition: SgDbhImage.h:213
SgDbhDatumDescriptor * lookupDescriptor(const char *tag)
Definition: SgDbhImage.h:341
bool addDescriptor(SgDbhDatumDescriptor *)
Definition: SgDbhImage.cpp:823
QString getStr(SgDbhDatumDescriptor *d, int i, int j, int obsNumber=-1)
Definition: SgDbhImage.cpp:318
void prepare2save()
Definition: SgDbhImage.cpp:989
@ ET_XYZ
Definition: SgEccRec.h:52
EccType getEccType() const
Definition: SgEccRec.h:251
const Sg3dVector & getDR() const
Definition: SgEccRec.h:243
const QString & getAcAbbrevName() const
Definition: SgIdentities.h:247
const QString & getUserEmailAddress() const
Definition: SgIdentities.h:223
const QString & getUserDefaultInitials() const
Definition: SgIdentities.h:231
const QString & getAcFullName() const
Definition: SgIdentities.h:239
const QString & getUserName() const
Definition: SgIdentities.h:215
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ IO_TXT
Definition: SgLogger.h:65
@ IO_DBH
Definition: SgLogger.h:67
Definition: SgMJD.h:59
double getTime() const
Definition: SgMJD.h:455
@ F_YYYYMMDDHHMMSSSS
Long verbose: Fri, the 2nd of Apr, 2010; 17hr 02min 43.6400sec.
Definition: SgMJD.h:67
@ F_INTERNAL
Digits, date and time: 20100402.71.
Definition: SgMJD.h:72
SgMJD toUtc() const
Definition: SgMJD.cpp:1230
QString toString(Format format=F_Verbose) const
Definition: SgMJD.cpp:1008
double toDouble() const
Definition: SgMJD.h:531
int getDate() const
Definition: SgMJD.h:447
int calcHour() const
Definition: SgMJD.h:493
int calcDayOfYear() const
Definition: SgMJD.cpp:238
static SgMJD currentMJD()
Definition: SgMJD.cpp:119
void setUpEpoch(int year, int month, int day, int hour, int min, double sec)
Definition: SgMJD.cpp:255
int calcMin() const
Definition: SgMJD.h:500
static void MJD_reverse(int date, double time, int &nYear, int &nMonth, int &nDay, int &nHour, int &nMin, double &dSec)
Definition: SgMJD.cpp:75
double calcSec() const
Definition: SgMJD.h:507
void setElement(unsigned int i, unsigned int j, double d)
Definition: SgMatrix.h:402
double getPressure() const
Definition: SgMeteoData.h:242
void setRelativeHumidity(double rho)
Definition: SgMeteoData.h:274
double getTemperature() const
Definition: SgMeteoData.h:234
void setTemperature(double t)
Definition: SgMeteoData.h:258
void setPressure(double p)
Definition: SgMeteoData.h:266
@ Attr_ARTIFICIAL_DATA
data are artificial (mean values or some model);
Definition: SgMeteoData.h:52
double getRelativeHumidity() const
Definition: SgMeteoData.h:250
QList< SgVlbiStationInfo * > & stations()
Definition: SgModelsInfo.h:155
void setDversion(double d)
Definition: SgModelsInfo.h:123
double getDversion() const
Definition: SgModelsInfo.h:114
void setKey(const QString &key)
Definition: SgObjectInfo.h:447
int getIdx() const
Definition: SgObjectInfo.h:335
void incNumTotal(DataType, int=1)
Definition: SgObjectInfo.h:519
double getSigma2add(DataType) const
Definition: SgObjectInfo.h:367
const QString & getKey() const
Definition: SgObjectInfo.h:319
int numProcessed(DataType dType) const
Definition: SgObjectInfo.h:351
void setSigma2add(DataType dType, double d)
Definition: SgObjectInfo.h:471
double wrms(DataType) const
Definition: SgObjectInfo.h:567
int numTotal(DataType dType) const
Definition: SgObjectInfo.h:343
virtual void setMediaIdx(int idx)
virtual void setMJD(const SgMJD &)
@ Attr_NOT_VALID
omit the observation;
Definition: SgObservation.h:78
@ Attr_PROCESSED
the observation has been processed;
Definition: SgObservation.h:79
double getA1() const
Definition: SgBreakModel.h:371
const SgMJD & getEpoch4Export() const
Definition: SgBreakModel.h:411
double getA0() const
Definition: SgBreakModel.h:363
@ Attr_DYNAMIC
parameters supposed to be estimated during the common solution;
Definition: SgBreakModel.h:60
double getPwlStep() const
double getPwlAPriori() const
void setPwlStep(double s)
void setPwlAPriori(double)
PMode getPMode() const
double getScale() const
double getSigma() const
Definition: SgParameter.h:443
const SgParameterCfg & getZenith() const
void setClock0(const SgParameterCfg &p)
const SgParameterCfg & getSrcCoo() const
const SgParameterCfg & getAtmGrad() const
SgParameterCfg::PMode getClock0Mode() const
void setZenith(const SgParameterCfg &p)
const SgParameterCfg & getClock0() const
SgParameterCfg::PMode getZenithMode() const
SgParameterCfg::PMode getAtmGradMode() const
SgParameterCfg::PMode getPolusUT1Mode() const
int getNumOfUnknowns() const
int getNumOfObservations() const
QMap< QString, SgParameter * > * parByName()
SgIdentities * identities()
const QString & getExtAPrioriSitesVelocitiesFileName() const
bool getUseExtAPrioriSitesVelocities() const
bool getUseExtAPrioriHiFyErp() const
bool getUseExtAPrioriSitesPositions() const
bool getUseExtAPrioriMeanGradients() const
const QString & getExtAPrioriSitesPositionsFileName() const
const QString & getExtAPrioriHiFyErpFileName() const
bool getUseExtAPrioriSourcesPositions() const
double getInitAuxSigma4Delay() const
Definition: SgTaskConfig.h:243
bool getUseExtAPrioriAxisOffsets() const
bool getUseSolveObsSuppresionFlags() const
Definition: SgTaskConfig.h:929
const QString & getExtAPrioriMeanGradientsFileName() const
const QString & getExtAPrioriSourcesPositionsFileName() const
double getInitAuxSigma4Rate() const
Definition: SgTaskConfig.h:244
const QString & getExtAPrioriAxisOffsetsFileName() const
@ CT_ALL_TERMS_REMOVED
Definition: SgTidalUt1.h:63
@ CT_SHORT_TERMS_REMOVED
Definition: SgTidalUt1.h:62
void setElement(unsigned int i, double d)
Definition: SgVector.h:348
void setCableCalibration(double cable)
void setMeteoData(const SgMeteoData &meteo)
void setAzimuthAngle(double angle)
void setDdel_dTzdDry(double v)
@ Attr_CABLE_CAL_BAD
clock break occured at the station
void setCalcNwetCont4Delay(double v)
void setCalcNdryCont4Delay(double v)
void setDrat_dTzdWet(double v)
void setCalcOLoadHorz4Delay(double v)
void setDdel_dTzdGrdE(double v)
void setAzimuthAngleRate(double rate)
void setDrat_dTzdGrdE(double v)
void setParallacticAngle(double angle)
void setCalcUnPhaseCal(double v)
void setDdel_dTzdGrdN(double v)
void setCalcOLoadVert4Delay(double v)
void setCalcAxisOffset4Delay(double v)
void setDrat_dTzdGrdN(double v)
void setCalcNwetCont4Rate(double v)
void setElevationAngle(double angle)
void setElevationAngleRate(double rate)
void setCalcNdryCont4Rate(double v)
void setDdel_dTzdWet(double v)
void setDrat_dTzdDry(double v)
void setCalcAxisOffset4Rate(double v)
void setFrequency(double f)
Definition: SgVlbiBand.h:402
void setTCreation(const SgMJD &t)
Definition: SgVlbiBand.h:410
void setCorrelatorType(const QString &name)
Definition: SgVlbiBand.h:434
QMap< QString, SgVlbiBaselineInfo * > & baselinesByName()
Definition: SgVlbiBand.h:376
QMap< QString, SgVlbiStationInfo * > & stationsByName()
Definition: SgVlbiBand.h:368
int getInputFileVersion() const
Definition: SgVlbiBand.h:344
void setInputFileName(const QString &fileName)
Definition: SgVlbiBand.h:418
void setInputFileVersion(int version)
Definition: SgVlbiBand.h:426
QList< SgVlbiObservable * > & observables()
Definition: SgVlbiBand.h:288
QMap< int, SgVlbiBaselineInfo * > & baselinesByIdx()
Definition: SgVlbiBand.h:304
QMap< QString, SgVlbiSourceInfo * > & sourcesByName()
Definition: SgVlbiBand.h:384
QMap< int, SgVlbiSourceInfo * > & sourcesByIdx()
Definition: SgVlbiBand.h:312
SgVlbiHistory & history()
Definition: SgVlbiBand.h:360
QMap< int, SgVlbiStationInfo * > & stationsByIdx()
Definition: SgVlbiBand.h:296
const QString & getCorrelatorType() const
Definition: SgVlbiBand.h:352
@ Attr_HAS_IONO_SOLUTION
the band contains ionospheric corrections;
Definition: SgVlbiBand.h:61
@ Attr_PRIMARY
the band is a primary band;
Definition: SgVlbiBand.h:60
@ Attr_ESTIMATE_CLOCKS
estimate baseline clocks;
@ Attr_NOT_VALID
omit the baseline;
int getVersion() const
bool getIsEditable() const
const SgMJD & getEpoch() const
const QString & getText() const
void importDbhHistoryBlock(SgDbhImage *)
void addHistoryRecord(const QString &, const SgMJD &t)
void export2DbhHistoryBlock(SgDbhImage *)
void setAmbiguitySpacing(double)
double getEffFreq() const
short int getUnweightFlag() const
void setIonoSigma(double)
double getAmbiguitySpacing() const
void setEffFreq(double)
double ambiguity() const
void setNumOfAmbiguities(int)
double getValue() const
void setIonoValue(double)
int getNumOfAmbiguities() const
double getSigma() const
double getIonoValue() const
void setUnweightFlag(short int)
double getIonoSigma() const
const QString & getFourfitOutputFName() const
void setNumOfChannels(int)
int getQualityFactor() const
void setTotalPhase(double)
SgMatrix * phaseCalData_2ByChan()
SgVector * numOfAccPeriodsByChan_LSB()
void setFourfitOutputFName(const QString &)
SgVector * numOfAccPeriodsByChan_USB()
SgVlbiMeasurement & phDRate()
void setSnr(double)
void setQualityFactor(int)
QString strId() const
SgVector * fringeAmplitudeByChan()
void setCorrCoeff(double)
SgVector * numOfSamplesByChan_LSB()
double getTotalPhase() const
void setErrorCode(const QString &)
double getSnr() const
SgMatrix * phaseCalData_1ByChan()
SgVector * numOfSamplesByChan_USB()
void setReferenceFrequency(double)
double getReferenceFrequency() const
void allocateChannelsSetupStorages(int numOfChans)
SgVlbiMeasurement & phDelay()
double getCorrCoeff() const
SgVlbiMeasurement & grDelay()
SgVlbiMeasurement & sbDelay()
SgVector * refFreqByChan()
int getMediaIdx() const
void setCalcOceanTideDelay(double v)
void setCalcGpsIonoCorrectionRate(double d)
void setCalcHiFyPxyRate(double v)
void setCalcNut2006_dPsiV(double v)
void setStation1Idx(short int idx)
void setScanId(const QString &sId)
void setCalcConsBendingRate(double d)
@ Attr_CONTAINS_ALL_DATA
an observaiton probably is from a primary band (for DBH IO)
void setCalcHiFyPxyDelay(double v)
void setDdel_dRA(double d)
void setCalcOceanPoleTideLdDelay(double v)
void setDrat_dR_1(const Sg3dVector &r)
void setCalcHiFyUt1Rate(double v)
void setCalcPxDelay(double v)
void setSourceIdx(short int idx)
void setCalcNut2006_dEpsV(double v)
void setCalcPoleTideDelay(double v)
void setCalcTiltRemvrRate(double v)
void setCalcConsBendingSunRate(double d)
bool addObservable(const QString &, const SgVlbiObservable &)
void setCalcEarthTideDelay(double v)
void setCalcConsensusDelay(double tau)
void setCalcHiFyPxyLibrationRate(double v)
void setCalcPyDelay(double v)
void setScanName(const QString &sName)
void setCalcPoleTideOldDelay(double v)
void setCalcPoleTideRate(double v)
void setCalcHiFyUt1LibrationDelay(double v)
void setCalcConsBendingSunHigherDelay(double d)
void setCalcConsensusRate(double r)
void setCalcNutWahr_dEpsV(double v)
void setCalcNutWahr_dPsiV(double v)
void setDrat_dCipY(double d)
void setCalcCipYv(double v)
QList< SgVlbiObservable * > & passiveObses()
void setCalcOceanTideOldRate(double v)
void setCalcFeedCorrDelay(double v)
void setupActiveObservable(const QString &)
void setDrat_dRA(double d)
void setCalcGpsIonoCorrectionDelay(double d)
void setCalcHiFyPxyLibrationDelay(double v)
void setCalcOceanTideOldDelay(double v)
void setDdel_dR_1(const Sg3dVector &r)
void setDdel_dUT1(double d)
void setCalcCipSv(double v)
void setCalcConsBendingSunHigherRate(double d)
void setDdel_dCipY(double d)
void setStation2Idx(short int idx)
void setCalcCipXv(double v)
SgVlbiObservable * observable(const QString &)
void setCalcEarthTideRate(double v)
void setDdel_dPy(double d)
void setCalcFeedCorrRate(double v)
const QString & getScanName() const
void setDdel_dPx(double d)
void setCalcTiltRemvrDelay(double v)
void setDdel_dCipX(double d)
void setCalcOceanPoleTideLdRate(double v)
void setCalcConsBendingDelay(double d)
void setCalcOceanTideRate(double v)
void setDrat_dCipX(double d)
void setCalcHiFyUt1LibrationRate(double v)
void setCalcHiFyUt1Delay(double v)
void setDrat_dPx(double d)
const QString & getKey()
void setCalcPyRate(double v)
void setDrat_dDN(double d)
void setBaselineIdx(short int idx)
void setCalcPxRate(double v)
void setDdel_dR_2(const Sg3dVector &r)
void setCalcPoleTideOldRate(double v)
void setCalcConsBendingSunDelay(double d)
void setDrat_dUT1(double d)
void setDrat_dR_2(const Sg3dVector &r)
void setCalcWobNutatContrib(double v)
void setDrat_dPy(double d)
void setKey(const QString &)
void setDdel_dDN(double d)
const QString & getCorrelatorType() const
const QString & getName() const
void setName(const QString &name)
QString officialName_
Official Name (from MasterFile)
void setCorrelatorType(const QString &name)
CorrelatorPostProcSoftware cppsSoft_
@ Attr_FF_WEIGHTS_CORRECTED
weights have been corrected;
@ Attr_FF_ION_C_CALCULATED
ionospheric corrections have been calculated;
@ Attr_FF_OUTLIERS_PROCESSED
outliers have been processed;
@ Attr_HAS_CALC_DATA
the theoretical values are available;
@ Attr_FF_AMBIGS_RESOLVED
ambiguities have been resolved;
@ Attr_FF_ECC_UPDATED
eccentricity data for one of stations were updated;
@ Attr_HAS_AUX_OBS
session contains aux.observations (e.g.: meteo data, cables);
@ Attr_HAS_IONO_CORR
the theoretical values are available;
@ Attr_HAS_WEIGHTS
the theoretical values are available;
@ Attr_HAS_CLOCK_BREAKS
there is at least one clock break at one of stations;
SgMJD tFinis_
last epoch of the observations;
@ CPPS_UNKNOWN
unknown (=all others);
QString networkSuffix_
a char that specifies network (e.g., A, E, U, etc.);
QString description_
Experiment description;.
QString name_
name of the session (e.g., 10JUL22XE);
SgMJD tStart_
first epoch of the observations;
StationsByName stationsByName_
bool hasOceanPoleTideContrib_
bool hasWobbleNutContrib_
void setLeapSeconds(double s)
bool hasUt1LibrationContrib_
QMap< QString, SgVlbiObservation * > observationByKey_
QList< SgVlbiBand * > bands_
void formObsCalibrationSetup(int &bitFlags, QList< QString > &calList)
SgTidalUt1::UT1TideContentType tabsUt1Type_
bool getDataFromDbhImages(QMap< QString, SgDbhImage * > &images, bool have2LoadImmatureSession, bool guiExpected)
SgVector * args4PxyInterpolation_
double getLeapSeconds()
void makeHistoryIntro(SgVlbiHistory &)
bool hasGpsIonoContrib_
bool selfCheck(bool guiExpected)
QMap< QString, SgVlbiBand * > bandByKey_
void applyObsCalibrationSetup(int bitFlags, const QList< QString > &calList)
bool hasOceanTideContrib_
QList< SgVlbiObservation * > observations_
bool hasPoleTideOldContrib_
bool getDataFromDbhImage(SgDbhImage *image, bool have2getAll, bool isStandardSession, bool have2LoadImmatureSession, bool guiExpected)
bool hasWobblePxContrib_
bool hasWobbleHighFreqContrib_
SgSolutionReporter * reporter_
bool hasUnPhaseCalContrib_
SgVlbiHistory contemporaryHistory_
QMap< int, SgVlbiStationInfo * > stationsByIdx_
SgModelsInfo calcInfo_
bool hasUt1HighFreqContrib_
bool putDataIntoDbhImage(SgDbhImage *image)
bool hasPxyInterpolation_
bool hasWobblePyContrib_
BaselinesByName baselinesByName_
void makeHistory(SgVlbiHistory &)
bool hasUt1Interpolation_
SgParametersDescriptor * parametersDescriptor_
SgVlbiBand * primaryBand_
bool hasPoleTideContrib_
bool hasEarthTideContrib_
static QString className()
SgVector * args4Ut1Interpolation_
bool hasPxyLibrationContrib_
SgMatrix * tabs4Ut1Interpolation_
bool hasFeedCorrContrib_
QMap< int, SgVlbiBaselineInfo * > baselinesByIdx_
SourcesByName sourcesByName_
SgTaskConfig * config_
bool hasTiltRemvrContrib_
bool hasOceanTideOldContrib_
SgMatrix * tabs4PxyInterpolation_
QMap< int, SgVlbiSourceInfo * > sourcesByIdx_
void setDN(double dn)
void setRA(double ra)
@ Attr_NOT_VALID
omit the source;
@ Attr_ESTIMATE_COO
estimate source position;
void setNeed2useAPrioriClocks(bool)
QMap< QString, SgVlbiAuxObservation * > * auxObservationByScanId()
void calcCBEpochs4Export(const QMap< QString, SgVlbiAuxObservation * > &)
void setR(const Sg3dVector &r)
const QString & getTectonicPlateName() const
void setMntType(MountingType m)
@ Attr_NOT_VALID
omit the station;
@ Attr_REFERENCE_CLOCKS
the clocks are the reference ones;
@ Attr_IGNORE_CABLE_CAL
do not apply cable calibration;
@ Attr_USE_LOCAL_ZENITH
use its own setup for the zenith delay parameter;
@ Attr_USE_LOCAL_CLOCKS
use its own setup for the clock parameter;
const SgParameterCfg & getPcClocks() const
int getCdpNumber() const
SgParameterCfg * pcZenith()
void setAPrioriClockTerm_1(double)
void setTectonicPlateName(const QString &name)
SgParameterCfg * pcClocks()
const SgParameterCfg & getPcZenith() const
void setOLoadPhase(int iWave, int iCoord, double phase)
void setAxisOffset(double v)
void setOLoadAmplitude(int iWave, int iCoord, double amplitude)
SgBreakModel & clockBreaks()
double getAPrioriClockTerm_1() const
void setAPrioriClockTerm_0(double)
bool getNeed2useAPrioriClocks() const
double getAPrioriClockTerm_0() const
void setPcClocks(const SgParameterCfg &pc)
void setPcZenith(const SgParameterCfg &pc)
SgDbhDatumDescriptor * d_
SgDbhDatumDescriptor::Type type_