General Purpose Geodetic Library
SgVlbiSessionIoVdbOutput.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 <QtCore/QRegExp>
28 
29 
30 #include <SgVlbiSession.h>
31 
32 #include <SgConstants.h>
33 #include <SgEccRec.h>
34 #include <SgIdentities.h>
35 #include <SgLogger.h>
36 #include <SgVersion.h>
37 #include <SgVgosDb.h>
38 #include <SgVlbiBand.h>
39 #include <SgVlbiObservation.h>
40 
41 
42 
43 // to do: add ACM
44 
45 //
46 extern const QString sCalList[], sFclList[];
47 
48 
49 /*=======================================================================================================
50 *
51 * Auxiliary data structures
52 *
53 *======================================================================================================*/
54 //
56 {
57  QString str("");
58  SgMJD startEpoch(SgMJD::currentMJD());
59  bool isOk(true);
60  int numOfObs=observations_.size();
61  int numOfChans;
62 
63  if (vgosDb->getOperationMode() == SgNetCdf::OM_DRY_RUN)
64  std::cout << "\nRunning in a DRY RUN mode, no files will be created:\n\n";
65 
66 
67  // AGV specific stuff:
68  if (originType_ == OT_AGV)
69  {
70  str = getCorrelatorType();
71  if (str.contains("MK3", Qt::CaseInsensitive))
73  else if (str.contains("MK4", Qt::CaseInsensitive))
75  else if (str.contains("VLBA", Qt::CaseInsensitive))
77  else if (str.contains("CRL", Qt::CaseInsensitive))
79  else if (str.contains("GSI", Qt::CaseInsensitive))
81  else if (str.contains("S2", Qt::CaseInsensitive))
83  else if (str.contains("difx", Qt::CaseInsensitive))
85  else
86  {
89  "::putDataIntoVgosDb(): canot guess correlator type: \"" + str + "\"");
90  };
91  };
92 
93 
94 //if (getOriginType()==OT_MK4 || getOriginType()==OT_KOMB) // new session, no vgosDb tree exists yet
95  if (isAttr(Attr_FF_CREATED)) // new session, no vgosDb tree exists yet
96  {
97  QList<SgVector*> vectors2del;
98  QList<SgMatrix*> matrices2del;
99 
100  QList<SgMJD> epochs4Scans;
101  QList<SgMJD> epochs4Obs;
102  QMap<QString, SgMJD> epochByScanId;
103  QList<QString> stations_1, stations_2, sources;
104  QList<QString> scanNames, scanFullNames, crootFnames;
105  //
107  QMap<QString, SgMatrix*> sbDelaysByBand, grDelaysByBand, phRatesByBand, phasesByBand;
108  QMap<QString, SgMatrix*> grDelaysAltByBand, phRatesAltByBand;
109  QMap<QString, SgMatrix*> phaseCal_1ByBand, phaseCal_2ByBand;
110  QMap<QString, SgVector*> ambigsByBand, refFreqsByBand, correlationByBand, snrByBand;
111  QMap<QString, QVector<char> >
112  qualityCodesByBand;
113  //
114  QMap<QString, int> maxNumOfChanByBand;
115  QMap<QString, QVector<int> >
116  numOfChannelsByBand, dataFlagsByBand;
117  QMap<QString, QVector<QString> >
118  fourfitOutputFNameByBand;
119  QMap<QString, SgVector*> sampleRateByBand;
120  QMap<QString, SgMatrix*> numOfAccPeriodsByChan_USBByBand, numOfAccPeriodsByChan_LSBByBand,
121  refFreqByChanByBand,
122  phCalAmps_1ByChanByBand, phCalAmps_2ByChanByBand,
123  phCalPhss_1ByChanByBand, phCalPhss_2ByChanByBand,
124  phCalFrqs_1ByChanByBand, phCalFrqs_2ByChanByBand,
125  phCalOffs_1ByChanByBand, phCalOffs_2ByChanByBand,
126  numOfSamplesByChan_USBByBand,
127  numOfSamplesByChan_LSBByBand,
128  residualFringeAmplByChanByBand,
129  residualFringePhseByChanByBand;
130  //
131  QList<int> obs2scan, obs2stn_1, obs2stn_2;
132  QList<int> scan2src;
133  // StationCrossRef's clients:
134  QList<int> numScansPerStation;
135  QMap<QString, QList<int> > station2Scan, scan2Station;
136  //
137  QMap<QString, int> stnIdxByName;
138  QMap<QString, int> srcIdxByName;
139  int n;
140  char buff[32];
141  // correlInfo's aux stuff:
142  QMap<QString, QVector<QString> >
143  fourfitErrorCodesByBand, frqGrpCodesByBand,
144  fourfitControlFileByBand, fourfitCommandByBand;
145  QMap<QString, QVector<int> >corelVersionsByBand, startOffsetsByBand, bitsPerSamplesByBand,
146  numLagsByBand;
147  QMap<QString, QVector<double> >
148  apLengthByBand;
149  QMap<QString, QVector< QVector<int> > >
150  fourfitVersionsByBand, dbeditVersionByBand;
151 // QMap<QString, SgVector*> refClkErrByBand, deltaEpochsByBand;
152  QMap<QString, SgVector*> deltaEpochsByBand;
153  QMap<QString, SgMatrix*> urvrsByBand, instrDelaysByBand, starElevByBand, zenithDelaysByBand,
154  searchParamsByBand;
155  QMap<QString, SgMatrix*> mDlysByBand, mAuxByBand;
156  QMap<QString, QVector<QString> >
157  baselineCodesByBand, tapeQualityCodesByBand;
158  QMap<QString, QVector<int> >stopOffsetsByBand, hopsRevisionNumbersByBand;
159  QMap<QString, SgVector*> sbdResidsByBand, rateResidsByBand, effDurationsByBand,
160  startSecondsByBand, stopSecondsByBand, percentOfDiscardsByBand,
161  uniformityFactorsByBand, geocenterPhaseResidsByBand,
162  geocenterPhaseTotalsByBand, geocenterSbDelaysByBand,
163  geocenterGrDelaysByBand, geocenterDelayRatesByBand,
164  probOfFalsesByBand, corrAprioriDelaysByBand, corrAprioriRatesByBand,
165  corrAprioriAccsByBand, incohAmpsByBand, incohAmps2ByBand,
166  delayResidsByBand, phaseCalRates_1ByBand, phaseCalRates_2ByBand;
167  //
168  QMap<QString, QVector<QString> >
169  corrRootFileNamesByBand, tapeIds_1ByBand, tapeIds_2ByBand,
170  channelIdsByBand, polarizationsByBand;
171  QMap<QString, QVector< QVector<int> > >
172  epochsOfCorrelationsByBand, epochsOfCentralsByBand,
173  epochsOfFourfitingsByBand, epochsOfNominalScanTimeByBand,
174  bbcIdxs_1ByBand, bbcIdxs_2ByBand, corelIdxNumbersUsbByBand,
175  corelIdxNumbersLsbByBand, errorRates_1ByBand, errorRates_2ByBand;
176  QMap<QString, SgMatrix*> corrClocksByBand, loFreqs_1ByBand, loFreqs_2ByBand;
177  SgVector *dTec, *dTecStdDev;
178 
179 
180  // create the data structures:
181  for (int iB=0; iB<bands_.size(); iB++)
182  {
183  //
184  const QString& bandKey=bands_.at(iB)->getKey();
185  numOfChans = bands_.at(iB)->getMaxNumOfChannels();
186  sbDelaysByBand[bandKey] = new SgMatrix(numOfObs, 2);
187  grDelaysByBand[bandKey] = new SgMatrix(numOfObs, 2);
188  phRatesByBand [bandKey] = new SgMatrix(numOfObs, 2);
189  grDelaysAltByBand[bandKey] = new SgMatrix(numOfObs, 2);
190  phRatesAltByBand [bandKey] = new SgMatrix(numOfObs, 2);
191 
192  phasesByBand [bandKey] = new SgMatrix(numOfObs, 2);
193  phaseCalRates_1ByBand[bandKey]
194  = new SgVector(numOfObs);
195  phaseCalRates_2ByBand[bandKey]
196  = new SgVector(numOfObs);
197 
198  refFreqsByBand[bandKey] = new SgVector(numOfObs);
199  phaseCal_1ByBand[bandKey]
200  = new SgMatrix(numOfObs, 4);
201  phaseCal_2ByBand[bandKey]
202  = new SgMatrix(numOfObs, 4);
203  ambigsByBand [bandKey] = new SgVector(numOfObs);
204  correlationByBand[bandKey] = new SgVector(numOfObs);
205  snrByBand [bandKey] = new SgVector(numOfObs);
206 
207  qualityCodesByBand [bandKey].resize(numOfObs);
208  numOfChannelsByBand [bandKey].resize(numOfObs);
209  dataFlagsByBand [bandKey].resize(numOfObs);
210  dataFlagsByBand [bandKey].fill(-1);
211  fourfitOutputFNameByBand[bandKey].resize(numOfObs);
212  sampleRateByBand [bandKey] = new SgVector(numOfObs);
213  numOfAccPeriodsByChan_USBByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
214  numOfAccPeriodsByChan_LSBByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
215 
216  phCalAmps_1ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
217  phCalAmps_2ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
218  phCalPhss_1ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
219  phCalPhss_2ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
220  phCalFrqs_1ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
221  phCalFrqs_2ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
222  phCalOffs_1ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
223  phCalOffs_2ByChanByBand[bandKey] = new SgMatrix(numOfObs, numOfChans);
224 
225  refFreqByChanByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
226  numOfSamplesByChan_USBByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
227  numOfSamplesByChan_LSBByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
228  residualFringeAmplByChanByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
229  residualFringePhseByChanByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
230 
231  maxNumOfChanByBand[bandKey] = numOfChans;
232 
233  fourfitErrorCodesByBand [bandKey].resize(numOfObs);
234  frqGrpCodesByBand [bandKey].resize(numOfObs);
235  fourfitControlFileByBand [bandKey].resize(numOfObs);
236  fourfitCommandByBand [bandKey].resize(numOfObs);
237  corelVersionsByBand [bandKey].resize(numOfObs);
238  startOffsetsByBand [bandKey].resize(numOfObs);
239  bitsPerSamplesByBand [bandKey].resize(numOfObs);
240  numLagsByBand [bandKey].resize(numOfObs);
241  apLengthByBand [bandKey].resize(numOfObs);
242  fourfitVersionsByBand [bandKey].resize(numOfObs);
243  dbeditVersionByBand [bandKey].resize(numOfObs);
244  baselineCodesByBand [bandKey].resize(numOfObs);
245  tapeQualityCodesByBand [bandKey].resize(numOfObs);
246  stopOffsetsByBand [bandKey].resize(numOfObs);
247  hopsRevisionNumbersByBand [bandKey].resize(numOfObs);
248 // refClkErrByBand [bandKey] = new SgVector(numOfObs);
249  deltaEpochsByBand [bandKey] = new SgVector(numOfObs);
250  urvrsByBand [bandKey] = new SgMatrix(numOfObs, 2);
251  instrDelaysByBand [bandKey] = new SgMatrix(numOfObs, 2);
252  starElevByBand [bandKey] = new SgMatrix(numOfObs, 2);
253  zenithDelaysByBand [bandKey] = new SgMatrix(numOfObs, 2);
254  searchParamsByBand [bandKey] = new SgMatrix(numOfObs, 6);
255  mDlysByBand [bandKey] = new SgMatrix(numOfObs, 3);
256  mAuxByBand [bandKey] = new SgMatrix(numOfObs, 4);
257  sbdResidsByBand [bandKey] = new SgVector(numOfObs);
258  rateResidsByBand [bandKey] = new SgVector(numOfObs);
259  effDurationsByBand [bandKey] = new SgVector(numOfObs);
260  startSecondsByBand [bandKey] = new SgVector(numOfObs);
261  stopSecondsByBand [bandKey] = new SgVector(numOfObs);
262  percentOfDiscardsByBand [bandKey] = new SgVector(numOfObs);
263  uniformityFactorsByBand [bandKey] = new SgVector(numOfObs);
264  geocenterPhaseResidsByBand[bandKey] = new SgVector(numOfObs);
265  geocenterPhaseTotalsByBand[bandKey] = new SgVector(numOfObs);
266  geocenterSbDelaysByBand [bandKey] = new SgVector(numOfObs);
267  geocenterGrDelaysByBand [bandKey] = new SgVector(numOfObs);
268  geocenterDelayRatesByBand [bandKey] = new SgVector(numOfObs);
269  probOfFalsesByBand [bandKey] = new SgVector(numOfObs);
270  corrAprioriDelaysByBand [bandKey] = new SgVector(numOfObs);
271  corrAprioriRatesByBand [bandKey] = new SgVector(numOfObs);
272  corrAprioriAccsByBand [bandKey] = new SgVector(numOfObs);
273  incohAmpsByBand [bandKey] = new SgVector(numOfObs);
274  incohAmps2ByBand [bandKey] = new SgVector(numOfObs);
275  delayResidsByBand [bandKey] = new SgVector(numOfObs);
276 
277  if (originType_==OT_KOMB)
278  corrRootFileNamesByBand[bandKey].resize(numOfObs);
279 
280  tapeIds_1ByBand [bandKey].resize(numOfObs);
281  tapeIds_2ByBand [bandKey].resize(numOfObs);
282  channelIdsByBand [bandKey].resize(numOfObs);
283  polarizationsByBand [bandKey].resize(numOfObs);
284  epochsOfCorrelationsByBand[bandKey].resize(numOfObs);
285  epochsOfCentralsByBand [bandKey].resize(numOfObs);
286  epochsOfFourfitingsByBand [bandKey].resize(numOfObs);
287  epochsOfNominalScanTimeByBand[bandKey].resize(numOfObs);
288  bbcIdxs_1ByBand [bandKey].resize(numOfObs);
289  bbcIdxs_2ByBand [bandKey].resize(numOfObs);
290  corelIdxNumbersUsbByBand [bandKey].resize(numOfObs);
291  corelIdxNumbersLsbByBand [bandKey].resize(numOfObs);
292  errorRates_1ByBand [bandKey].resize(numOfObs);
293  errorRates_2ByBand [bandKey].resize(numOfObs);
294 
295  corrClocksByBand [bandKey] = new SgMatrix(numOfObs, 4);
296  loFreqs_1ByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
297  loFreqs_2ByBand [bandKey] = new SgMatrix(numOfObs, numOfChans);
298 
299  matrices2del
300  << sbDelaysByBand[bandKey] << grDelaysByBand[bandKey] << phRatesByBand [bandKey]
301  << grDelaysAltByBand[bandKey] << phRatesAltByBand [bandKey]
302  << phasesByBand[bandKey]
303  << phaseCal_1ByBand[bandKey] << phaseCal_2ByBand[bandKey]
304  << numOfAccPeriodsByChan_USBByBand[bandKey]
305  << numOfAccPeriodsByChan_LSBByBand[bandKey]
306  << refFreqByChanByBand[bandKey]
307  << phCalAmps_1ByChanByBand[bandKey]
308  << phCalAmps_2ByChanByBand[bandKey]
309  << phCalPhss_1ByChanByBand[bandKey]
310  << phCalPhss_2ByChanByBand[bandKey]
311  << phCalFrqs_1ByChanByBand[bandKey]
312  << phCalFrqs_2ByChanByBand[bandKey]
313  << phCalOffs_1ByChanByBand[bandKey]
314  << phCalOffs_2ByChanByBand[bandKey]
315  << numOfSamplesByChan_USBByBand[bandKey] << numOfSamplesByChan_LSBByBand[bandKey]
316  << residualFringeAmplByChanByBand[bandKey] << residualFringePhseByChanByBand[bandKey]
317  << urvrsByBand[bandKey] << instrDelaysByBand[bandKey]
318  << starElevByBand[bandKey] << zenithDelaysByBand[bandKey] << searchParamsByBand[bandKey]
319  << mDlysByBand[bandKey] << mAuxByBand[bandKey]
320  << corrClocksByBand[bandKey] << loFreqs_1ByBand[bandKey]
321  << loFreqs_2ByBand[bandKey]
322  ;
323 
324  vectors2del
325  << refFreqsByBand[bandKey] << ambigsByBand[bandKey] << correlationByBand[bandKey]
326  << snrByBand[bandKey] << sampleRateByBand[bandKey]
327  << deltaEpochsByBand[bandKey] << sbdResidsByBand[bandKey] << rateResidsByBand[bandKey]
328  << effDurationsByBand[bandKey] << startSecondsByBand[bandKey] << stopSecondsByBand[bandKey]
329  << percentOfDiscardsByBand[bandKey] << uniformityFactorsByBand[bandKey]
330  << geocenterPhaseResidsByBand[bandKey] << geocenterPhaseTotalsByBand[bandKey]
331  << geocenterSbDelaysByBand[bandKey] << geocenterGrDelaysByBand[bandKey]
332  << geocenterDelayRatesByBand[bandKey] << probOfFalsesByBand[bandKey]
333  << corrAprioriDelaysByBand[bandKey] << corrAprioriRatesByBand[bandKey]
334  << corrAprioriAccsByBand[bandKey] << incohAmpsByBand[bandKey] << incohAmps2ByBand[bandKey]
335  << delayResidsByBand[bandKey] << phaseCalRates_1ByBand[bandKey] << phaseCalRates_2ByBand[bandKey]
336 // << refClkErrByBand[bandKey]
337  ;
338  };
339  dTec = new SgVector(numOfObs);
340  dTecStdDev = new SgVector(numOfObs);
341  vectors2del << dTec << dTecStdDev;
342 
343  bands = bandByKey_.keys();
344 
345  //
346  QMap<QString, bool> stnsPresent;
347  QMap<QString, int> stnsIdxs4scns;
348  QMap<QString, int> idxByScan;
349  n = 1;
350  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
351  {
352  stnIdxByName[it.value()->getKey()] = n++;
353  stnsIdxs4scns[it.value()->getKey()] = 0;
354  };
355  n = 1;
356  for (SourcesByName_it it=sourcesByName_.begin(); it!=sourcesByName_.end(); ++it)
357  srcIdxByName[it.value()->getKey()] = n++;
358 
359  // fill the lists:
360  for (int obsIdx=0; obsIdx<numOfObs; obsIdx++)
361  {
362  int nYear, nMonth, nDay, nHour, nMin;
363  double dSec;
364  SgVlbiObservation *obs=observations_.at(obsIdx);
365  epochs4Obs << *obs;
366  stations_1 << obs->stn_1()->getKey();
367  stations_2 << obs->stn_2()->getKey();
368  sources << obs->src()->getKey();
369  //
370 //4KOMB:
371 //std::cout << " -- - - " << qPrintable(QString("").sprintf("%3d(%3d)", obsIdx, epochByScanId.size()))
372 // << qPrintable(obs->getScanId()) << " : "
373 // << qPrintable(obs->getKey()) << " : " << qPrintable(obs->getScanName())
374 // << qPrintable(obs->toString())
375 // << " \n";
376  if (!epochByScanId.contains(obs->getScanId())) // new scan:
377  {
378  epochByScanId.insert(obs->getScanId(), *obs);
379  scanNames << obs->getScanName();
380  crootFnames << obs->getCorrRootFileName();
381  idxByScan[obs->getScanId()] = idxByScan.size();
382  str.sprintf("%s %s",
383  qPrintable(obs->toString(SgMJD::F_YYYYMMDDHHMMSSSS)), qPrintable(obs->src()->getKey()));
384  if (str.at(10) == ' ')
385  str[10] = '-';
386  scanFullNames << str;
387  scan2src << srcIdxByName[obs->src()->getKey()];
388  //
389  if (stnsPresent.size())
390  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
391  {
392  if (stnsPresent.contains(it.key()))
393  scan2Station[it.key()] << ++stnsIdxs4scns[it.key()];
394  else
395  scan2Station[it.key()] << 0;
396  };
397  stnsPresent.clear();
398  };
399  // crossrefs:
400  obs2scan << epochByScanId.size();
401  obs2stn_1 << stnIdxByName[obs->stn_1()->getKey()];
402  obs2stn_2 << stnIdxByName[obs->stn_2()->getKey()];
403  stnsPresent[obs->stn_1()->getKey()] = true;
404  stnsPresent[obs->stn_2()->getKey()] = true;
405  //
406  //
407  for (int bandIdx=0; bandIdx<bands.size(); bandIdx++)
408  {
409  const QString& bandKey=bands.at(bandIdx);
410  SgVlbiObservable *o=obs->observable(bandKey);
411  numOfChans = maxNumOfChanByBand[bandKey];
412  epochsOfCorrelationsByBand[bandKey][obsIdx].resize(6);
413  epochsOfCentralsByBand[bandKey][obsIdx].resize(6);
414  epochsOfFourfitingsByBand[bandKey][obsIdx].resize(6);
415  epochsOfNominalScanTimeByBand[bandKey][obsIdx].resize(6);
416  bbcIdxs_1ByBand[bandKey][obsIdx].resize(numOfChans);
417  bbcIdxs_2ByBand[bandKey][obsIdx].resize(numOfChans);
418  corelIdxNumbersUsbByBand[bandKey][obsIdx].resize(numOfChans);
419  corelIdxNumbersLsbByBand[bandKey][obsIdx].resize(numOfChans);
420  errorRates_1ByBand[bandKey][obsIdx].resize(numOfChans);
421  errorRates_2ByBand[bandKey][obsIdx].resize(numOfChans);
422  fourfitVersionsByBand [bandKey][obsIdx].resize(2);
423  dbeditVersionByBand [bandKey][obsIdx].resize(3);
424 
425  if (o)
426  {
427  //
428  sbDelaysByBand[bandKey] ->setElement(obsIdx,0, o->sbDelay().getValue());
429  sbDelaysByBand[bandKey] ->setElement(obsIdx,1, o->sbDelay().getSigma());
430  //
431  grDelaysByBand[bandKey] ->setElement(obsIdx,0, o->grDelay().getValue());
432  grDelaysByBand[bandKey] ->setElement(obsIdx,1, o->grDelay().getSigma());
433  phRatesByBand [bandKey] ->setElement(obsIdx,0, o->phDRate().getValue());
434  phRatesByBand [bandKey] ->setElement(obsIdx,1, o->phDRate().getSigma());
435  //
437  {
438  grDelaysAltByBand[bandKey] ->setElement(obsIdx,0, o->grDelay().getAlternateValue());
439  grDelaysAltByBand[bandKey] ->setElement(obsIdx,1, o->grDelay().getSigma());
440  phRatesAltByBand [bandKey] ->setElement(obsIdx,0, o->phDRate().getAlternateValue());
441  phRatesAltByBand [bandKey] ->setElement(obsIdx,1, o->phDRate().getSigma());
442  };
443  //
444  phasesByBand [bandKey] ->setElement(obsIdx,0, o->getTotalPhase());
445  phasesByBand [bandKey] ->setElement(obsIdx,1, o->getSnr()==0.0?1.0:1.0/o->getSnr());
446  refFreqsByBand[bandKey] ->setElement(obsIdx, o->getReferenceFrequency());
447 
448 // effFreqsByBand[bandKey] ->setElement(obsIdx,0, o->grDelay().getEffFreq());
449 // effFreqsByBand[bandKey] ->setElement(obsIdx,1, o->phDelay().getEffFreq());
450 // effFreqsByBand[bandKey] ->setElement(obsIdx,2, o->phDRate().getEffFreq());
451 
452  phaseCal_1ByBand[bandKey]->setElement(obsIdx,0, o->getPhaseCalGrDelays(0));
453  phaseCal_2ByBand[bandKey]->setElement(obsIdx,0, o->getPhaseCalGrDelays(1));
454  phaseCal_1ByBand[bandKey]->setElement(obsIdx,1, o->getPhaseCalRates(0));
455  phaseCal_2ByBand[bandKey]->setElement(obsIdx,1, o->getPhaseCalRates(1));
456 /*
457  evaluateEffectiveFreqs(*o->numOfAccPeriodsByChan_USB(), *o->numOfAccPeriodsByChan_LSB(),
458  *o->refFreqByChan(), *o->fringeAmplitudeByChan(),
459  *o->numOfSamplesByChan_USB(), *o->numOfSamplesByChan_LSB(),
460  o->getSampleRate(), o->getReferenceFrequency(), o->getNumOfChannels(),
461  effFreqEw4GR, effFreqEw4PH, effFreqEw4RT, o->strId(), true);
462  effFreqsEqWgtByBand [bandKey]->setElement(obsIdx,0, effFreqEw4GR);
463  effFreqsEqWgtByBand [bandKey]->setElement(obsIdx,1, effFreqEw4PH);
464  effFreqsEqWgtByBand [bandKey]->setElement(obsIdx,2, effFreqEw4RT);
465 */
466  ambigsByBand [bandKey]->setElement(obsIdx, o->grDelay().getAmbiguitySpacing());
467  sprintf(buff, "%1d", o->getQualityFactor());
468  qualityCodesByBand [bandKey][obsIdx] = buff[0];
469  dataFlagsByBand [bandKey][obsIdx] = 0;
470  correlationByBand [bandKey]->setElement(obsIdx, o->getCorrCoeff());
471  snrByBand [bandKey]->setElement(obsIdx, o->getSnr());
472  numOfChannelsByBand [bandKey][obsIdx] = o->getNumOfChannels();
473  sampleRateByBand [bandKey]->setElement(obsIdx, o->getSampleRate());
474 
475  fourfitOutputFNameByBand[bandKey][obsIdx] = o->getFourfitOutputFName();
476 
477  // epochs:
478  //
479  o->getEpochOfCorrelation().toYMDHMS_tr(nYear, nMonth, nDay, nHour, nMin, dSec);
480  epochsOfCorrelationsByBand[bandKey][obsIdx][0] = nYear;
481  epochsOfCorrelationsByBand[bandKey][obsIdx][1] = nMonth;
482  epochsOfCorrelationsByBand[bandKey][obsIdx][2] = nDay;
483  epochsOfCorrelationsByBand[bandKey][obsIdx][3] = nHour;
484  epochsOfCorrelationsByBand[bandKey][obsIdx][4] = nMin;
485  epochsOfCorrelationsByBand[bandKey][obsIdx][5] = (int)round(dSec);
486  //
487  o->getEpochCentral().toYMDHMS_tr(nYear, nMonth, nDay, nHour, nMin, dSec);
488  epochsOfCentralsByBand[bandKey][obsIdx][0] = nYear;
489  epochsOfCentralsByBand[bandKey][obsIdx][1] = nMonth;
490  epochsOfCentralsByBand[bandKey][obsIdx][2] = nDay;
491  epochsOfCentralsByBand[bandKey][obsIdx][3] = nHour;
492  epochsOfCentralsByBand[bandKey][obsIdx][4] = nMin;
493  epochsOfCentralsByBand[bandKey][obsIdx][5] = (int)round(dSec);
494  //
495  o->getEpochOfFourfitting().toYMDHMS_tr(nYear, nMonth, nDay, nHour, nMin, dSec);
496  epochsOfFourfitingsByBand[bandKey][obsIdx][0] = nYear;
497  epochsOfFourfitingsByBand[bandKey][obsIdx][1] = nMonth;
498  epochsOfFourfitingsByBand[bandKey][obsIdx][2] = nDay;
499  epochsOfFourfitingsByBand[bandKey][obsIdx][3] = nHour;
500  epochsOfFourfitingsByBand[bandKey][obsIdx][4] = nMin;
501  epochsOfFourfitingsByBand[bandKey][obsIdx][5] = (int)round(dSec);
502  //
503  o->getEpochOfScan().toYMDHMS_tr(nYear, nMonth, nDay, nHour, nMin, dSec);
504  epochsOfNominalScanTimeByBand[bandKey][obsIdx][0] = nYear;
505  epochsOfNominalScanTimeByBand[bandKey][obsIdx][1] = nMonth;
506  epochsOfNominalScanTimeByBand[bandKey][obsIdx][2] = nDay;
507  epochsOfNominalScanTimeByBand[bandKey][obsIdx][3] = nHour;
508  epochsOfNominalScanTimeByBand[bandKey][obsIdx][4] = nMin;
509  epochsOfNominalScanTimeByBand[bandKey][obsIdx][5] = (int)round(dSec);
510  //
511  //
512  if (originType_==OT_KOMB)
513  corrRootFileNamesByBand[bandKey][obsIdx] = obs->getCorrRootFileName();
514  //
515  tapeIds_1ByBand[bandKey][obsIdx] = obs->auxObs_1()?obs->auxObs_1()->getTapeId():"";
516  tapeIds_2ByBand[bandKey][obsIdx] = obs->auxObs_2()?obs->auxObs_2()->getTapeId():"";
517  channelIdsByBand[bandKey][obsIdx] = "";
518  polarizationsByBand[bandKey][obsIdx] = "";
519  for (int k=0; k<o->getNumOfChannels(); k++)
520  {
521  refFreqByChanByBand[bandKey]->setElement(obsIdx,k,
522  o->refFreqByChan()->getElement(k));
523  numOfAccPeriodsByChan_USBByBand[bandKey]->setElement(obsIdx,k,
525  numOfAccPeriodsByChan_LSBByBand[bandKey]->setElement(obsIdx,k,
527 
528  phCalAmps_1ByChanByBand[bandKey]->setElement(obsIdx,k,
529  o->phaseCalData_1ByChan()->getElement(0, k));
530  phCalAmps_2ByChanByBand[bandKey]->setElement(obsIdx,k,
531  o->phaseCalData_2ByChan()->getElement(0, k));
532  phCalPhss_1ByChanByBand[bandKey]->setElement(obsIdx,k,
533  o->phaseCalData_1ByChan()->getElement(1, k)*RAD2DEG*100.0);
534  phCalPhss_2ByChanByBand[bandKey]->setElement(obsIdx,k,
535  o->phaseCalData_2ByChan()->getElement(1, k)*RAD2DEG*100.0);
536  phCalFrqs_1ByChanByBand[bandKey]->setElement(obsIdx,k,
537  o->phaseCalData_1ByChan()->getElement(2, k));
538  phCalFrqs_2ByChanByBand[bandKey]->setElement(obsIdx,k,
539  o->phaseCalData_2ByChan()->getElement(2, k));
540  phCalOffs_1ByChanByBand[bandKey]->setElement(obsIdx,k,
541  o->phaseCalData_1ByChan()->getElement(3, k)*RAD2DEG*100.0);
542  phCalOffs_2ByChanByBand[bandKey]->setElement(obsIdx,k,
543  o->phaseCalData_2ByChan()->getElement(3, k)*RAD2DEG*100.0);
544  errorRates_1ByBand[bandKey][obsIdx][k] =
545  o->phaseCalData_1ByChan()->getElement(4, k);
546  errorRates_2ByBand[bandKey][obsIdx][k] =
547  o->phaseCalData_2ByChan()->getElement(4, k);
548 
549  numOfSamplesByChan_USBByBand[bandKey]->setElement(obsIdx,k,
551  numOfSamplesByChan_LSBByBand[bandKey]->setElement(obsIdx,k,
553  residualFringeAmplByChanByBand[bandKey]->setElement(obsIdx,k,
555  residualFringePhseByChanByBand[bandKey]->setElement(obsIdx,k,
557 
558  bbcIdxs_1ByBand[bandKey][obsIdx][k] = o->bbcIdxByChan_1()->at(k);
559  bbcIdxs_2ByBand[bandKey][obsIdx][k] = o->bbcIdxByChan_2()->at(k);
560  corelIdxNumbersUsbByBand[bandKey][obsIdx][k] = o->corelIndexNumUSB()->at(k);
561  corelIdxNumbersLsbByBand[bandKey][obsIdx][k] = o->corelIndexNumLSB()->at(k);
562  loFreqs_1ByBand[bandKey]->setElement(obsIdx,k, o->loFreqByChan_1()->getElement(k));
563  loFreqs_2ByBand[bandKey]->setElement(obsIdx,k, o->loFreqByChan_2()->getElement(k));
564  channelIdsByBand [bandKey][obsIdx] += str.sprintf("%-2c", o->chanIdByChan()->at(k));
565  polarizationsByBand [bandKey][obsIdx] += str.sprintf("%-2c%-2c",
566  o->polarization_1ByChan()->at(k), o->polarization_2ByChan()->at(k));
567  };
568  //
569  fourfitErrorCodesByBand [bandKey][obsIdx].sprintf("%-2s", qPrintable(o->getErrorCode()));
570  frqGrpCodesByBand [bandKey][obsIdx].sprintf("%-2s", qPrintable(bandKey));
571  fourfitControlFileByBand [bandKey][obsIdx].sprintf("%s",
572  qPrintable(o->getFourfitControlFile()));
573  fourfitCommandByBand [bandKey][obsIdx].sprintf("%s",
574  qPrintable(o->getFourfitCommandOverride()));
575  baselineCodesByBand [bandKey][obsIdx].sprintf("%c%c",
576  obs->stn_1()->getCid(), obs->stn_2()->getCid());
577  tapeQualityCodesByBand [bandKey][obsIdx].sprintf("%-6s", qPrintable(o->getTapeQualityCode()));
578  corelVersionsByBand [bandKey][obsIdx] = -1; // mimic dbedit
579  startOffsetsByBand [bandKey][obsIdx] = o->getStartOffset();
580  bitsPerSamplesByBand [bandKey][obsIdx] = o->getBitsPerSample();
581  numLagsByBand [bandKey][obsIdx] = o->getNlags();
582  apLengthByBand [bandKey][obsIdx] = obs->getApLength();
583  stopOffsetsByBand [bandKey][obsIdx] = o->getStopOffset();
584  hopsRevisionNumbersByBand [bandKey][obsIdx] = o->getHopsRevisionNumber();
585  fourfitVersionsByBand [bandKey][obsIdx][0] = o->getFourfitVersion(0);
586  fourfitVersionsByBand [bandKey][obsIdx][1] = o->getFourfitVersion(1);
587  dbeditVersionByBand [bandKey][obsIdx][0] = 2007;
588  dbeditVersionByBand [bandKey][obsIdx][1] = 10;
589  dbeditVersionByBand [bandKey][obsIdx][2] = 27;
590 // refClkErrByBand [bandKey]->setElement(obsIdx, 0.0); // what is it?
591  deltaEpochsByBand [bandKey]->setElement(obsIdx, o->getCentrOffset());
592  //
593  urvrsByBand [bandKey]->setElement(obsIdx,0, o->getUrVr(0));
594  urvrsByBand [bandKey]->setElement(obsIdx,1, o->getUrVr(1));
595  instrDelaysByBand [bandKey]->setElement(obsIdx,0, o->getInstrDelay(0));
596  instrDelaysByBand [bandKey]->setElement(obsIdx,1, o->getInstrDelay(1));
597  starElevByBand [bandKey]->setElement(obsIdx,0, o->getCorrelStarElev_1()*RAD2DEG);
598  starElevByBand [bandKey]->setElement(obsIdx,1, o->getCorrelStarElev_2()*RAD2DEG);
599  zenithDelaysByBand [bandKey]->setElement(obsIdx,0, o->getCorrelZdelay_1());
600  zenithDelaysByBand [bandKey]->setElement(obsIdx,1, o->getCorrelZdelay_2());
601  //
602  for (int j=0; j<6; j++)
603  searchParamsByBand [bandKey]->setElement(obsIdx,j, o->getFourfitSearchParameters(j));
604 
605  sbdResidsByBand [bandKey]->setElement(obsIdx, o->sbDelay().getResidualFringeFitting());
606  rateResidsByBand [bandKey]->setElement(obsIdx, o->phDRate().getResidualFringeFitting());
607  effDurationsByBand [bandKey]->setElement(obsIdx, o->getEffIntegrationTime());
608 
609  o->getTstart().toYMDHMS_tr(nYear, nMonth, nDay, nHour, nMin, dSec);
610  startSecondsByBand [bandKey]->setElement(obsIdx, 60.0*nMin + dSec);
611  o->getTstop().toYMDHMS_tr(nYear, nMonth, nDay, nHour, nMin, dSec);
612  stopSecondsByBand [bandKey]->setElement(obsIdx, 60.0*nMin + dSec);
613  percentOfDiscardsByBand [bandKey]->setElement(obsIdx, o->getDiscardRatio());
614  uniformityFactorsByBand [bandKey]->setElement(obsIdx, o->getAcceptedRatio());
615  geocenterPhaseResidsByBand[bandKey]->setElement(obsIdx, o->getGeocenterResidPhase()*RAD2DEG);
616  geocenterPhaseTotalsByBand[bandKey]->setElement(obsIdx, o->getGeocenterTotalPhase()*RAD2DEG);
617  geocenterSbDelaysByBand [bandKey]->setElement(obsIdx, o->sbDelay().getGeocenterValue());
618  geocenterGrDelaysByBand [bandKey]->setElement(obsIdx, o->grDelay().getGeocenterValue());
619  geocenterDelayRatesByBand [bandKey]->setElement(obsIdx, o->phDRate().getGeocenterValue());
620  probOfFalsesByBand [bandKey]->setElement(obsIdx, o->getProbabOfFalseDetection());
621  corrAprioriDelaysByBand [bandKey]->setElement(obsIdx, o->getAprioriDra(0));
622  corrAprioriRatesByBand [bandKey]->setElement(obsIdx, o->getAprioriDra(1));
623  corrAprioriAccsByBand [bandKey]->setElement(obsIdx, o->getAprioriDra(2));
624  incohAmpsByBand [bandKey]->setElement(obsIdx, o->getIncohChanAddAmp());
625  incohAmps2ByBand [bandKey]->setElement(obsIdx, o->getIncohSegmAddAmp());
626  delayResidsByBand [bandKey]->setElement(obsIdx, o->grDelay().getResidualFringeFitting());
627  phaseCalRates_1ByBand [bandKey]->setElement(obsIdx, o->getPhaseCalRates(0));
628  phaseCalRates_2ByBand [bandKey]->setElement(obsIdx, o->getPhaseCalRates(1));
629  corrClocksByBand [bandKey]->setElement(obsIdx,0, o->getCorrClocks(0, 0));
630  corrClocksByBand [bandKey]->setElement(obsIdx,1, o->getCorrClocks(0, 1));
631  corrClocksByBand [bandKey]->setElement(obsIdx,2, o->getCorrClocks(1, 0));
632  corrClocksByBand [bandKey]->setElement(obsIdx,3, o->getCorrClocks(1, 1));
633 
634  mDlysByBand[bandKey]->setElement(obsIdx,0, o->vDlys()->getElement(0));
635  mDlysByBand[bandKey]->setElement(obsIdx,1, o->vDlys()->getElement(1));
636  mDlysByBand[bandKey]->setElement(obsIdx,2, o->vDlys()->getElement(2));
637  mAuxByBand[bandKey]->setElement(obsIdx,0, o->vAuxData()->getElement(0));
638  mAuxByBand[bandKey]->setElement(obsIdx,1, o->vAuxData()->getElement(1)*RAD2DEG);
639  mAuxByBand[bandKey]->setElement(obsIdx,2, o->vAuxData()->getElement(2));
640  mAuxByBand[bandKey]->setElement(obsIdx,3, o->vAuxData()->getElement(3));
641  };
642  };
643  dTec ->setElement(obsIdx, obs->getDTec());
644  dTecStdDev ->setElement(obsIdx, obs->getDTecStdDev());
645  };
646  //
647  //
648  //
649  if (originType_==OT_AGV && primaryBand_->history().size())
650  vgosDb->setCurrentVersion(primaryBand_->history().last()->getVersion());
651  //
652  //
653  if (stnsPresent.size())
654  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
655  {
656  if (stnsPresent.contains(it.key()))
657  scan2Station[it.key()] << ++stnsIdxs4scns[it.key()];
658  else
659  scan2Station[it.key()] << 0;
660  };
661  stnsPresent.clear();
662  stnsIdxs4scns.clear();
663  //
664  epochs4Scans = epochByScanId.values();
665  // first time:
666  if ( !(isOk=vgosDb->storeEpochs4Scans(epochs4Scans)) )
667  return isOk;
668 
669  isOk = isOk && vgosDb->storeScanTimeMjd(epochs4Scans);
670  isOk = isOk && vgosDb->storeEpochs4Obs(epochs4Obs);
671  isOk = isOk && vgosDb->storeObsObjectNames(stations_1, stations_2, sources);
672 
673  // create head:
674  stations_1.clear();
675  sources.clear();
676  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
677  {
678  SgVlbiStationInfo *stn=it.value();
679  stations_1 << stn->getKey();
680  numScansPerStation << stn->auxObservationByScanId()->size();
681  for (QMap<QString, SgVlbiAuxObservation*>::iterator jt=stn->auxObservationByScanId()->begin();
682  jt!=stn->auxObservationByScanId()->end(); ++jt)
683  station2Scan[stn->getKey()] << idxByScan[jt.key()];
684  };
685  // fill zeros:
686  int maxSize=0;
687  for (QMap<QString, QList<int> >::iterator it=station2Scan.begin(); it!=station2Scan.end(); ++it)
688  if (maxSize<it.value().size())
689  maxSize=it.value().size();
690  for (QMap<QString, QList<int> >::iterator it=station2Scan.begin(); it!=station2Scan.end(); ++it)
691  if (it.value().size()<maxSize)
692  for (int i=it.value().size(); i<maxSize; i++)
693  it.value() << 0;
694  //
695  for (SourcesByName_it it=sourcesByName_.begin(); it!=sourcesByName_.end(); ++it)
696  sources << it.value()->getKey();
697 
700  stations_1, sources, tStart_, tFinis_, (int)cppsSoft_);
701 
702  //
703  // scan:
704  isOk = isOk && vgosDb->storeScanName(scanNames, scanFullNames);
706  isOk = isOk && vgosDb->storeScanCrootFname(crootFnames);
707  //
708  // crossRefs:
709  isOk = isOk && vgosDb->storeObsCrossRefs(obs2scan, obs2stn_1, obs2stn_2);
710  isOk = isOk && vgosDb->storeSourceCrossRefs(sources, scan2src);
711  isOk = isOk && vgosDb->storeStationCrossRefs(numScansPerStation, stations_1, station2Scan, scan2Station);
712  //
713  // output of band-dependent values:
714  for (int iB=0; iB<bands_.size(); iB++)
715  {
716  //
717  const QString& bandKey=bands_.at(iB)->getKey();
718  //
719  vgosDb->setNumOfChannels(maxNumOfChanByBand[bandKey]);
720  //
721  // obs:
722  isOk = isOk && vgosDb->storeObsSingleBandDelays(bandKey, sbDelaysByBand[bandKey]);
723  //
724  // GSI input: original and corrected gr.delays and rates:
726  {
727  isOk = isOk && vgosDb->storeObsGroupDelays(bandKey, grDelaysAltByBand[bandKey], "Original");
728  isOk = isOk && vgosDb->storeObsRates(bandKey, phRatesAltByBand[bandKey], "Original");
729  };
730  //
731  isOk = isOk && vgosDb->storeObsGroupDelays(bandKey, grDelaysByBand[bandKey], "");
732  isOk = isOk && vgosDb->storeObsRates(bandKey, phRatesByBand[bandKey], "");
733 
734  isOk = isOk && vgosDb->storeObsPhase(bandKey, phasesByBand[bandKey]);
735  isOk = isOk && vgosDb->storeObsRefFreqs(bandKey, refFreqsByBand[bandKey]);
736 // isOk = isOk && vgosDb->storeObsEffFreqs(bandKey, effFreqsByBand[bandKey]);
737 // isOk = isOk && vgosDb->storeObsEffFreqs(bandKey, effFreqsEqWgtByBand[bandKey], true);
738  isOk = isOk && vgosDb->storeObsCalUnphase(bandKey, phaseCal_1ByBand[bandKey], phaseCal_2ByBand[bandKey]);
739  isOk = isOk && vgosDb->storeObsAmbigSpacing(bandKey, ambigsByBand[bandKey]);
740  isOk = isOk && vgosDb->storeObsQualityCodes(bandKey, qualityCodesByBand[bandKey]);
741  isOk = isOk && vgosDb->storeObsDataFlag(bandKey, dataFlagsByBand[bandKey]);
742  isOk = isOk && vgosDb->storeObsCorrelation(bandKey, correlationByBand[bandKey]);
743  isOk = isOk && vgosDb->storeObsSNR(bandKey, snrByBand[bandKey]);
744  //
745  //
746  isOk = isOk && vgosDb->storeObsChannelInfo(bandKey, originType_,
747  channelIdsByBand[bandKey],
748  polarizationsByBand[bandKey],
749  numOfChannelsByBand[bandKey],
750  bitsPerSamplesByBand[bandKey],
751  errorRates_1ByBand[bandKey],
752  errorRates_2ByBand[bandKey],
753  bbcIdxs_1ByBand[bandKey],
754  bbcIdxs_2ByBand[bandKey],
755  corelIdxNumbersUsbByBand[bandKey],
756  corelIdxNumbersLsbByBand[bandKey],
757  sampleRateByBand[bandKey],
758  residualFringeAmplByChanByBand[bandKey],
759  residualFringePhseByChanByBand[bandKey],
760  refFreqByChanByBand[bandKey],
761  numOfSamplesByChan_USBByBand[bandKey],
762  numOfSamplesByChan_LSBByBand[bandKey],
763  numOfAccPeriodsByChan_USBByBand[bandKey],
764  numOfAccPeriodsByChan_LSBByBand[bandKey],
765  loFreqs_1ByBand[bandKey],
766  loFreqs_2ByBand[bandKey]);
767  //
768  isOk = isOk && vgosDb->storeObsPhaseCalInfo(bandKey, originType_,
769  phCalFrqs_1ByChanByBand[bandKey],
770  phCalAmps_1ByChanByBand[bandKey],
771  phCalPhss_1ByChanByBand[bandKey],
772  phCalOffs_1ByChanByBand[bandKey],
773  phaseCalRates_1ByBand[bandKey],
774  phCalFrqs_2ByChanByBand[bandKey],
775  phCalAmps_2ByChanByBand[bandKey],
776  phCalPhss_2ByChanByBand[bandKey],
777  phCalOffs_2ByChanByBand[bandKey],
778  phaseCalRates_2ByBand[bandKey]);
779  //
780  isOk = isOk && vgosDb->storeObsCorrelatorInfo(bandKey, originType_,
781  fourfitOutputFNameByBand[bandKey],
782  fourfitErrorCodesByBand[bandKey],
783  frqGrpCodesByBand[bandKey],
784  corelVersionsByBand[bandKey],
785  startOffsetsByBand[bandKey],
786  fourfitVersionsByBand[bandKey],
787  dbeditVersionByBand[bandKey],
788  deltaEpochsByBand[bandKey],
789  urvrsByBand[bandKey],
790  instrDelaysByBand[bandKey],
791  starElevByBand[bandKey],
792  zenithDelaysByBand[bandKey],
793  searchParamsByBand[bandKey],
794  baselineCodesByBand[bandKey],
795  tapeQualityCodesByBand[bandKey],
796  stopOffsetsByBand[bandKey],
797  hopsRevisionNumbersByBand[bandKey],
798  sampleRateByBand[bandKey],
799  sbdResidsByBand[bandKey],
800  rateResidsByBand[bandKey],
801  effDurationsByBand[bandKey],
802  startSecondsByBand[bandKey],
803  stopSecondsByBand[bandKey],
804  percentOfDiscardsByBand[bandKey],
805  uniformityFactorsByBand[bandKey],
806  geocenterPhaseResidsByBand[bandKey],
807  geocenterPhaseTotalsByBand[bandKey],
808  geocenterSbDelaysByBand[bandKey],
809  geocenterGrDelaysByBand[bandKey],
810  geocenterDelayRatesByBand[bandKey],
811  probOfFalsesByBand[bandKey],
812  corrAprioriDelaysByBand[bandKey],
813  corrAprioriRatesByBand[bandKey],
814  corrAprioriAccsByBand[bandKey],
815  incohAmpsByBand[bandKey],
816  incohAmps2ByBand[bandKey],
817  delayResidsByBand[bandKey],
818  corrRootFileNamesByBand[bandKey],
819  tapeIds_1ByBand[bandKey],
820  tapeIds_2ByBand[bandKey],
821  epochsOfCorrelationsByBand[bandKey],
822  epochsOfCentralsByBand[bandKey],
823  epochsOfFourfitingsByBand[bandKey],
824  epochsOfNominalScanTimeByBand[bandKey],
825  corrClocksByBand[bandKey],
826  mDlysByBand[bandKey],
827  mAuxByBand[bandKey]);
828  //
829 /*
830 // store data for each band:
831  if (originType_ == OT_MK4) // right now nothing to output for KOMB
832  isOk = isOk && vgosDb->storeMiscFourFit(bandKey, originType_,
833  fourfitControlFileByBand[bandKey], fourfitCommandByBand[bandKey],
834  numLagsByBand[bandKey], apLengthByBand[bandKey]);
835 */
836 // store data only from the primary:
837 /* */
838  if ((originType_==OT_MK4 || originType_==OT_AGV) && // right now nothing to output for KOMB
839  primaryBand_ &&
840  primaryBand_->getKey() == bandKey)
841  isOk = isOk && vgosDb->storeMiscFourFit("", originType_,
842  fourfitControlFileByBand[bandKey], fourfitCommandByBand[bandKey],
843  numLagsByBand[bandKey], apLengthByBand[bandKey]);
844  }; // end of band iteration
845  //
846  // VGOS:
847  if (isAttr(Attr_HAS_DTEC))
848  isOk = isOk && vgosDb->storeObsDtec(dTec, dTecStdDev);
849  //
850  //
851  if (originType_==OT_MK4 ||
853  isOk = isOk && vgosDb->saveForeignHistory(primaryBand_->history(),
854  "Correlator", primaryBand_->history().size()?primaryBand_->history().last()->getEpoch():tZero,
855  "correlator operator", "History", name_, "1");
856  else if (originType_==OT_AGV)
857  isOk = isOk && vgosDb->saveForeignHistory(primaryBand_->history(),
859  primaryBand_->history().size()?primaryBand_->history().last()->getEpoch():tZero,
860  vgosDb->getCurrentIdentities()->getUserName() + ", " +
861  vgosDb->getCurrentIdentities()->getAcFullName(),
862  "History", name_,
864 
865  // contemporaryHistory_.addHistoryRecord("Data were extracted from the correlator output.");
866 
867  //
868  // clear resources:
869  qualityCodesByBand.clear();
870  dataFlagsByBand.clear();
871 
872  srcIdxByName.clear();
873  stnIdxByName.clear();
874  scan2src.clear();
875  obs2scan.clear();
876  obs2stn_1.clear();
877  obs2stn_2.clear();
878  //
879  // obs per band:
880  // clear temporary storages:
881  for (int i=0; i<vectors2del.size(); i++)
882  if (vectors2del.at(i))
883  {
884  delete vectors2del[i];
885  vectors2del[i] = NULL;
886  };
887  for (int i=0; i<matrices2del.size(); i++)
888  if (matrices2del.at(i))
889  {
890  delete matrices2del[i];
891  matrices2del[i] = NULL;
892  };
893  //
894  sbDelaysByBand.clear();
895  grDelaysByBand.clear();
896  phRatesByBand.clear();
897  phasesByBand.clear();
898  ambigsByBand.clear();
899  refFreqsByBand.clear();
900 // effFreqsByBand.clear();
901 // effFreqsEqWgtByBand.clear();
902  phaseCal_1ByBand.clear();
903  phaseCal_2ByBand.clear();
904  correlationByBand.clear();
905  snrByBand.clear();
906  //
907  //
908  bands.clear();
909  scanNames.clear();
910  scanFullNames.clear();
911  stations_1.clear();
912  stations_2.clear();
913  sources.clear();
914  epochs4Scans.clear();
915  epochs4Obs.clear();
916  epochByScanId.clear();
917  numScansPerStation.clear();
918  //
919  for (QMap<QString, QList<int> >::iterator it=station2Scan.begin(); it!=station2Scan.end(); ++it)
920  it.value().clear();
921  for (QMap<QString, QList<int> >::iterator it=scan2Station.begin(); it!=scan2Station.end(); ++it)
922  it.value().clear();
923  station2Scan.clear();
924  scan2Station.clear();
925 
926  //
927  //
928  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
929  {
930  SgVlbiStationInfo *stn=it.value();
931  const QString stnName(stn->getKey());
932  QList<SgMJD> stnEpochs;
933  SgVector *refClockOffset;
934  int idx;
935 
936  refClockOffset = new SgVector(stn->auxObservationByScanId()->size());
937  idx = 0;
938  for (QMap<QString, SgVlbiAuxObservation*>::iterator jt=stn->auxObservationByScanId()->begin();
939  jt!=stn->auxObservationByScanId()->end(); ++jt)
940  {
941  SgVlbiAuxObservation *auxObs=jt.value();
942  stnEpochs << *auxObs;
943  refClockOffset->setElement(idx, auxObs->getRefClockOffset());
944  idx++;
945  };
946  isOk = isOk && vgosDb->storeStationEpochs(stnName, stnEpochs);
947  // KOMB:
948  if (originType_ == OT_KOMB)
949  isOk = isOk && vgosDb->storeStationRefClockOffset(stnName, refClockOffset);
950  //
951  stnEpochs.clear();
952  delete refClockOffset;
953  };
954  };
955  //-- end of if (isAttr(Attr_FF_CREATED)) // it was a new session, no vgosDb tree existed yet
956  //
957 
958  //
959  // special case to ressurect some databases:
960  bool isSpecialCase;
961  isSpecialCase = false;
962  //isSpecialCase = true;
963  if (isSpecialCase)
964  {
965  QList<QString> sources;
966  QMap<QString, SgMJD> ebsi;
967  QMap<QString, int> srcIdxByName;
968  QList<int> scan2src;
969  int n=1;
970  for (SourcesByName_it it=sourcesByName_.begin(); it!=sourcesByName_.end(); ++it)
971  {
972  sources << it.value()->getKey();
973  srcIdxByName[it.value()->getKey()] = n++;
974  };
975  for (int obsIdx=0; obsIdx<numOfObs; obsIdx++)
976  {
977  SgVlbiObservation *obs=observations_.at(obsIdx);
978  if (!ebsi.contains(obs->getScanId())) // new scan:
979  {
980  ebsi.insert(obs->getScanId(), *obs);
981  scan2src << srcIdxByName[obs->src()->getKey()];
982  };
983  };
984  isOk = isOk && vgosDb->storeSourceCrossRefs(sources, scan2src);
985  srcIdxByName.clear();
986  scan2src.clear();
987  ebsi.clear();
988  };
989  // EoSC
990  //
991 
992 
993  //
994  if (config_)
995  {
996  if (originType_ == OT_AGV)
997  {
998  const SgIdentities *ids=vgosDb->getCurrentIdentities();
999  contemporaryHistory_.addHistoryRecord("Data were converted from ASCII vgosDa format to "
1000  "vgosDb tree by " + ids->getUserName() + " at " + ids->getAcFullName() + ". Contact info: <" +
1001  ids->getUserEmailAddress() + ">", SgMJD::currentMJD().toUtc());
1002  }
1003  else
1005  };
1006  //
1007  if (vgosDb->getHave2redoLeapSecond())
1008  isOk = isOk && vgosDb->storeLeapSecond(getLeapSeconds());
1009 
1010 
1011  //
1012  //
1013  // theoreticals and partials:
1015  {
1016 // QString kind4Ephemeris("DE405JPL");
1017  QString kind4Ephemeris("DE421JPL");
1018  QString kind4Nutation ("IAU2006");
1019  QString kind4HiFreqLibration("IERS2010");
1020  QString kind4HiFreqErp ("IERS2003");
1021  QString kind4EarthTide ("IERS2003");
1022  QString kind4PoleTide ("IERS2003");
1023 
1024  QString kind4PoleTidePart("IERS2006");
1025 
1026  QMap<QString, SgMJD> epochByScanId;
1027  int scanIdx, numOfScans;
1028  //
1029  // calculate number of scans:
1030  for (int idx=0; idx<numOfObs; idx++)
1031  {
1032  SgVlbiObservation *obs=observations_.at(idx);
1033  if (!epochByScanId.contains(obs->getScanId())) // new scan
1034  epochByScanId.insert(obs->getScanId(), *obs);
1035  };
1036  numOfScans = epochByScanId.size();
1037  epochByScanId.clear();
1039  "::putDataIntoVgosDb(): counted " + QString("").setNum(numOfScans) +
1040  " scans for the session " + name_);
1041 
1042  //
1043  // obs (theoreticals and partials):
1044  //
1045  SgVector *vCalcDelay, *vCalcRate, *vFractC;
1046 
1047  SgMatrix *cEarthTide, *cOceanTide, *cOceanTideOld;
1048  SgMatrix *cOceanPoleTide, *cPoleTide, *cPoleTideOld, *cTiltRmvr;
1049  SgMatrix *mHiFyUt1, *mHiFyPxy, *mLibrUt1, *mLibrPxy, *mPx, *mPy;
1050  SgMatrix *cBend, *cBendSun, *cBendSunHigher;
1051  SgMatrix *mPlxRev;
1052  SgMatrix *t2c_val, *t2c_rat, *t2c_acc;
1053 
1054  SgMatrix *partBend;
1055  SgMatrix *dV_dPx, *dV_dPy, *dV_dUT1;
1056  SgMatrix *dV_dCipX, *dV_dCipY;
1057  SgMatrix *dV_dRA, *dV_dDN;
1058  SgMatrix *dDel_dR_1, *dRat_dR_1;
1059  SgMatrix *dV_dGamma, *dV_dParallax;
1060  SgMatrix *dV_dPtdX, *dV_dPtdY;
1061  //
1062  // for scan dependent stuff:
1063  SgMatrix *rSun, *rMoon, *rEarth, *vSun, *vMoon, *vEarth, *aEarth;
1064  SgMatrix *pPsiEpsWahr, *pPsiEpsWahr_rates, *pPsiEps, *pPsiEps_rates;
1065  SgMatrix *pXys, *pXys_rates, *pmXy;
1066  SgVector *ut1_tai;
1067 
1068 
1069  //
1070  vCalcDelay = new SgVector(numOfObs);
1071  vCalcRate = new SgVector(numOfObs);
1072  vFractC = new SgVector(numOfObs);
1073 
1074  cEarthTide = new SgMatrix(numOfObs, 2);
1075 // cFeedCorr = new SgMatrix(numOfObs, 2);
1076  cOceanTide = new SgMatrix(numOfObs, 2);
1077  cOceanTideOld = new SgMatrix(numOfObs, 2);
1078  cOceanPoleTide= new SgMatrix(numOfObs, 2);
1079  cPoleTide = new SgMatrix(numOfObs, 2);
1080  cPoleTideOld = new SgMatrix(numOfObs, 2);
1081  cTiltRmvr = new SgMatrix(numOfObs, 2);
1082  mHiFyUt1 = new SgMatrix(numOfObs, 2);
1083  mHiFyPxy = new SgMatrix(numOfObs, 2);
1084  mLibrUt1 = new SgMatrix(numOfObs, 2);
1085  mLibrPxy = new SgMatrix(numOfObs, 2);
1086  mPx = new SgMatrix(numOfObs, 2);
1087  mPy = new SgMatrix(numOfObs, 2);
1088  cBend = new SgMatrix(numOfObs, 2);
1089  cBendSun = new SgMatrix(numOfObs, 2);
1090  cBendSunHigher= new SgMatrix(numOfObs, 2);
1091 
1092  partBend = new SgMatrix(numOfObs, 2);
1093  dV_dPx = new SgMatrix(numOfObs, 2);
1094  dV_dPy = new SgMatrix(numOfObs, 2);
1095  dV_dUT1 = new SgMatrix(numOfObs, 4);
1096  dV_dCipX = new SgMatrix(numOfObs, 2);
1097  dV_dCipY = new SgMatrix(numOfObs, 2);
1098  dV_dRA = new SgMatrix(numOfObs, 2);
1099  dV_dDN = new SgMatrix(numOfObs, 2);
1100  dDel_dR_1 = new SgMatrix(numOfObs, 3);
1101  dRat_dR_1 = new SgMatrix(numOfObs, 3);
1102  dV_dGamma = new SgMatrix(numOfObs, 2);
1103  dV_dParallax = new SgMatrix(numOfObs, 2);
1104  dV_dPtdX = new SgMatrix(numOfObs, 2);
1105  dV_dPtdY = new SgMatrix(numOfObs, 2);
1106  mPlxRev = new SgMatrix(numOfObs, 2);
1107  rSun = new SgMatrix(numOfScans, 3);
1108  rMoon = new SgMatrix(numOfScans, 3);
1109  rEarth = new SgMatrix(numOfScans, 3);
1110  vSun = new SgMatrix(numOfScans, 3);
1111  vMoon = new SgMatrix(numOfScans, 3);
1112  vEarth = new SgMatrix(numOfScans, 3);
1113  aEarth = new SgMatrix(numOfScans, 3);
1114 
1115  pPsiEpsWahr = new SgMatrix(numOfScans, 2);
1116  pPsiEpsWahr_rates
1117  = new SgMatrix(numOfScans, 2);
1118  pPsiEps = new SgMatrix(numOfScans, 2);
1119  pPsiEps_rates = new SgMatrix(numOfScans, 2);
1120  pXys = new SgMatrix(numOfScans, 3);
1121  pXys_rates = new SgMatrix(numOfScans, 3);
1122 
1123  t2c_val = new SgMatrix(numOfScans, 9);
1124  t2c_rat = new SgMatrix(numOfScans, 9);
1125  t2c_acc = new SgMatrix(numOfScans, 9);
1126  pmXy = new SgMatrix(numOfScans, 2);
1127  ut1_tai = new SgVector(numOfScans);
1128 
1129  scanIdx = 0;
1130  for (int obsIdx=0; obsIdx<numOfObs; obsIdx++)
1131  {
1132  SgVlbiObservation *obs=observations_.at(obsIdx);
1133  int idx=obs->getMediaIdx();
1134 
1135  vCalcDelay ->setElement(idx, obs->getCalcConsensusDelay());
1136  vCalcRate ->setElement(idx, obs->getCalcConsensusRate());
1137  vFractC ->setElement(idx, obs->getFractC());
1138  // contributions:
1139  cEarthTide ->setElement(idx, 0, obs->getCalcEarthTideDelay());
1140  cEarthTide ->setElement(idx, 1, obs->getCalcEarthTideRate());
1141 // cFeedCorr ->setElement(idx, 0, obs->getCalcFeedCorrDelay());
1142 // cFeedCorr ->setElement(idx, 1, obs->getCalcFeedCorrRate());
1143  cOceanTide ->setElement(idx, 0, obs->getCalcOceanTideDelay());
1144  cOceanTide ->setElement(idx, 1, obs->getCalcOceanTideRate());
1145  cOceanTideOld ->setElement(idx, 0, obs->getCalcOceanTideOldDelay());
1146  cOceanTideOld ->setElement(idx, 1, obs->getCalcOceanTideOldRate());
1147  cOceanPoleTide->setElement(idx, 0, obs->getCalcOceanPoleTideLdDelay());
1148  cOceanPoleTide->setElement(idx, 1, obs->getCalcOceanPoleTideLdRate());
1149  cPoleTide ->setElement(idx, 0, obs->getCalcPoleTideDelay());
1150  cPoleTide ->setElement(idx, 1, obs->getCalcPoleTideRate());
1151  cPoleTideOld ->setElement(idx, 0, obs->getCalcPoleTideOldDelay());
1152  cPoleTideOld ->setElement(idx, 1, obs->getCalcPoleTideOldRate());
1153  cTiltRmvr ->setElement(idx, 0, obs->getCalcTiltRemvrDelay());
1154  cTiltRmvr ->setElement(idx, 1, obs->getCalcTiltRemvrRate());
1155  mHiFyUt1 ->setElement(idx, 0, obs->getCalcHiFyUt1Delay());
1156  mHiFyUt1 ->setElement(idx, 1, obs->getCalcHiFyUt1Rate());
1157  mHiFyPxy ->setElement(idx, 0, obs->getCalcHiFyPxyDelay());
1158  mHiFyPxy ->setElement(idx, 1, obs->getCalcHiFyPxyRate());
1159  mLibrUt1 ->setElement(idx, 0, obs->getCalcHiFyUt1LibrationDelay());
1160  mLibrUt1 ->setElement(idx, 1, obs->getCalcHiFyUt1LibrationRate());
1161  mLibrPxy ->setElement(idx, 0, obs->getCalcHiFyPxyLibrationDelay());
1162  mLibrPxy ->setElement(idx, 1, obs->getCalcHiFyPxyLibrationRate());
1163  mPx ->setElement(idx, 0, obs->getCalcPxDelay());
1164  mPx ->setElement(idx, 1, obs->getCalcPxRate());
1165  mPy ->setElement(idx, 0, obs->getCalcPyDelay());
1166  mPy ->setElement(idx, 1, obs->getCalcPyRate());
1167  cBend ->setElement(idx, 0, obs->getCalcConsBendingDelay());
1168  cBend ->setElement(idx, 1, obs->getCalcConsBendingRate());
1169  cBendSun ->setElement(idx, 0, obs->getCalcConsBendingSunDelay());
1170  cBendSun ->setElement(idx, 1, obs->getCalcConsBendingSunRate());
1171  cBendSunHigher->setElement(idx, 0, obs->getCalcConsBendingSunHigherDelay());
1172  cBendSunHigher->setElement(idx, 1, obs->getCalcConsBendingSunHigherRate());
1173  //
1174  mPlxRev ->setElement(idx, 0, obs->getDdel_dParallaxRev());
1175  mPlxRev ->setElement(idx, 1, obs->getDrat_dParallaxRev());
1176  //
1177  // partials:
1178  partBend ->setElement(idx, 0, obs->getDdel_dBend());
1179  partBend ->setElement(idx, 1, obs->getDrat_dBend());
1180  dV_dPx ->setElement(idx, 0, obs->getDdel_dPx());
1181  dV_dPx ->setElement(idx, 1, obs->getDrat_dPx());
1182  dV_dPy ->setElement(idx, 0, obs->getDdel_dPy());
1183  dV_dPy ->setElement(idx, 1, obs->getDrat_dPy());
1184 // dV_dUT1 ->setElement(idx, 0, obs->getDdel_dUT1());
1185 // dV_dUT1 ->setElement(idx, 1, obs->getDrat_dUT1());
1186  dV_dUT1 ->setElement(idx, 0, obs->getDdel_dUT1()/86400.0);
1187  dV_dUT1 ->setElement(idx, 1, obs->getDrat_dUT1()/86400.0);
1188 
1189  dV_dUT1 ->setElement(idx, 2, obs->getD2del_dUT12());
1190  dV_dUT1 ->setElement(idx, 3, obs->getD2rat_dUT12());
1191  dV_dCipX ->setElement(idx, 0, obs->getDdel_dCipX());
1192  dV_dCipX ->setElement(idx, 1, obs->getDrat_dCipX());
1193  dV_dCipY ->setElement(idx, 0, obs->getDdel_dCipY());
1194  dV_dCipY ->setElement(idx, 1, obs->getDrat_dCipY());
1195  dV_dRA ->setElement(idx, 0, obs->getDdel_dRA());
1196  dV_dRA ->setElement(idx, 1, obs->getDrat_dRA());
1197  dV_dDN ->setElement(idx, 0, obs->getDdel_dDN());
1198  dV_dDN ->setElement(idx, 1, obs->getDrat_dDN());
1199  dDel_dR_1 ->setElement(idx, 0, obs->getDdel_dR_1().at(X_AXIS));
1200  dDel_dR_1 ->setElement(idx, 1, obs->getDdel_dR_1().at(Y_AXIS));
1201  dDel_dR_1 ->setElement(idx, 2, obs->getDdel_dR_1().at(Z_AXIS));
1202  dRat_dR_1 ->setElement(idx, 0, obs->getDrat_dR_1().at(X_AXIS));
1203  dRat_dR_1 ->setElement(idx, 1, obs->getDrat_dR_1().at(Y_AXIS));
1204  dRat_dR_1 ->setElement(idx, 2, obs->getDrat_dR_1().at(Z_AXIS));
1205  dV_dGamma ->setElement(idx, 0, obs->getDdel_dGamma());
1206  dV_dGamma ->setElement(idx, 1, obs->getDrat_dGamma());
1207  dV_dParallax->setElement(idx, 0, obs->getDdel_dParallax());
1208  dV_dParallax->setElement(idx, 1, obs->getDrat_dParallax());
1209  dV_dPtdX ->setElement(idx, 0, obs->getDdel_dPolTideX());
1210  dV_dPtdX ->setElement(idx, 1, obs->getDrat_dPolTideX());
1211  dV_dPtdY ->setElement(idx, 0, obs->getDdel_dPolTideY());
1212  dV_dPtdY ->setElement(idx, 1, obs->getDrat_dPolTideY());
1213  //
1214  //
1215  // scan-based stuff:
1216  if (!epochByScanId.contains(obs->getScanId())) // new scan:
1217  {
1218  epochByScanId.insert(obs->getScanId(), *obs);
1219  const Sg3dVector *r=&obs->getRsun();
1220  rSun->setElement(scanIdx, 0, r->at(X_AXIS));
1221  rSun->setElement(scanIdx, 1, r->at(Y_AXIS));
1222  rSun->setElement(scanIdx, 2, r->at(Z_AXIS));
1223  r = &obs->getVsun();
1224  vSun->setElement(scanIdx, 0, r->at(X_AXIS));
1225  vSun->setElement(scanIdx, 1, r->at(Y_AXIS));
1226  vSun->setElement(scanIdx, 2, r->at(Z_AXIS));
1227  r = &obs->getRmoon();
1228  rMoon->setElement(scanIdx, 0, r->at(X_AXIS));
1229  rMoon->setElement(scanIdx, 1, r->at(Y_AXIS));
1230  rMoon->setElement(scanIdx, 2, r->at(Z_AXIS));
1231  r = &obs->getVmoon();
1232  vMoon->setElement(scanIdx, 0, r->at(X_AXIS));
1233  vMoon->setElement(scanIdx, 1, r->at(Y_AXIS));
1234  vMoon->setElement(scanIdx, 2, r->at(Z_AXIS));
1235  r = &obs->getRearth();
1236  rEarth->setElement(scanIdx, 0, r->at(X_AXIS));
1237  rEarth->setElement(scanIdx, 1, r->at(Y_AXIS));
1238  rEarth->setElement(scanIdx, 2, r->at(Z_AXIS));
1239  r = &obs->getVearth();
1240  vEarth->setElement(scanIdx, 0, r->at(X_AXIS));
1241  vEarth->setElement(scanIdx, 1, r->at(Y_AXIS));
1242  vEarth->setElement(scanIdx, 2, r->at(Z_AXIS));
1243  r = &obs->getAearth();
1244  aEarth->setElement(scanIdx, 0, r->at(X_AXIS));
1245  aEarth->setElement(scanIdx, 1, r->at(Y_AXIS));
1246  aEarth->setElement(scanIdx, 2, r->at(Z_AXIS));
1247 
1248  pPsiEpsWahr ->setElement(scanIdx, 0, obs->getCalcNutWahr_dPsiV());
1249  pPsiEpsWahr ->setElement(scanIdx, 1, obs->getCalcNutWahr_dEpsV());
1250  pPsiEpsWahr_rates ->setElement(scanIdx, 0, obs->getCalcNutWahr_dPsiR());
1251  pPsiEpsWahr_rates ->setElement(scanIdx, 1, obs->getCalcNutWahr_dEpsR());
1252  pPsiEps ->setElement(scanIdx, 0, obs->getCalcNut2006_dPsiV());
1253  pPsiEps ->setElement(scanIdx, 1, obs->getCalcNut2006_dEpsV());
1254  pPsiEps_rates ->setElement(scanIdx, 0, obs->getCalcNut2006_dPsiR());
1255  pPsiEps_rates ->setElement(scanIdx, 1, obs->getCalcNut2006_dEpsR());
1256  pXys ->setElement(scanIdx, 0, obs->getCalcCipXv());
1257  pXys ->setElement(scanIdx, 1, obs->getCalcCipYv());
1258  pXys ->setElement(scanIdx, 2, obs->getCalcCipSv());
1259  pXys_rates ->setElement(scanIdx, 0, obs->getCalcCipXr());
1260  pXys_rates ->setElement(scanIdx, 1, obs->getCalcCipYr());
1261  pXys_rates ->setElement(scanIdx, 2, obs->getCalcCipSr());
1262 
1263  const Sg3dMatrix &t2c_v=obs->getTrf2crfVal();
1264  const Sg3dMatrix &t2c_r=obs->getTrf2crfRat();
1265  const Sg3dMatrix &t2c_a=obs->getTrf2crfAcc();
1266  for (int k=0; k<3; k++)
1267  for (int l=0; l<3; l++)
1268  {
1269  t2c_val ->setElement(scanIdx, 3*k+l, t2c_v.at((DIRECTION)k, (DIRECTION)l));
1270  t2c_rat ->setElement(scanIdx, 3*k+l, t2c_r.at((DIRECTION)k, (DIRECTION)l));
1271  t2c_acc ->setElement(scanIdx, 3*k+l, t2c_a.at((DIRECTION)k, (DIRECTION)l));
1272  };
1273  ut1_tai ->setElement(scanIdx, obs->getCalcUt1_Tai());
1274  pmXy ->setElement(scanIdx, 0, obs->getCalcPmX());
1275  pmXy ->setElement(scanIdx, 1, obs->getCalcPmY());
1276  //
1277  scanIdx++;
1278  };
1279  };
1280  isOk = isOk && vgosDb->storeObsDelayTheoretical(vCalcDelay);
1281 
1282  isOk = isOk && vgosDb->storeObsRateTheoretical (vCalcRate);
1283  isOk = isOk && vgosDb->storeObsFractC(vFractC);
1284  //
1285 
1286  isOk = isOk && vgosDb->storeObsCalEarthTide(cEarthTide, kind4EarthTide);
1287  isOk = isOk && vgosDb->storeObsCalOcean(cOceanTide);
1288  isOk = isOk && vgosDb->storeObsCalOceanOld(cOceanTideOld);
1289  isOk = isOk && vgosDb->storeObsCalOceanPoleTideLoad(cOceanPoleTide);
1290  isOk = isOk && vgosDb->storeObsCalPoleTide(cPoleTide, kind4PoleTide);
1291  isOk = isOk && vgosDb->storeObsCalPoleTideOldRestore(cPoleTideOld);
1292  isOk = isOk && vgosDb->storeObsCalTiltRmvr(cTiltRmvr);
1293 
1294  isOk = isOk && vgosDb->storeObsCalHiFyErp(mHiFyUt1, mHiFyPxy, kind4HiFreqErp);
1295  isOk = isOk && vgosDb->storeObsCalHiFyLibration(mLibrUt1, mLibrPxy, kind4HiFreqLibration);
1296  isOk = isOk && vgosDb->storeObsCalWobble(mPx, mPy);
1297  isOk = isOk && vgosDb->storeObsCalParallax(mPlxRev);
1298  isOk = isOk && vgosDb->storeObsCalBend(cBend);
1299  isOk = isOk && vgosDb->storeObsCalBendSun(cBendSun);
1300  isOk = isOk && vgosDb->storeObsCalBendSunHigher(cBendSunHigher);
1301  //
1302  isOk = isOk && vgosDb->storeObsPartBend(partBend);
1303  isOk = isOk && vgosDb->storeObsPartEOP(dV_dPx, dV_dPy, dV_dUT1);
1304  isOk = isOk && vgosDb->storeObsPartNut2KXY(dV_dCipX, dV_dCipY, kind4Nutation);
1305  isOk = isOk && vgosDb->storeObsPartRaDec(dV_dRA, dV_dDN);
1306  isOk = isOk && vgosDb->storeObsPartXYZ(dDel_dR_1, dRat_dR_1);
1307  isOk = isOk && vgosDb->storeObsPartGamma(dV_dGamma);
1308  isOk = isOk && vgosDb->storeObsPartParallax(dV_dParallax);
1309  isOk = isOk && vgosDb->storeObsPartPoleTides(dV_dPtdX, dV_dPtdY, kind4PoleTidePart);
1310  //
1311  //
1312  // scan dependent data:
1313  isOk = isOk && vgosDb->storeScanEphemeris(rSun, rMoon, rEarth, vSun, vMoon, vEarth, aEarth, kind4Ephemeris);
1314  isOk = isOk && vgosDb->storeScanNutationEqxWahr(pPsiEpsWahr, pPsiEpsWahr_rates);
1315  isOk = isOk && vgosDb->storeScanNutationEqx(pPsiEps, pPsiEps_rates, kind4Nutation);
1316  isOk = isOk && vgosDb->storeScanNutationNro(pXys, pXys_rates, kind4Nutation);
1317  isOk = isOk && vgosDb->storeScanTrf2crf(t2c_val, t2c_rat, t2c_acc);
1318  isOk = isOk && vgosDb->storeErpApriori(ut1_tai, pmXy);
1319 
1320 
1321  delete pmXy;
1322  delete ut1_tai;
1323  delete t2c_val;
1324  delete t2c_rat;
1325  delete t2c_acc;
1326  delete pPsiEpsWahr;
1327  delete pPsiEpsWahr_rates;
1328  delete pPsiEps;
1329  delete pPsiEps_rates;
1330  delete pXys;
1331  delete pXys_rates;
1332 
1333  delete rSun;
1334  delete rMoon;
1335  delete rEarth;
1336  delete vSun;
1337  delete vMoon;
1338  delete vEarth;
1339  delete aEarth;
1340  delete mPlxRev;
1341  delete dV_dGamma;
1342  delete dV_dParallax;
1343  delete dV_dPtdX;
1344  delete dV_dPtdY;
1345  delete dDel_dR_1;
1346  delete dRat_dR_1;
1347  delete dV_dRA;
1348  delete dV_dDN;
1349  delete dV_dCipX;
1350  delete dV_dCipY;
1351  delete dV_dPx;
1352  delete dV_dPy;
1353  delete dV_dUT1;
1354  delete partBend;
1355  delete mHiFyUt1;
1356  delete mHiFyPxy;
1357  delete mLibrUt1;
1358  delete mLibrPxy;
1359  delete mPx;
1360  delete mPy;
1361  delete cBend;
1362  delete cBendSun;
1363  delete cBendSunHigher;
1364 
1365  delete cEarthTide;
1366  delete cOceanTide;
1367  delete cOceanTideOld;
1368  delete cOceanPoleTide;
1369  delete cPoleTide;
1370  delete cPoleTideOld;
1371  delete cTiltRmvr;
1372 
1373  delete vFractC;
1374  delete vCalcDelay;
1375  delete vCalcRate;
1376  //
1377  //
1378  // per station (theoreticals and partials):
1379  QString kind4TroposphereModel("NMF");
1380  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
1381  {
1382  SgVlbiStationInfo *stn=it.value();
1383  const QString stnName(stn->getKey());
1384  SgVector *parAngle;
1385  SgMatrix *azTheo, *elTheo;
1386  SgMatrix *calAxisOffset;
1387  SgMatrix *calNmfDry, *calNmfWet;
1388  SgMatrix *calHorzOLoad, *calVertOLoad;
1389  SgMatrix *ocnLdR, *ocnLdV;
1390  SgMatrix *partAxisOffset;
1391  SgMatrix *partTropZenithDry, *partTropZenithWet, *partTropGrad;
1392 
1393  int idx, num=stn->auxObservationByScanId()->size();
1394 
1395  parAngle = new SgVector(num);
1396  azTheo = new SgMatrix(num, 2);
1397  elTheo = new SgMatrix(num, 2);
1398  ocnLdR = new SgMatrix(num, 3);
1399  ocnLdV = new SgMatrix(num, 3);
1400  calAxisOffset = new SgMatrix(num, 2);
1401  calNmfDry = new SgMatrix(num, 2);
1402  calNmfWet = new SgMatrix(num, 2);
1403  calHorzOLoad = new SgMatrix(num, 2);
1404  calVertOLoad = new SgMatrix(num, 2);
1405  partAxisOffset = new SgMatrix(num, 2);
1406  partTropZenithDry = new SgMatrix(num, 2);
1407  partTropZenithWet = new SgMatrix(num, 2);
1408  partTropGrad = new SgMatrix(num, 4);
1409 
1410  idx = 0;
1411  for (QMap<QString, SgVlbiAuxObservation*>::iterator jt=stn->auxObservationByScanId()->begin();
1412  jt!=stn->auxObservationByScanId()->end(); ++jt, idx++)
1413  {
1414  SgVlbiAuxObservation *aux=jt.value();
1415  parAngle->setElement(idx, aux->getParallacticAngle());
1416  azTheo->setElement(idx, 0, aux->getAzimuthAngle());
1417  azTheo->setElement(idx, 1, aux->getAzimuthAngleRate());
1418  elTheo->setElement(idx, 0, aux->getElevationAngle());
1419  elTheo->setElement(idx, 1, aux->getElevationAngleRate());
1420  ocnLdR->setElement(idx, 0, aux->getOcnLdR().at(X_AXIS));
1421  ocnLdR->setElement(idx, 1, aux->getOcnLdR().at(Y_AXIS));
1422  ocnLdR->setElement(idx, 2, aux->getOcnLdR().at(Z_AXIS));
1423  ocnLdV->setElement(idx, 0, aux->getOcnLdV().at(X_AXIS));
1424  ocnLdV->setElement(idx, 1, aux->getOcnLdV().at(Y_AXIS));
1425  ocnLdV->setElement(idx, 2, aux->getOcnLdV().at(Z_AXIS));
1426  //
1427  calAxisOffset->setElement (idx, 0, aux->getCalcAxisOffset4Delay());
1428  calAxisOffset->setElement (idx, 1, aux->getCalcAxisOffset4Rate());
1429  calNmfDry->setElement (idx, 0, aux->getCalcNdryCont4Delay());
1430  calNmfDry->setElement (idx, 1, aux->getCalcNdryCont4Rate());
1431  calNmfWet->setElement (idx, 0, aux->getCalcNwetCont4Delay());
1432  calNmfWet->setElement (idx, 1, aux->getCalcNwetCont4Rate());
1433  calHorzOLoad->setElement (idx, 0, aux->getCalcOLoadHorz4Delay());
1434  calHorzOLoad->setElement (idx, 1, aux->getCalcOLoadHorz4Rate());
1435  calVertOLoad->setElement (idx, 0, aux->getCalcOLoadVert4Delay());
1436  calVertOLoad->setElement (idx, 1, aux->getCalcOLoadVert4Rate());
1437  //
1438  partAxisOffset->setElement(idx, 0, aux->getDdel_dAxsOfs());
1439  partAxisOffset->setElement(idx, 1, aux->getDrat_dAxsOfs());
1440 
1441  partTropZenithDry->setElement(idx, 0, aux->getDdel_dTzdDry());
1442  partTropZenithDry->setElement(idx, 1, aux->getDrat_dTzdDry());
1443  partTropZenithWet->setElement(idx, 0, aux->getDdel_dTzdWet());
1444  partTropZenithWet->setElement(idx, 1, aux->getDrat_dTzdWet());
1445  partTropGrad->setElement(idx, 0, aux->getDdel_dTzdGrdN());
1446  partTropGrad->setElement(idx, 1, aux->getDdel_dTzdGrdE());
1447  partTropGrad->setElement(idx, 2, aux->getDrat_dTzdGrdN());
1448  partTropGrad->setElement(idx, 3, aux->getDrat_dTzdGrdE());
1449  };
1450 
1451  isOk = isOk && vgosDb->storeStationParAngle(stnName, parAngle);
1452  isOk = isOk && vgosDb->storeStationAzEl(stnName, azTheo, elTheo);
1453  isOk = isOk && vgosDb->storeStationOceanLdDisp(stnName, ocnLdR, ocnLdV);
1454  // contributions:
1455  isOk = isOk && vgosDb->storeStationCalAxisOffset(stnName, calAxisOffset);
1456  isOk = isOk && vgosDb->storeStationCalSlantPathTropDry(stnName, calNmfDry, kind4TroposphereModel);
1457  isOk = isOk && vgosDb->storeStationCalSlantPathTropWet(stnName, calNmfWet, kind4TroposphereModel);
1458  isOk = isOk && vgosDb->storeStationCalOceanLoad(stnName, calHorzOLoad, calVertOLoad);
1459  // partials:
1460  isOk = isOk && vgosDb->storeStationPartAxisOffset(stnName, partAxisOffset);
1461  isOk = isOk && vgosDb->storeStationPartZenithDelayDry(stnName, partTropZenithDry,
1462  kind4TroposphereModel);
1463  isOk = isOk && vgosDb->storeStationPartZenithDelayWet(stnName, partTropZenithWet,
1464  kind4TroposphereModel);
1465  isOk = isOk && vgosDb->storeStationPartHorizonGrad(stnName, partTropGrad, kind4TroposphereModel);
1466 
1467 
1468  //
1469  delete partTropZenithDry;
1470  delete partTropZenithWet;
1471  delete partTropGrad;
1472  delete ocnLdR;
1473  delete ocnLdV;
1474  delete calHorzOLoad;
1475  delete calVertOLoad;
1476  delete calNmfDry;
1477  delete calNmfWet;
1478  delete parAngle;
1479  delete calAxisOffset;
1480  delete partAxisOffset;
1481  delete azTheo;
1482  delete elTheo;
1483  };
1484  //
1485  //
1486  // the session-wide data:
1487  // Calc Info:
1488  isOk = isOk && vgosDb->storeCalcInfo(calcInfo_);
1489  //
1490  // ERP (if exist):
1495  {
1496  SgVector *utArrayInfo, *pmArrayInfo, *utValues;
1497  SgMatrix *pmValues;
1498  double d;
1499  utArrayInfo = new SgVector(4);
1500  pmArrayInfo = new SgVector(3);
1501  utValues = new SgVector(tabs4Ut1Interpolation_->nRow());
1502  pmValues = new SgMatrix(tabs4PxyInterpolation_->nRow(), 2);
1503  // 0:
1505  utArrayInfo->setElement(0, d>2390000.0?d:d+2400000.5);
1507  pmArrayInfo->setElement(0, d>2390000.0?d:d+2400000.5);
1508  // 1:
1509  utArrayInfo->setElement(1, args4Ut1Interpolation_->n()>1?
1511  pmArrayInfo->setElement(1, args4PxyInterpolation_->n()>1?
1513  // 2:
1514  utArrayInfo->setElement(2, args4Ut1Interpolation_->n());
1515  pmArrayInfo->setElement(2, args4PxyInterpolation_->n());
1516  // 3:
1517  utArrayInfo->setElement(3, 1.0);
1518  //
1519  for (unsigned int i=0; i<tabs4Ut1Interpolation_->nRow(); i++)
1520  utValues->setElement(i, tabs4Ut1Interpolation_->getElement(i, 0));
1521  for (unsigned int i=0; i<tabs4PxyInterpolation_->nRow(); i++)
1522  {
1523  pmValues->setElement(i, 0, tabs4PxyInterpolation_->getElement(i, 0));
1524  pmValues->setElement(i, 1, tabs4PxyInterpolation_->getElement(i, 1));
1525  };
1526  //
1527  isOk = isOk && vgosDb->storeCalcEop(pmArrayInfo, utArrayInfo, pmValues, utValues, calcInfo_);
1528  //
1529  delete utArrayInfo;
1530  delete pmArrayInfo;
1531  delete utValues;
1532  delete pmValues;
1533  };
1534  }; // end of CALC's first part
1535  //
1536  //
1537  // the second part, a priori:
1538 
1540  {
1541  // a priori:
1542  QList<QString> sourcesNames, sourcesRefs, stationsNames, tectonicPlateNames;
1543  QList<int> axisTypes;
1544  SgVector *axisOffsets;
1545  SgMatrix *cooRaDe, *cooXYZ, *axisTilts;
1546 
1547  cooRaDe = new SgMatrix(sourcesByName_.size(), 2);
1548  cooXYZ = new SgMatrix(stationsByName_.size(), 3);
1549  axisTilts = new SgMatrix(stationsByName_.size(), 2);
1550  axisOffsets = new SgVector(stationsByName_.size());
1551  // collect info:
1552  int idx=0;
1553  for (SourcesByName_it it=sourcesByName_.begin(); it!=sourcesByName_.end(); ++it)
1554  {
1555  SgVlbiSourceInfo *src=it.value();
1556  sourcesNames.append(src->getKey());
1557  sourcesRefs .append(src->getAprioriReference());
1558  cooRaDe->setElement(idx, 0, src->getRA());
1559  cooRaDe->setElement(idx, 1, src->getDN());
1560  idx++;
1561  };
1562  idx = 0;
1563  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
1564  {
1565  SgVlbiStationInfo *stn=it.value();
1566  const Sg3dVector &r=stn->getR();
1567  stationsNames .append(stn->getKey());
1568  tectonicPlateNames.append(stn->getTectonicPlateName());
1569  //
1570  axisTypes.append(SgVlbiStationInfo::mntType2int(stn->getMntType()));
1571  axisOffsets->setElement(idx, stn->getAxisOffset());
1572  axisTilts->setElement(idx, 0, stn->getTilt(0));
1573  axisTilts->setElement(idx, 1, stn->getTilt(1));
1574  cooXYZ->setElement(idx, 0, r.at(X_AXIS));
1575  cooXYZ->setElement(idx, 1, r.at(Y_AXIS));
1576  cooXYZ->setElement(idx, 2, r.at(Z_AXIS));
1577  idx++;
1578  };
1579 
1580  // save the data:
1581  isOk = isOk && vgosDb->storeSourcesApriories(sourcesNames, sourcesRefs, cooRaDe);
1582  isOk = isOk && vgosDb->storeStationsApriories(stationsNames, cooXYZ, tectonicPlateNames);
1583 // // these data are not stored in agv files:
1584 // if (isAttr(Attr_FF_CALC_DATA_MODIFIED))
1585  isOk = isOk && vgosDb->storeAntennaApriories(stationsNames, axisTypes, axisOffsets, axisTilts);
1586 
1587  //
1588  if (getLeapSeconds() > 0)
1589  isOk = isOk && vgosDb->storeLeapSecond(getLeapSeconds());
1590 
1591  sourcesNames.clear();
1592  sourcesRefs.clear();
1593  stationsNames.clear();
1594  tectonicPlateNames.clear();
1595 
1596  delete axisOffsets;
1597  delete axisTilts;
1598  delete cooXYZ;
1599  delete cooRaDe;
1600  }; // end of the second part of CALC
1601  //
1602  //
1603  // the last part of CALC:
1605  {
1606  // band dependent data:
1607  // create carriers:
1608  QMap<QString, SgMatrix*> uvfPerAsecByBand, feedCorrByBand;
1609  for (int iBand=0; iBand<bands_.size(); iBand++)
1610  {
1611  const QString& bandKey=bands_.at(iBand)->getKey();
1612  uvfPerAsecByBand.insert(bandKey, new SgMatrix(numOfObs, 2));
1613  feedCorrByBand.insert (bandKey, new SgMatrix(numOfObs, 2));
1614  };
1615  // fill them:
1616  for (int iObs=0; iObs<numOfObs; iObs++)
1617  {
1618  SgVlbiObservation *obs=observations_.at(iObs);
1619  for (QMap<QString, SgVlbiObservable*>::iterator it=obs->observableByKey().begin();
1620  it!=obs->observableByKey().end(); ++it)
1621  {
1622  SgVlbiObservable *o=it.value();
1623  uvfPerAsecByBand[o->getBandKey()]->setElement(o->getMediaIdx(),0, o->getUvFrPerAsec(0));
1624  uvfPerAsecByBand[o->getBandKey()]->setElement(o->getMediaIdx(),1, o->getUvFrPerAsec(1));
1625  feedCorrByBand [o->getBandKey()]->setElement(o->getMediaIdx(),0, o->getCalcFeedCorrDelay());
1626  feedCorrByBand [o->getBandKey()]->setElement(o->getMediaIdx(),1, o->getCalcFeedCorrRate ());
1627  };
1628  };
1629  // write data into netCDF files:
1630  for (int iBand=0; iBand<bands_.size(); iBand++)
1631  {
1632  const QString& bandKey=bands_.at(iBand)->getKey();
1633  isOk = isOk && vgosDb->storeObsUVFperAsec (bandKey, uvfPerAsecByBand[bandKey]);
1634  isOk = isOk && vgosDb->storeObsCalFeedCorr(bandKey, feedCorrByBand [bandKey]);
1635  };
1636  // free memmory:
1637  for (QMap<QString, SgMatrix*>::iterator it=uvfPerAsecByBand.begin();
1638  it!=uvfPerAsecByBand.end(); ++it)
1639  delete it.value();
1640  for (QMap<QString, SgMatrix*>::iterator it=feedCorrByBand.begin();
1641  it!=feedCorrByBand.end(); ++it)
1642  delete it.value();
1643  //
1644  //
1645  };
1646  //
1647  //
1648  // end of CALC_MODIFIED
1649  //
1650  //
1651  //
1652  // stations (data from log files):
1654  {
1655  QString kind("");
1656  QMap<QString, QString> cableSignByKey;
1657  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
1658  {
1659  SgVlbiStationInfo *stn=it.value();
1660  const QString stnName(stn->getKey());
1661  SgVector *metAtmPres, *metAtmRh, *metAtmTemp;
1662  SgMatrix *cableCal, *cblCorrections;
1663  SgMatrix *tSyses;
1664  int idx, num=stn->auxObservationByScanId()->size();
1665  int numTsChans=stn->tsysIfFreqs().size();
1666  QVector<double> tsysFreqs(numTsChans);
1667  QVector<QString> tsysIds(numTsChans), tsysSbs(numTsChans), tsysPzs(numTsChans);
1668 
1669 
1670  metAtmPres = new SgVector(num);
1671  metAtmRh = new SgVector(num);
1672  metAtmTemp = new SgVector(num);
1673  cableCal = new SgMatrix(num, 1);
1674  cblCorrections = new SgMatrix(num, 3);
1675  tSyses = new SgMatrix(num, numTsChans);
1676  for (int j=0; j<numTsChans; j++)
1677  {
1678  tsysFreqs[j] = stn->tsysIfFreqs()[j];
1679  tsysIds[j] = stn->tsysIfIds()[j];
1680  tsysSbs[j] = stn->tsysIfSideBands()[j];
1681  tsysPzs[j] = stn->tsysIfPolarizations()[j];
1682  };
1683  idx = 0;
1684  for (QMap<QString, SgVlbiAuxObservation*>::iterator jt=stn->auxObservationByScanId()->begin();
1685  jt!=stn->auxObservationByScanId()->end(); ++jt, idx++)
1686  {
1687  SgVlbiAuxObservation *aux=jt.value();
1688 
1689  metAtmPres ->setElement(idx, aux->meteoData().getPressure());
1690  metAtmRh ->setElement(idx, aux->meteoData().getRelativeHumidity());
1691  metAtmTemp ->setElement(idx, aux->meteoData().getTemperature());
1692 
1693  cableCal ->setElement(idx, 0, aux->getCableCalibration());
1694  cblCorrections->setElement(idx, SgVlbiAuxObservation::CCT_FSLG,
1696  cblCorrections->setElement(idx, SgVlbiAuxObservation::CCT_CDMS,
1698  cblCorrections->setElement(idx, SgVlbiAuxObservation::CCT_PCMT,
1700  for (int j=0; j<numTsChans; j++)
1701  tSyses->setElement(idx, j, aux->tSyses()->getElement(j));
1702  };
1703  //
1706  {
1708  kind = "";
1710  kind = "Cdms";
1712  kind = "Pcmt";
1714  kind = "CDMS";
1715  else
1717  "::putDataIntoVgosDb(): the station " + stnName +
1718  " has an unknown kind of cable calibration data");
1719  isOk = isOk && vgosDb->storeStationCalCable(stnName, cableCal, stn->getCableCalsOriginTxt(),
1720  kind);
1721  isOk = isOk && vgosDb->storeStationCalCblCorrections(stnName, cblCorrections,
1722  "Various input files (e.g, FS log, CDMS, PCMT)");
1724  cableSignByKey[stnName] = stn->getCableCalMultiplierDBCal()==-1.0?"-":
1725  (stn->getCableCalMultiplierDBCal()==1.0?"+":"?");
1726  else
1727  cableSignByKey[stnName] = " ";
1728  };
1731  {
1732 
1734  kind = "";
1736  kind = "External";
1737  else
1739  "::putDataIntoVgosDb(): the station " + stnName +
1740  " has an unknown kind of meteo data");
1741  isOk = isOk && vgosDb->storeStationMet(stnName, metAtmPres, metAtmRh, metAtmTemp,
1742  stn->getMeteoDataOriginTxt(), kind);
1743  };
1746  {
1747  isOk = isOk && vgosDb->storeStationTsys(stnName, tSyses, tsysFreqs, tsysIds, tsysSbs, tsysPzs);
1748  };
1749 
1750  delete metAtmPres;
1751  delete metAtmRh;
1752  delete metAtmTemp;
1753  delete cableCal;
1754  delete cblCorrections;
1755  };
1756  //
1757  // save cable cal signs that were applied to stations' data:
1758  if (cableSignByKey.size())
1759  isOk = isOk && vgosDb->storeMiscCable(cableSignByKey);
1760  cableSignByKey.clear();
1761  };
1762  //
1763 
1764 
1765 
1766  // ionospheric corrections:
1768  {
1769  // create carriers:
1770  QMap<QString, SgMatrix*> ionCalsByBand, ionSigsByBand;
1771  QMap<QString, SgMatrix*> effFreqsByBand, effFreqsEqWgtByBand;
1772  QMap<QString, QVector<int> >ionDataFlagByBand;
1773  QVector<int> ionBits;
1774  QString primeBandKey(primaryBand_?primaryBand_->getKey():"X");
1775 
1776  for (int iBand=0; iBand<bands_.size(); iBand++)
1777  {
1778  const QString& bandKey = bands_.at(iBand)->getKey();
1779  ionCalsByBand .insert(bandKey, new SgMatrix(numOfObs, 2));
1780  ionSigsByBand .insert(bandKey, new SgMatrix(numOfObs, 2));
1781  effFreqsByBand .insert(bandKey, new SgMatrix(numOfObs, 3));
1782  effFreqsEqWgtByBand .insert(bandKey, new SgMatrix(numOfObs, 3));
1783  ionDataFlagByBand .insert(bandKey, QVector<int>(numOfObs));
1784  for (int i=0; i<numOfObs; i++)
1785  ionDataFlagByBand[bandKey][i] = -1;
1786  };
1787  ionBits.resize(numOfObs);
1788  // fill them:
1789  for (int iObs=0; iObs<numOfObs; iObs++)
1790  {
1791  SgVlbiObservation *obs=observations_.at(iObs);
1792  //
1793  for (QMap<QString, SgVlbiObservable*>::iterator it=obs->observableByKey().begin();
1794  it!=obs->observableByKey().end(); ++it)
1795  {
1796  SgVlbiObservable *o=it.value();
1797  const QString& bandKey=o->getBandKey();
1798  int mediaIdx=o->getMediaIdx();
1799  ionCalsByBand [bandKey]->setElement(mediaIdx, 0, o->grDelay().getIonoValue());
1800  ionCalsByBand [bandKey]->setElement(mediaIdx, 1, o->phDRate().getIonoValue());
1801  ionSigsByBand [bandKey]->setElement(mediaIdx, 0, o->grDelay().getIonoSigma());
1802  ionSigsByBand [bandKey]->setElement(mediaIdx, 1, o->phDRate().getIonoSigma());
1803  //
1804  effFreqsByBand [bandKey]->setElement(mediaIdx, 0, o->grDelay().getEffFreq());
1805  effFreqsByBand [bandKey]->setElement(mediaIdx, 1, o->phDelay().getEffFreq());
1806  effFreqsByBand [bandKey]->setElement(mediaIdx, 2, o->phDRate().getEffFreq());
1807  effFreqsEqWgtByBand [bandKey]->setElement(mediaIdx, 0, o->grDelay().getEffFreqEqWgt());
1808  effFreqsEqWgtByBand [bandKey]->setElement(mediaIdx, 1, o->phDelay().getEffFreqEqWgt());
1809  effFreqsEqWgtByBand [bandKey]->setElement(mediaIdx, 2, o->phDRate().getEffFreqEqWgt());
1810  //
1811  if (obs->observableByKey().size() == 1)
1812  ionDataFlagByBand[o->getBandKey()][o->getMediaIdx()] = -1;
1813  else
1814  {
1815  ionDataFlagByBand[o->getBandKey()][o->getMediaIdx()] = 0;
1816  //The -3 flag is set if
1817  //ION_DELAY_SIGMA < 1.d-14 or ION_RATE_SIGMA < 1.d-17
1818  if (o->grDelay().getIonoSigma()<1.0e-14 || o->phDRate().getIonoSigma()<1.0e-17)
1819  ionDataFlagByBand[o->getBandKey()][o->getMediaIdx()] = -3;
1820  //The -4 flag is set if
1821  //ION_DELAY_SIGMA >1.d-8 or ION_RATE_SIGMA > 1.d-8
1822  if (o->grDelay().getIonoSigma()>1.0e-8 || o->phDRate().getIonoSigma()>1.0e-8)
1823  ionDataFlagByBand[o->getBandKey()][o->getMediaIdx()] = -4;
1824  };
1825  };
1826  ionBits[iObs] = obs->calculateIonoBits();
1827  };
1828  // write data into netCDF files:
1829  for (int iBand=0; iBand<bands_.size(); iBand++)
1830  {
1831  const QString& bandKey = bands_.at(iBand)->getKey();
1833  isOk = isOk && vgosDb->storeObsCalIonGroup(bandKey, ionCalsByBand[bandKey],
1834  ionSigsByBand[bandKey], ionDataFlagByBand[bandKey]);
1835  isOk = isOk && vgosDb->storeObsEffFreqs(bandKey, effFreqsByBand[bandKey]);
1836  isOk = isOk && vgosDb->storeObsEffFreqs(bandKey, effFreqsEqWgtByBand[bandKey], true);
1837  };
1839  isOk = isOk && vgosDb->storeIonoBits(ionBits);
1840  // free memmory:
1841  for (QMap<QString, SgMatrix*>::iterator it=ionCalsByBand.begin(); it!=ionCalsByBand.end(); ++it)
1842  delete it.value();
1843  for (QMap<QString, SgMatrix*>::iterator it=ionSigsByBand.begin(); it!=ionSigsByBand.end(); ++it)
1844  delete it.value();
1845  for (QMap<QString, SgMatrix*>::iterator it=effFreqsByBand.begin(); it!=effFreqsByBand.end(); ++it)
1846  delete it.value();
1847  for (QMap<QString, SgMatrix*>::iterator it=effFreqsEqWgtByBand.begin();
1848  it!=effFreqsEqWgtByBand.end(); ++it)
1849  delete it.value();
1850  effFreqsByBand.clear();
1851  effFreqsEqWgtByBand.clear();
1852  ionCalsByBand.clear();
1853  ionSigsByBand.clear();
1854  ionDataFlagByBand.clear();
1855  ionBits.clear();
1856  };
1857  // end of ionocorrections
1858  //
1859  //
1860  //
1862  {
1863  QVector<int> delUFlag, phsUFlag, ratUFlag, uAcSup;
1864  delUFlag.resize(numOfObs);
1865  phsUFlag.resize(numOfObs);
1866  ratUFlag.resize(numOfObs);
1867  uAcSup.resize(numOfObs);
1868  QString pbKey=primaryBand_->getKey();
1869  QString sbKey("");
1870  bool has2ndBand;
1871  has2ndBand = bands_.size() > 1;
1872  if (has2ndBand)
1873  {
1874  int bandIdx=0;
1875  sbKey = bands_.at(bandIdx++)->getKey();
1876  while (sbKey==pbKey && bandIdx<bands_.size()) // pick up a first non-prime band:
1877  sbKey = bands_.at(bandIdx++)->getKey();
1878  };
1879  for (int iObs=0; iObs<numOfObs; iObs++)
1880  {
1881  SgVlbiObservation *obs=observations_.at(iObs);
1882  SgVlbiObservable *pbObs=obs->observable(pbKey);
1883  SgVlbiObservable *sbObs=has2ndBand?obs->observable(sbKey):NULL;
1884  int mediaIdx=obs->getMediaIdx();
1885 
1886  if (!pbObs)
1887  std::cout << "Error: pbObs is NULL\n";
1888  //
1889  // store vgosDa flags as is:
1890  if (getOriginType() != OT_AGV)
1891  {
1892  if (pbObs->grDelay().getUnweightFlag()==0)
1893  {
1895  pbObs->grDelay().setUnweightFlag(1);
1896  else if (!obs->isAttr(SgObservation::Attr_PROCESSED))
1897  pbObs->grDelay().setUnweightFlag(2);
1898  //
1899  if (sbObs) // can be NULL
1900  {
1901  int qCodeSb=sbObs->getQualityFactor();
1902  if (qCodeSb==0 && !obs->isAttr(SgObservation::Attr_PROCESSED))
1903  pbObs->grDelay().setUnweightFlag(4);
1904  };
1905  //
1906  if (has2ndBand && !sbObs)
1907  pbObs->grDelay().setUnweightFlag(8);
1908  }
1909  else if (!obs->isAttr(SgObservation::Attr_NOT_VALID) &&
1911  pbObs->grDelay().setUnweightFlag(0);
1912  }; // end of vgosDa checking
1913  //
1914  //
1915  if (pbObs->grDelay().getUnweightFlag()==0 && (sbObs || !has2ndBand))
1916  uAcSup[mediaIdx] = -32768;
1917  else if (pbObs->grDelay().getUnweightFlag()==1)
1918  uAcSup[mediaIdx] = -32767;
1919  else
1920  uAcSup[mediaIdx] = -32763;
1921 
1922  delUFlag[mediaIdx] = pbObs->grDelay().getUnweightFlag();
1923  phsUFlag[mediaIdx] = pbObs->phDelay().getUnweightFlag();
1924  ratUFlag[mediaIdx] = pbObs->phDRate().getUnweightFlag();
1925  };
1926  isOk = isOk && vgosDb->storeObsEditData(delUFlag, phsUFlag, ratUFlag, uAcSup);
1927  delUFlag.clear();
1928  phsUFlag.clear();
1929  ratUFlag.clear();
1930  uAcSup.clear();
1931  };
1932 
1933  // numbers of ambiguities:
1937  {
1938  // create carriers:
1939  QMap<QString, QVector<int> >numOfAmbigsByBand, numOfSubAmbigsByBand, numOfPhsAmbigsByBand;
1940  QVector<int> stub;
1941  QMap<QString, SgVector*> grDelaysFullByBand, phDelaysFullByBand, phDelaysSigFullByBand;
1942 // bool hasPhaseAmbigs=false;
1944  stub.clear();
1945 
1946  for (int iBand=0; iBand<bands_.size(); iBand++)
1947  {
1948  const QString& bandKey=bands_.at(iBand)->getKey();
1949  numOfAmbigsByBand .insert(bandKey, QVector<int>(numOfObs));
1950  numOfSubAmbigsByBand.insert(bandKey, QVector<int>(numOfObs));
1951  numOfPhsAmbigsByBand.insert(bandKey, QVector<int>(numOfObs));
1952  grDelaysFullByBand[bandKey] = new SgVector(numOfObs);
1953  phDelaysFullByBand[bandKey] = new SgVector(numOfObs);
1954  phDelaysSigFullByBand[bandKey] = new SgVector(numOfObs);
1955  for (int i=0; i<numOfObs; i++)
1956  {
1957  numOfAmbigsByBand [bandKey][i] = 0;
1958  numOfSubAmbigsByBand[bandKey][i] = 0;
1959  numOfPhsAmbigsByBand[bandKey][i] = 0;
1960  };
1961  };
1962  // fill them:
1963  for (int iObs=0; iObs<numOfObs; iObs++)
1964  {
1965  SgVlbiObservation *obs=observations_.at(iObs);
1966  int mediaIdx=obs->getMediaIdx();
1967  for (QMap<QString, SgVlbiObservable*>::iterator it=obs->observableByKey().begin();
1968  it!=obs->observableByKey().end(); ++it)
1969  {
1970  SgVlbiObservable *o=it.value();
1971 // numOfAmbigsByBand[o->getBandKey()][o->getMediaIdx()] = o->getNumOfAmbiguities();
1972  numOfAmbigsByBand [o->getBandKey()][mediaIdx] = o->grDelay().getNumOfAmbiguities();
1973  numOfSubAmbigsByBand[o->getBandKey()][mediaIdx] = o->grDelay().getNumOfSubAmbigs();
1974  numOfPhsAmbigsByBand[o->getBandKey()][mediaIdx] = o->phDelay().getNumOfAmbiguities();
1975 // if (!hasPhaseAmbigs && o->phDelay().getNumOfAmbiguities()!=0)
1976 // hasPhaseAmbigs = true;
1977  grDelaysFullByBand[o->getBandKey()]->setElement(mediaIdx,
1978  o->grDelay().getValue() + o->grDelay().ambiguity());
1979  phDelaysFullByBand[o->getBandKey()]->setElement(mediaIdx,
1980  o->phDelay().getValue() + o->phDelay().ambiguity());
1981  phDelaysSigFullByBand[o->getBandKey()]->setElement(mediaIdx,
1982  o->phDelay().getSigma());
1983  };
1984  };
1985  // write data into netCDF files:
1986  for (int iBand=0; iBand<bands_.size(); iBand++)
1987  {
1988  const QString& bandKey = bands_.at(iBand)->getKey();
1989  if (!true)
1990  isOk = isOk && vgosDb->storeObsNumGroupAmbigs(bandKey, numOfAmbigsByBand[bandKey],
1991  numOfSubAmbigsByBand[bandKey]);
1992  else
1993  isOk = isOk && vgosDb->storeObsNumGroupAmbigs(bandKey, numOfAmbigsByBand[bandKey], stub);
1994  isOk = isOk && vgosDb->storeObsGroupDelaysFull(bandKey, grDelaysFullByBand[bandKey]);
1995  if (hasPhaseAmbigs)
1996  {
1997  isOk = isOk && vgosDb->storeObsNumPhaseAmbigs(bandKey, numOfPhsAmbigsByBand[bandKey]);
1998  isOk = isOk && vgosDb->storeObsPhaseDelaysFull(bandKey, phDelaysFullByBand[bandKey],
1999  phDelaysSigFullByBand[bandKey]);
2000  };
2001  };
2002  // free memmory:
2003  numOfAmbigsByBand .clear();
2004  numOfSubAmbigsByBand.clear();
2005  numOfPhsAmbigsByBand.clear();
2006  for (QMap<QString, SgVector*>::iterator it=grDelaysFullByBand.begin();
2007  it!=grDelaysFullByBand.end(); ++it)
2008  delete it.value();
2009  grDelaysFullByBand.clear();
2010  };
2011  // end of numbers of ambiguities:
2012 
2013  //
2014  //
2015  // save solve control parameters:
2016  //
2017  if (parametersDescriptor_ &&
2018  getOriginType()!=OT_MK4 &&
2019  getOriginType()!=OT_KOMB )
2020  {
2021  SgVector *vIntervals, *vConstraints;
2022  QList<QString> sites, refSites;
2023  QList<int> ionoFlags;
2024  int numOfSites=stationsByName_.size();
2025  // mimic current SOLVE behavior:
2026  vIntervals = new SgVector(1);
2027  vConstraints = new SgVector(numOfSites);
2028  //
2029  // save troposhere parameters setup:
2030  int idx=0;
2031  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2032  {
2033  SgVlbiStationInfo *si=it.value();
2034  sites << si->getKey();
2035  ionoFlags << 9; // what else?
2036  vConstraints->setElement(idx,
2039  /(1.0e-12*24.0*vLight*100.0));
2040  idx++;
2041  };
2042  vIntervals->setElement(0, parametersDescriptor_->getZenith().getPwlStep()*24.0);
2043  isOk = isOk && vgosDb->storeAtmSetup(vIntervals, vConstraints, sites);
2044  //
2045  // save clock parameters setup:
2046  idx = 0;
2047  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2048  {
2049  SgVlbiStationInfo *si=it.value();
2051  refSites << si->getKey();
2052  vConstraints->setElement(idx,
2055  idx++;
2056  };
2057  vIntervals->setElement(0, parametersDescriptor_->getClock0().getPwlStep()*24.0);
2058  isOk = isOk && vgosDb->storeClockSetup(vIntervals, vConstraints, sites, refSites);
2059 
2060  // just a placeholder for future:
2061  isOk = isOk && vgosDb->storeErpSetup(10.0, 0.67);
2062  //
2063  isOk = isOk && vgosDb->storeIonoSetup(ionoFlags, sites);
2064  //
2065  sites.clear();
2066  ionoFlags.clear();
2067  delete vConstraints;
2068  delete vIntervals;
2069  };
2070  //
2071  //
2072  // baseline weight corrections:
2074  {
2075  QVector<QString> baselineNames;
2076  SgMatrix *groupBlWeights;
2077  int numOfBaselines, idx;
2078  numOfBaselines = baselinesByName_.size();
2079  groupBlWeights = new SgMatrix(2, numOfBaselines);
2080  baselineNames.resize(numOfBaselines);
2081  idx = 0;
2082  for (BaselinesByName_it it=baselinesByName_.begin(); it!=baselinesByName_.end(); ++it)
2083  {
2084  SgVlbiBaselineInfo *bi=it.value();
2085  baselineNames[idx] = bi->getKey();
2086  groupBlWeights->setElement(0, idx, bi->getSigma2add(DT_DELAY));
2087  groupBlWeights->setElement(1, idx, bi->getSigma2add(DT_RATE ));
2088  idx++;
2089  };
2090  isOk = isOk && vgosDb->storeSolveWeights(baselineNames, groupBlWeights);
2091  baselineNames.clear();
2092  delete groupBlWeights;
2093  };
2094  //
2095  //
2096  // source and baseline selection statuses:
2097  if (parametersDescriptor_ &&
2098  getOriginType()!=OT_MK4 &&
2099  getOriginType()!=OT_KOMB )
2100  {
2101  int numOfStns, idx, jdx;
2102  QList<QString> sources, stations;
2103  QVector<int> sourcesSelection;
2104  QVector< QVector<int> > baselinesSelection;
2105  sourcesSelection.resize(sourcesByName_.size());
2106  idx = 0;
2107  for (SourcesByName_it it=sourcesByName_.begin(); it!=sourcesByName_.end(); ++it)
2108  {
2109  SgVlbiSourceInfo *si=it.value();
2110  sourcesSelection[idx] = si->calculateStatusBits();
2111  sources.append(si->getKey());
2112  idx++;
2113  };
2114  //
2115  numOfStns = stationsByName_.size();
2116  baselinesSelection.resize(stationsByName_.size());
2117  idx = 0;
2118  for (StationsByName_it it_i=stationsByName_.begin(); it_i!=stationsByName_.end(); ++it_i)
2119  {
2120  jdx = 0;
2121  baselinesSelection[idx].resize(numOfStns);
2122  for (StationsByName_it it_j=stationsByName_.begin(); it_j!=stationsByName_.end(); ++it_j)
2123  {
2124  QString st1Name(it_i.value()->getKey()), st2Name(it_j.value()->getKey());
2125  int bitArray;
2126  bitArray = 0;
2127  SgVlbiBaselineInfo *bi, *biR;
2128  if (baselinesByName_.contains(st1Name + ":" + st2Name))
2129  bi = baselinesByName_.value(st1Name + ":" + st2Name);
2130  else
2131  bi = NULL;
2132  if (baselinesByName_.contains (st2Name + ":" + st1Name))
2133  biR = baselinesByName_.value(st2Name + ":" + st1Name);
2134  else
2135  biR = NULL;
2136  //
2137  // ! * Format of BASLSTAT_I2 array: *
2138  // ! * Array BASLSTAT_I2 contains NUMSTA**2 elements, where *
2139  // ! * NUMSTA is the number of stations. *
2140  // ! * Baselines ISIT1, ISIT2 has index (ISITE1-1)*NUMSTA + ISITE2 *
2141  // ! * Where ISIT1, ISIT2 are indeces of the station *
2142  // ! * in interval [1, NUMSTA]. Stations index *
2143  // ! * correspond station name table kept in LCODE *
2144  // ! * SITNAMES. In general order of stations in this *
2145  // ! * station list MAY NOT coincide with order of *
2146  // ! * stations in the array ISITN_CHR kept in psfil.i !!*
2147  // ! * Each element of the array is 16-bits bit field. *
2148  // ! * Bits are counted from 1. *
2149  // ! * 1-st bit is set when at least one observation at the *
2150  // ! * baseline ISIT1, ISIT2 (but not ISIT2, ISIT1) took place*
2151  // ! * 2-nd bit is set when baseline ISIT1, ISIT2 (or ISIT2, ISIT1)*
2152  // ! * was selected in group delay solution. *
2153  // ! * 3-nd bit is set when baseline ISIT1, ISIT2 (or ISIT2, ISIT1)*
2154  // ! * was selected in phase delay solution. *
2155  // ! * 4-th bit is set when baseline-dependent clock for the *
2156  // ! * baseline ISIT1, ISIT2 (or ISIT2, ISIT1) was estimated *
2157  // ! * in group delay solution. *
2158  // ! * 5-th bit is set when baseline-dependent clock for the *
2159  // ! * baseline ISIT1, ISIT2 (or ISIT2, ISIT1) was estimated *
2160  // ! * in phase delay solution. *
2161  // ! * bits 6-16 are reserved for future used and always are zero. *
2162  // !
2163  // set the first bit:
2164  if (bi && bi->numTotal(DT_DELAY))
2165  bitArray |= (1<<0);
2166  //
2167  // bi and biR can be NULLs!
2168  //
2169  // set the second and third bits:
2170  SgVlbiStationInfo *s1i=NULL, *s2i=NULL;
2171  if (stationsByName_.contains(st1Name))
2172  s1i = stationsByName_.value(st1Name);
2173  if (stationsByName_.contains(st2Name))
2174  s2i = stationsByName_.value(st2Name);
2175  if ( ((bi && !bi ->isAttr(SgVlbiBaselineInfo::Attr_NOT_VALID)) ||
2176  (biR && !biR->isAttr(SgVlbiBaselineInfo::Attr_NOT_VALID))) &&
2177  (s1i && !s1i->isAttr(SgVlbiStationInfo::Attr_NOT_VALID)) &&
2178  (s2i && !s2i->isAttr(SgVlbiStationInfo::Attr_NOT_VALID)) )
2179  {
2180  bitArray |= (1<<1);
2181  bitArray |= (1<<2);
2182  };
2183  // set the fourth and fifth bits:
2184  if ((bi &&
2187  (biR &&
2190  {
2191  bitArray |= (1<<3);
2192  bitArray |= (1<<4);
2193  };
2194  baselinesSelection[idx][jdx] = bitArray;
2195  jdx++;
2196  };
2197  stations.append(it_i.value()->getKey());
2198  idx++;
2199  };
2200  isOk = isOk && vgosDb->storeSelectionStatus(sourcesSelection, baselinesSelection);
2201  sources.clear();
2202  stations.clear();
2203  sourcesSelection.clear();
2204  for (int i=0; i<baselinesSelection.size(); i++)
2205  baselinesSelection[i].clear();
2206  baselinesSelection.clear();
2207  //
2208  //
2209  QList<QString> baselines;
2210  for (BaselinesByName_it it_b=baselinesByName_.begin(); it_b!=baselinesByName_.end(); ++it_b)
2211  {
2212  SgVlbiBaselineInfo *bi=it_b.value();
2215  baselines << bi->getKey();
2216  };
2217  isOk = isOk && vgosDb->storeBaselineClockSetup(baselines);
2218  baselines.clear();
2219  };
2220  //
2221  //
2222  if (config_ &&
2223  config_->getEccentricitiesFileName().size() &&
2224  getOriginType()!=OT_MK4 &&
2225  getOriginType()!=OT_KOMB )
2226  {
2227  int numOfStns, idx;
2228  bool hasEccData;
2229  QVector<QString> stationsNames, eccTypes, eccNums;
2230  SgMatrix *eccVals;
2231 
2232  numOfStns = stationsByName_.size();
2233  stationsNames.resize(numOfStns);
2234  eccTypes.resize(numOfStns);
2235  eccNums.resize(numOfStns);
2236  eccVals = new SgMatrix(numOfStns, 3);
2237  idx = 0;
2238  hasEccData = false;
2239  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2240  {
2241  SgVlbiStationInfo *si=it.value();
2242  if (si->eccRec())
2243  {
2244  if (!hasEccData && si->eccRec()->getEccType()!=SgEccRec::ET_N_A)
2245  hasEccData = true;
2246 
2247  stationsNames[idx] = si->getKey();
2248  eccTypes[idx] = si->eccRec()->getEccType()==SgEccRec::ET_XYZ ? "XY" : "NE";
2249  eccNums[idx] = si->eccRec()->getCdpNumber().leftJustified(10, ' ');
2250  eccVals->setElement(idx, 0, si->eccRec()->getDR().at(X_AXIS));
2251  eccVals->setElement(idx, 1, si->eccRec()->getDR().at(Y_AXIS));
2252  eccVals->setElement(idx, 2, si->eccRec()->getDR().at(Z_AXIS));
2253  }
2254  else
2256  "::putDataIntoVgosDb(): no ecc for station " + si->getKey());
2257  idx++;
2258  };
2259  if (hasEccData)
2260  isOk = isOk && vgosDb->storeEccentricities(stationsNames, eccTypes, eccNums, eccVals,
2262  else
2264  "::putDataIntoVgosDb(): no eccentricities found");
2265 
2266  stationsNames.clear();
2267  eccTypes.clear();
2268  eccNums.clear();
2269  delete eccVals;
2270  };
2271  //
2272  //
2273  if (config_ &&
2274  getOriginType()!=OT_MK4 &&
2275  getOriginType()!=OT_KOMB )
2276  {
2277  int obsCalFlags;
2278  QList<QString> calList;
2279  QVector<int> statCalFlags;
2280  QVector<QString> statCalNames, flybyNames, calSiteNames, obsCalNames;
2281  QVector< QVector<int> > flybyFlags;
2282 
2283  statCalNames.resize(6);
2284  for (int i=0; i<6; i++)
2285  statCalNames[i] = sCalList[i];
2286  //
2287  flybyNames.resize(8);
2288  for (int i=0; i<8; i++)
2289  flybyNames[i] = sFclList[i];
2290  //
2291  calSiteNames.resize(stationsByName_.size());
2292  statCalFlags.resize(stationsByName_.size());
2293  flybyFlags.resize(stationsByName_.size());
2294  int idx=0;
2295  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2296  {
2297  SgVlbiStationInfo *si=it.value();
2298  calSiteNames[idx] = si->getKey();
2299  // currently, we use only cable cal from the list:
2300  statCalFlags[idx] = si->isAttr(SgVlbiStationInfo::Attr_IGNORE_CABLE_CAL)?0:1;
2301  flybyFlags[idx].resize(7);
2302  flybyFlags[idx][0] = 1<<(8-1);
2303  for (int j=1; j<7; j++)
2304  flybyFlags[idx][j] = 0;
2305  idx++;
2306  };
2307  //
2308  formObsCalibrationSetup(obsCalFlags, calList);
2309  obsCalNames.resize(calList.size());
2310  for (int i=0; i<calList.size(); i++)
2311  obsCalNames[i] = calList.at(i);
2312  //
2313  isOk = isOk && vgosDb->storeCalibrations(obsCalFlags, statCalFlags, flybyFlags, statCalNames, flybyNames,
2314  calSiteNames, obsCalNames);
2315  //
2316  calList.clear();
2317  statCalFlags.clear();
2318  statCalNames.clear();
2319  flybyNames.clear();
2320  calSiteNames.clear();
2321  obsCalNames.clear();
2322  for (int i=0; i<flybyFlags.size(); i++)
2323  flybyFlags[i].clear();
2324  flybyFlags.clear();
2325  };
2326  //
2327  //
2328  // clock breaks: (should add FF_CLOCK_BREAK_ADDED to check?)
2329  if ( getOriginType()!=OT_MK4 &&
2330  getOriginType()!=OT_KOMB &&
2332  {
2333  // another attempt:
2334  int numCbs;
2335  QVector<QString> cbNames;
2336  QVector<SgMJD> cbEpochs;
2337  QVector<int> cbFlags;
2338  //
2339  QMap<QString, SgParameterBreak*>
2340  breakParameterByBreak;
2341  QMap<QString, QString> breakNameByBreak;
2342  QList<SgParameterBreak*> cBreaks;
2343  QList<QString> cBreakNames, acmSites;
2344  QString sBreak("");
2345  QList<bool> acm_offsets, acm_rates;
2346  bool need2updateAprioriClocks=false;
2347  //
2348  // session-wide clock breaks:
2349  // collect the clock breaks:
2350  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2351  {
2352  SgVlbiStationInfo *si=it.value();
2353  if (si->clockBreaks().size())
2354  {
2356  for (int j=0; j<si->clockBreaks().size(); j++)
2357  {
2358  SgParameterBreak *pb=si->clockBreaks().at(j);
2359  sBreak = pb->getEpoch4Export().toString(SgMJD::F_INTERNAL) + "@" + si->getKey();
2360  breakParameterByBreak.insert(sBreak, pb);
2361  breakNameByBreak.insert(sBreak, si->getKey());
2362  };
2363  };
2365  need2updateAprioriClocks = true;
2366  if (si->getNeed2useAPrioriClocks())
2367  {
2368  acmSites << si->getKey();
2369  acm_offsets << si->getAPrioriClockTerm_0();
2370  acm_rates << si->getAPrioriClockTerm_1();
2371  };
2372  };
2373  cBreaks = breakParameterByBreak.values();
2374  cBreakNames = breakNameByBreak.values();
2375  if ((numCbs=cBreaks.size()))
2376  {
2377  contemporaryHistory_.addHistoryRecord("Detected " + QString().setNum(numCbs) +
2378  " clock break" + (numCbs==1?"":"s"), SgMJD::currentMJD().toUtc());
2379  cbNames.resize(numCbs);
2380  cbEpochs.resize(numCbs);
2381  cbFlags.resize(numCbs);
2382  for (int i=0; i<numCbs; i++)
2383  {
2384  cbNames[i] = cBreakNames.at(i);
2385  cbEpochs[i] = cBreaks.at(i)->getEpoch4Export();
2386  cbFlags[i] = 7;
2387  contemporaryHistory_.addHistoryRecord("A clock break marker has been set for " +
2388  cBreakNames.at(i) + " at " +
2389  cBreaks.at(i)->getEpoch4Export().toString(), SgMJD::currentMJD().toUtc());
2390  };
2391  //
2392  // check already saved info:
2393  bool need2store;
2394  bool hasClockBreaks;
2395  QVector<QString> cbNames_old;
2396  QVector<SgMJD> cbEpochs_old;
2397  QVector<int> cbFlags_old;
2398  need2store = false;
2399  if ((hasClockBreaks=vgosDb->loadClockBreaks(cbNames_old, cbEpochs_old, cbFlags_old)))
2400  {
2401  if (cbNames_old != cbNames)
2402  {
2403  need2store = true;
2405  "::putDataIntoVgosDb(): the existed clock breaks names are different");
2406  };
2407  if (!need2store) // ok, the sizes and the station order too are the same
2408  {
2409  double d;
2410  for (int i=0; i<cbEpochs.size(); i++)
2411  if (!need2store && (d=fabs(cbEpochs.at(i) - cbEpochs_old.at(i)))>1.0e-2/DAY2SEC)
2412  {
2413  need2store = true;
2415  "::putDataIntoVgosDb(): the existed clock breaks epochs are different: " +
2416  cbEpochs.at(i).toString() + " vs " + cbEpochs_old.at(i).toString() +
2417  " (diff: " + interval2Str(d) + ") for the station " + cbNames.at(i));
2418  };
2419  };
2420  if (!need2store && cbFlags_old != cbFlags)
2421  {
2422  need2store = true;
2424  "::putDataIntoVgosDb(): the existed clock breaks flags are different");
2425  };
2426  cbNames_old.clear();
2427  cbEpochs_old.clear();
2428  cbFlags_old.clear();
2429  }
2430  else
2431  need2store = true;
2432  //
2433  if (need2store)
2434  {
2435  isOk = isOk && vgosDb->storeClockBreaks(cbNames, cbEpochs, cbFlags);
2437  "::putDataIntoVgosDb(): the existed clock breaks of the session were refereshed");
2438  }
2439  else
2441  "::putDataIntoVgosDb(): the session has clock breaks, the stored data were not modified");
2442  //
2443  cbNames.clear();
2444  cbEpochs.clear();
2445  cbFlags.clear();
2446  }
2447  else if (!vgosDb->vClockBreak().isEmpty()) // all previously defined clock breaks were removed:
2448  {
2449  vgosDb->vClockBreak().empty();
2451  "::putDataIntoVgosDb(): the vgosDb data tree was cleared from existed clock break(s)");
2452  }
2453  else
2455  "::putDataIntoVgosDb(): no clock break information were added to the vgosDb data tree");
2456  //
2457  cBreaks.clear();
2458  cBreakNames.clear();
2459  breakParameterByBreak.clear();
2460  breakNameByBreak.clear();
2461  //
2462  // check band's clock breaks, if they are exist, complain:
2463  for (QMap<QString, SgVlbiBand*>::iterator itb=bandByKey_.begin(); itb!=bandByKey_.end(); ++itb)
2464  {
2465  QString bandKey=itb.key();
2466  SgVlbiBand *band=itb.value();
2467  for (StationsByName_it it=band->stationsByName().begin(); it!=band->stationsByName().end(); ++it)
2468  {
2469  SgVlbiStationInfo *si=it.value();
2470  if (si->clockBreaks().size())
2472  "::putDataIntoVgosDb(): the station " + si->getKey() + " has " +
2473  QString("").setNum(si->clockBreaks().size()) + " clock break(s) at the " + bandKey +
2474  "-band. Saving the band dependent clock breaks is not implemented yet.");
2475  };
2476  };
2477  //
2478  // a priori clock model:
2479  if (need2updateAprioriClocks)
2480  {
2481  int numAcm=acmSites.size();
2482  if (numAcm)
2483  {
2484  SgMatrix *offsets_n_rates=new SgMatrix(numAcm, 2);
2485  for (int i=0; i<numAcm; i++)
2486  {
2487  offsets_n_rates->setElement(i, 0, acm_offsets.at(i));
2488  offsets_n_rates->setElement(i, 1, acm_rates.at(i));
2489  };
2490  isOk = isOk && vgosDb->storeClockApriories(acmSites, offsets_n_rates);
2491  delete offsets_n_rates;
2492  }
2493  else // special case: a user could remove/turn off a priori clocks:
2494  {
2495  vgosDb->vClockApriori().empty();
2497  "::putDataIntoVgosDb(): a set of a priori clocks has been removed from vgosDb tree");
2498  };
2499  };
2500 
2501 
2502 
2503 
2504 
2505 //----------------------------------
2506 
2507 
2508  /*
2509  QVector<QString> cbNames;
2510  QVector<SgMJD> cbEpochs;
2511  QVector<int> cbFlags;
2512  int numCbs;
2513  QMap<QString, SgParameterBreak*>
2514  breakParameterByBreak;
2515  QMap<QString, QString> breakNameByBreak;
2516  QList<SgParameterBreak*> cBreaks;
2517  QList<QString> cBreakNames;
2518  QString sBreak("");
2519  bool isClockBreaksModified;
2520 
2521  isClockBreaksModified = false;
2522  // session-wide clock breaks:
2523  for (StationsByName_it it=stationsByName_.begin(); it!=stationsByName_.end(); ++it)
2524  {
2525  SgVlbiStationInfo *si=it.value();
2526  if (si->clockBreaks().size())
2527  {
2528  if (si->clockBreaks().getIsModified())
2529  {
2530  isClockBreaksModified = true;
2531  logger->write(SgLogger::INF, SgLogger::IO_NCDF | SgLogger::DATA, className() +
2532  "::putDataIntoVgosDb(): the station " + si->getKey() + " has new clock break(s)");
2533  }
2534  else
2535  logger->write(SgLogger::INF, SgLogger::IO_NCDF | SgLogger::DATA, className() +
2536  "::putDataIntoVgosDb(): the station " + si->getKey() +
2537  " has clock break(s) but they are not new");
2538 
2539  si->calcCBEpochs4Export(*si->auxObservationByScanId());
2540  for (int j=0; j<si->clockBreaks().size(); j++)
2541  {
2542  SgParameterBreak *pb=si->clockBreaks().at(j);
2543  sBreak = pb->getEpoch4Export().toString(SgMJD::F_INTERNAL) + "@" + si->getKey();
2544  breakParameterByBreak.insert(sBreak, pb);
2545  breakNameByBreak.insert(sBreak, si->getKey());
2546  };
2547  };
2548  };
2549  cBreaks = breakParameterByBreak.values();
2550  cBreakNames = breakNameByBreak.values();
2551  if ((numCbs=cBreaks.size()) && isClockBreaksModified)
2552  {
2553  contemporaryHistory_.addHistoryRecord("Detected " + QString().setNum(numCbs) +
2554  " clock break" + (numCbs==1?"":"s"));
2555  cbNames.resize(numCbs);
2556  cbEpochs.resize(numCbs);
2557  cbFlags.resize(numCbs);
2558  for (int i=0; i<numCbs; i++)
2559  {
2560  cbNames[i] = cBreakNames.at(i);
2561  cbEpochs[i] = cBreaks.at(i)->getEpoch4Export();
2562  cbFlags[i] = 7;
2563  contemporaryHistory_.addHistoryRecord("A clock break marker has been set for " +
2564  cBreakNames.at(i) + " at " +
2565  cBreaks.at(i)->getEpoch4Export().toString());
2566  };
2567  isOk = isOk && vgosDb->storeClockBreaks(cbNames, cbEpochs, cbFlags);
2568  cbNames.clear();
2569  cbEpochs.clear();
2570  cbFlags.clear();
2571  }
2572  else
2573  logger->write(SgLogger::INF, SgLogger::IO_NCDF | SgLogger::DATA, className() +
2574  "::putDataIntoVgosDb(): no clock break information were added to the vgosDb data tree");
2575 
2576  cBreaks.clear();
2577  cBreakNames.clear();
2578  breakParameterByBreak.clear();
2579  breakNameByBreak.clear();
2580  //
2581  // band-specific clock breaks:
2582  for (QMap<QString, SgVlbiBand*>::iterator itb=bandByKey_.begin(); itb!=bandByKey_.end(); ++itb)
2583  {
2584  QString bandKey=itb.key();
2585  SgVlbiBand *band=itb.value();
2586  for (StationsByName_it it=band->stationsByName().begin(); it!=band->stationsByName().end(); ++it)
2587  {
2588  SgVlbiStationInfo *si=it.value();
2589  if (si->clockBreaks().size())
2590  {
2591  si->calcCBEpochs4Export(*stationsByName_.value(si->getKey())->auxObservationByScanId());
2592  for (int j=0; j<si->clockBreaks().size(); j++)
2593  {
2594  SgParameterBreak *pb=si->clockBreaks().at(j);
2595  sBreak = pb->getEpoch4Export().toString(SgMJD::F_INTERNAL) + "@" + si->getKey();
2596  breakParameterByBreak.insert(sBreak, pb);
2597  breakNameByBreak.insert(sBreak, si->getKey());
2598  };
2599  };
2600  };
2601  cBreaks = breakParameterByBreak.values();
2602  cBreakNames = breakNameByBreak.values();
2603  if ((numCbs=cBreaks.size()))
2604  {
2605  cbNames.resize(numCbs);
2606  cbEpochs.resize(numCbs);
2607  cbFlags.resize(numCbs);
2608  for (int i=0; i<numCbs; i++)
2609  {
2610  cbNames [i] = cBreakNames.at(i);
2611  cbEpochs[i] = cBreaks.at(i)->getEpoch4Export();
2612  cbFlags [i] = 7;
2613  };
2614  isOk = isOk && vgosDb->storeClockBreaks(cbNames, cbEpochs, cbFlags, bandKey);
2615  cbNames.clear();
2616  cbEpochs.clear();
2617  cbFlags.clear();
2618  };
2619  cBreaks.clear();
2620  cBreakNames.clear();
2621  breakParameterByBreak.clear();
2622  breakNameByBreak.clear();
2623  };
2624  */
2625 
2626 
2627  };
2628  //
2629  //
2630  //
2631  // at last, create new version of the wrapper file:
2632  vgosDb->composeWrapperFile();
2633  if (config_ && originType_ != OT_AGV)
2635  // collect everything interesting from the log:
2636  SgLogger *auxLogger=logger->lookupSupplementLog("History");
2637  if (auxLogger)
2638  {
2639  // vgosDbProcLogs-0.0.1 (Solstice): the sessio
2640  QRegExp reFltDriveName
2641  ("([\\w\\d]+)-([\\d\\.]+)\\s+\\(([\\w\\d\\s]+)\\):\\s+(.+)");
2642  QRegExp reFltNormMessg("([\\w\\d]+)::([\\w\\d]+)\\(\\):\\s+(.+)");
2643  QRegExp reFltWarnMessg("^Warning: ([\\w\\d]+)::([\\w\\d]+)\\(\\):\\s+(.+)");
2644  QRegExp reFltErrMessg("^ERROR: ([\\w\\d]+)::([\\w\\d]+)\\(\\):\\s+(.+)");
2645  QString sAttr(""), sSubj(""), sEvent("");
2646  const QList<QString*> &histSpool=auxLogger->getSpool();
2647  for (int i=0; i<histSpool.size(); i++)
2648  {
2649  const QString *pS=histSpool.at(i);
2650  if (reFltDriveName.indexIn(*pS) != -1)
2651  {
2652  sAttr = ".";
2653  sSubj = reFltDriveName.cap(1);
2654  sEvent= reFltDriveName.cap(4);
2655  };
2656  if (reFltNormMessg.indexIn(*pS) != -1)
2657  {
2658  sAttr = ".";
2659  sSubj = reFltNormMessg.cap(2);
2660  sEvent= reFltNormMessg.cap(3);
2661  };
2662  if (reFltWarnMessg.indexIn(*pS) != -1)
2663  {
2664  sAttr = "w";
2665  sSubj = reFltWarnMessg.cap(2);
2666  sEvent= reFltWarnMessg.cap(3);
2667  };
2668  if (reFltErrMessg.indexIn(*pS) != -1)
2669  {
2670  sAttr = "E";
2671  sSubj = reFltErrMessg.cap(2);
2672  sEvent= reFltErrMessg.cap(3);
2673  };
2674  if (sAttr.size() && sSubj.size() && sEvent.size())
2675  contemporaryHistory_.addHistoryRecord(sAttr + " " + sSubj + ": " + sEvent,
2676  SgMJD::currentMJD().toUtc());
2677 // contemporaryHistory_.addHistoryRecord(sSubj + ": " + sEvent);
2678  else
2680  sAttr = sSubj = sEvent = "";
2681  };
2682  };
2683  // save the history:
2684  isOk = isOk && vgosDb->saveLocalHistory(contemporaryHistory_);
2685 
2686 
2687  if (isOk)
2688  {
2689  if (vgosDb->getOperationMode() == SgNetCdf::OM_DRY_RUN)
2690  std::cout << "\nEnd of DRY RUN mode.\n";
2691  else
2692  {
2693  SgMJD finisEpoch(SgMJD::currentMJD());
2695  "::putDataIntoVgosDb(): session " + name_ + " has been updated"
2696  ", elapsed time: " + QString("").sprintf("%.2f", (finisEpoch - startEpoch)*86400000.0) + " ms");
2697  };
2698  }
2699  else
2701  "::putDataIntoVgosDb(): storing session " + name_ + " as a vgosDb database has failed");
2702 
2703  return isOk;
2704 };
2705 
2706 
2707 
2708 
2709 
2710 
2711 
2712 /*=====================================================================================================*/
2713 
2714 
2715 
2716 
2717 
2718 /*=====================================================================================================*/
2719 //
2720 // constants:
2721 //
2722 
2723 
2724 
2725 /*=====================================================================================================*/
2726 
2727 /*=====================================================================================================*/
const double vLight
Definition: SgConstants.cpp:35
SgLogger * logger
Definition: SgLogger.cpp:231
QString interval2Str(double days)
Definition: SgMJD.cpp:1371
const SgMJD tZero(1957, 10, 4)
#define DAY2SEC
radians to mas:
Definition: SgMathSupport.h:69
DIRECTION
Definition: SgMathSupport.h:81
@ Z_AXIS
Definition: SgMathSupport.h:81
@ X_AXIS
Definition: SgMathSupport.h:81
@ Y_AXIS
Definition: SgMathSupport.h:81
#define RAD2DEG
radians to degrees:
Definition: SgMathSupport.h:41
SgVersion libraryVersion("SgLib", 0, 8, 2, "Compton Peak (rc2)", SgMJD(2023, 4, 3, 10, 59))
QMap< QString, SgVlbiBaselineInfo * >::iterator BaselinesByName_it
const QString sFclList[]
const QString sCalList[]
QMap< QString, SgVlbiSourceInfo * >::iterator SourcesByName_it
QMap< QString, SgVlbiStationInfo * >::iterator StationsByName_it
@ DT_DELAY
Definition: SgWrmsable.h:44
@ DT_RATE
Definition: SgWrmsable.h:45
double at(DIRECTION i, DIRECTION j) const
Definition: Sg3dMatrix.h:93
double at(DIRECTION i) const
Definition: Sg3dVector.h:91
bool isAttr(uint a) const
Definition: SgAttribute.h:226
@ ET_N_A
Definition: SgEccRec.h:50
@ ET_XYZ
Definition: SgEccRec.h:52
const QString & getCdpNumber() const
Definition: SgEccRec.h:211
EccType getEccType() const
Definition: SgEccRec.h:251
const Sg3dVector & getDR() const
Definition: SgEccRec.h:243
const QString & getUserEmailAddress() const
Definition: SgIdentities.h:223
const QString & getAcFullName() const
Definition: SgIdentities.h:239
const QString & getUserName() const
Definition: SgIdentities.h:215
const SgIdentities * getCurrentIdentities() const
Definition: SgIoDriver.h:102
const SgVersion * getCurrentDriverVersion() const
Definition: SgIoDriver.h:104
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
const QList< QString * > & getSpool() const
Definition: SgLogger.h:143
SgLogger * lookupSupplementLog(const QString &name)
Definition: SgLogger.cpp:199
@ IO_NCDF
Definition: SgLogger.h:66
@ DATA
Definition: SgLogger.h:78
Definition: SgMJD.h:59
@ 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
void toYMDHMS_tr(int &nYear, int &nMonth, int &nDay, int &nHour, int &nMin, double &dSec) const
Definition: SgMJD.cpp:1306
static SgMJD currentMJD()
Definition: SgMJD.cpp:119
unsigned int nRow() const
Definition: SgMatrix.h:352
void setElement(unsigned int i, unsigned int j, double d)
Definition: SgMatrix.h:402
double getElement(unsigned int i, unsigned int j) const
Definition: SgMatrix.h:385
double getPressure() const
Definition: SgMeteoData.h:242
double getTemperature() const
Definition: SgMeteoData.h:234
double getRelativeHumidity() const
Definition: SgMeteoData.h:250
@ OM_DRY_RUN
Definition: SgNetCdf.h:325
double getSigma2add(DataType) const
Definition: SgObjectInfo.h:367
const QString & getKey() const
Definition: SgObjectInfo.h:319
int numTotal(DataType dType) const
Definition: SgObjectInfo.h:343
virtual int getMediaIdx() const
@ Attr_NOT_VALID
omit the observation;
Definition: SgObservation.h:78
@ Attr_PROCESSED
the observation has been processed;
Definition: SgObservation.h:79
const SgMJD & getEpoch4Export() const
Definition: SgBreakModel.h:411
double getPwlStep() const
double getPwlAPriori() const
const SgParameterCfg & getZenith() const
const SgParameterCfg & getClock0() const
const QString & getEccentricitiesFileName() const
bool isEmpty() const
Definition: SgVgosDb.cpp:159
void empty()
Definition: SgVgosDb.h:130
unsigned int n() const
Definition: SgVector.h:327
void setElement(unsigned int i, double d)
Definition: SgVector.h:348
double getElement(unsigned int i) const
Definition: SgVector.h:362
const QString & getSoftwareName() const
Definition: SgVersion.h:254
QString toString() const
Definition: SgVersion.h:356
bool storeStationCalCable(const QString &stnName, const SgMatrix *cal, const QString &origin, const QString &kind)
bool storeObsCalOcean(const SgMatrix *)
SgVdbVariable & vClockBreak()
Definition: SgVgosDb.h:351
bool storeEpochs4Obs(const QList< SgMJD > &)
bool storeClockSetup(const SgVector *interval, const SgVector *rateConstraint, const QList< QString > &sites, const QList< QString > &refSites)
bool storeObsGroupDelaysFull(const QString &band, const SgVector *groupDelays)
bool storeObsObjectNames(const QList< QString > &stations_1, const QList< QString > &stations_2, const QList< QString > &sources)
bool storeScanName(const QList< QString > &scanNames, const QList< QString > &scanFullNames)
bool storeObsCalPoleTideOldRestore(const SgMatrix *cals)
bool storeObsCrossRefs(const QList< int > &obs2scan, const QList< int > &obs2stn_1, const QList< int > &obs2stn_2)
bool storeObsEffFreqs(const QString &band, const SgMatrix *freqs, bool areEqWgts=false)
bool storeSessionHead(const QString &corrType, const QString &corrName, const QString &piName, const QString &experimentName, int experimentSerialNumber, const QString &experimentDescription, const QString &recordingMode, const QList< QString > &stations, const QList< QString > &sources, const SgMJD &tStart, const SgMJD &tFinis, int cppsIdx)
bool storeObsQualityCodes(const QString &band, const QVector< char > &qualityCodes)
bool storeObsSingleBandDelays(const QString &band, const SgMatrix *singleBandDelays)
bool storeSourceCrossRefs(const QList< QString > &sources, const QList< int > &scan2src)
bool storeObsPartRaDec(const SgMatrix *dV_dRA, const SgMatrix *dV_dDN)
bool storeObsPartParallax(const SgMatrix *part)
bool storeObsGroupDelays(const QString &band, const SgMatrix *groupDelays, const QString &kind)
void setCorrelatorType(CorrelatorType ct)
Definition: SgVgosDb.h:342
void setCurrentVersion(int ver)
Definition: SgVgosDb.h:326
bool storeStationCalOceanLoad(const QString &stnName, const SgMatrix *calHorzOLoad, const SgMatrix *calVertOLoad)
bool storeObsRefFreqs(const QString &band, const SgVector *rf)
bool storeObsCalBendSun(const SgMatrix *cals)
bool storeScanTimeMjd(const QList< SgMJD > &epochs)
bool storeStationCalSlantPathTropWet(const QString &stnName, const SgMatrix *cal, const QString &kind)
@ CT_VLBA
Definition: SgVgosDb.h:190
@ CT_Difx
Definition: SgVgosDb.h:196
@ CT_GSI
Definition: SgVgosDb.h:192
@ CT_Mk3
Definition: SgVgosDb.h:189
@ CT_Mk4
Definition: SgVgosDb.h:194
@ CT_Unknown
Definition: SgVgosDb.h:188
@ CT_CRL
Definition: SgVgosDb.h:191
bool storeObsCalPoleTide(const SgMatrix *, const QString &kind)
bool storeStationRefClockOffset(const QString &stnName, const SgVector *v)
bool storeObsCalBendSunHigher(const SgMatrix *cals)
bool storeObsPhaseCalInfo(const QString &band, SgVlbiSessionInfo::OriginType originType, const SgMatrix *phCalFrqs_1ByChan, const SgMatrix *phCalAmps_1ByChan, const SgMatrix *phCalPhss_1ByChan, const SgMatrix *phCalOffs_1ByChan, const SgVector *phCalRates_1, const SgMatrix *phCalFrqs_2ByChan, const SgMatrix *phCalAmps_2ByChan, const SgMatrix *phCalPhss_2ByChan, const SgMatrix *phCalOffs_2ByChan, const SgVector *phCalRates_2)
bool storeStationTsys(const QString &stnName, const SgMatrix *tsyses, const QVector< double > &frqs, const QVector< QString > &ids, const QVector< QString > &sbs, const QVector< QString > &polzs)
bool storeStationPartAxisOffset(const QString &stnName, const SgMatrix *partAxisOffset)
bool storeObsCalUnphase(const QString &band, const SgMatrix *phaseCal_1, const SgMatrix *phaseCal_2)
bool storeScanEphemeris(const SgMatrix *rSun, const SgMatrix *rMoon, const SgMatrix *rEarth, const SgMatrix *vSun, const SgMatrix *vMoon, const SgMatrix *vEarth, const SgMatrix *aEarth, const QString &kind)
bool storeClockApriories(const QList< QString > &siteNames, const SgMatrix *offsets_n_rates)
bool saveForeignHistory(const SgVlbiHistory &history, const QString &softwareName, const SgMJD &epochOfCreation, const QString &creator, const QString &defaultDir, const QString &historyFileName, const QString &version, bool isMk3Compatible=true)
bool storeStationCalCblCorrections(const QString &stnName, const SgMatrix *cal, const QString &origin)
bool storeMiscFourFit(const QString &band, SgVlbiSessionInfo::OriginType originType, const QVector< QString > &fourfitControlFile, const QVector< QString > &fourfitCommand, const QVector< int > &numLags, const QVector< double > &apLength)
bool storeEpochs4Scans(const QList< SgMJD > &)
bool storeStationCalAxisOffset(const QString &stnName, const SgMatrix *cal)
bool storeErpApriori(const SgVector *ut1_tai, const SgMatrix *pm)
bool storeCalibrations(int obsCalFlags, const QVector< int > &statCalFlags, const QVector< QVector< int > > &flybyFlags, const QVector< QString > &statCalNames, const QVector< QString > &flybyNames, const QVector< QString > &calSiteNames, const QVector< QString > &obsCalNames)
bool storeStationEpochs(const QString &stnName, const QList< SgMJD > &epochs)
bool storeIonoSetup(const QList< int > &flags, const QList< QString > &sites)
bool storeObsCalEarthTide(const SgMatrix *, const QString &kind)
bool storeSourcesApriories(const QList< QString > &sourcesNames, const QList< QString > &sourcesRefs, const SgMatrix *cooRaDe)
SgNetCdf::OperationMode getOperationMode() const
Definition: SgVgosDb.h:300
bool storeSolveWeights(const QVector< QString > &baselineNames, SgMatrix *groupBlWeights)
bool loadClockBreaks(QVector< QString > &cbNames, QVector< SgMJD > &cbEpochs, QVector< int > &cbFlags)
bool storeAtmSetup(const SgVector *interval, const SgVector *rateConstraint, const QList< QString > &sites)
bool storeObsCorrelation(const QString &band, const SgVector *correlations)
bool storeObsCalIonGroup(const QString &band, const SgMatrix *ionCals, const SgMatrix *ionSigmas, const QVector< int > &ionDataFlag)
bool storeObsCalParallax(const SgMatrix *cals)
bool storeStationsApriories(const QList< QString > &stationsNames, const SgMatrix *cooXYZ, const QList< QString > &tectonicPlateNames)
void setNumOfChannels(int num)
Definition: SgVgosDb.h:330
bool getHave2redoLeapSecond() const
Definition: SgVgosDb.h:292
bool storeObsCalWobble(const SgMatrix *, const SgMatrix *)
bool storeStationPartZenithDelayDry(const QString &stnName, const SgMatrix *part, const QString &kind)
bool storeScanNutationEqxWahr(const SgMatrix *pPsiEps, const SgMatrix *pPsiEps_rates)
bool storeScanTrf2crf(const SgMatrix *val, const SgMatrix *rat, const SgMatrix *acc)
bool storeScanCrootFname(const QList< QString > &corrRootFnames)
bool storeScanNutationNro(const SgMatrix *pXys, const SgMatrix *pXys_rates, const QString &kind)
bool storeObsNumGroupAmbigs(const QString &band, const QVector< int > &numAmbigs, const QVector< int > &numSubAmbigs)
bool storeObsSNR(const QString &band, const SgVector *snrs)
bool storeObsUVFperAsec(const QString &band, const SgMatrix *uvfPerAsec)
bool storeScanNutationEqx(const SgMatrix *pPsiEps, const SgMatrix *pPsiEps_rates, const QString &kind)
bool storeObsCalBend(const SgMatrix *cals)
bool storeObsPartBend(const SgMatrix *partBend)
bool storeLeapSecond(int leapSeconds)
bool storeStationParAngle(const QString &stnName, const SgVector *parAngle)
bool storeErpSetup(double pmOffsetConstraint, double utOffsetConstraint)
bool storeStationOceanLdDisp(const QString &stnName, const SgMatrix *dis, const SgMatrix *vel)
bool storeCalcInfo(const SgModelsInfo &calcInfo)
bool storeStationPartHorizonGrad(const QString &stnName, const SgMatrix *part, const QString &kind)
bool storeObsAmbigSpacing(const QString &band, const SgVector *ambigs)
bool storeObsRates(const QString &band, const SgMatrix *rates, const QString &kind)
bool storeObsCalHiFyErp(const SgMatrix *, const SgMatrix *, const QString &kind)
bool storeBaselineClockSetup(const QList< QString > &baselines)
bool storeAntennaApriories(const QList< QString > &stationsNames, const QList< int > &axisTypes, const SgVector *axisOffsets, const SgMatrix *axisTilts)
bool storeStationAzEl(const QString &stnName, SgMatrix *const azTheo, SgMatrix *const elTheo)
bool storeClockBreaks(const QVector< QString > &cbNames, const QVector< SgMJD > &cbEpochs, const QVector< int > &cbFlags, const QString &band="")
bool storeObsPartXYZ(const SgMatrix *dDel_dR_1, const SgMatrix *dRat_dR_1)
bool storeIonoBits(const QVector< int > &ionoBits)
bool storeObsCalHiFyLibration(const SgMatrix *, const SgMatrix *, const QString &kind)
bool storeMiscCable(const QMap< QString, QString > &cableSignByKey)
bool storeObsDelayTheoretical(const SgVector *v)
bool storeObsDtec(const SgVector *dTec, const SgVector *dTecStdDev)
bool storeObsCalOceanOld(const SgMatrix *)
bool storeStationCalSlantPathTropDry(const QString &stnName, const SgMatrix *cal, const QString &kind)
bool storeObsEditData(const QVector< int > &delUFlag, const QVector< int > &phsUFlag, const QVector< int > &ratUFlag, const QVector< int > &uAcSup)
bool storeObsPhaseDelaysFull(const QString &band, const SgVector *groupDelays, const SgVector *phaseDelaySigs)
bool storeObsRateTheoretical(const SgVector *v)
bool storeStationPartZenithDelayWet(const QString &stnName, const SgMatrix *part, const QString &kind)
bool storeObsCalOceanPoleTideLoad(const SgMatrix *)
bool storeStationMet(const QString &stnName, SgVector *const metAtmPres, SgVector *const metAtmRH, SgVector *const metAtmTemp, const QString &origin, const QString &kind)
bool storeObsPartNut2KXY(const SgMatrix *dV_dCipX, const SgMatrix *dV_dCipY, const QString &kind)
bool storeObsCorrelatorInfo(const QString &band, SgVlbiSessionInfo::OriginType originType, const QVector< QString > &fourfitOutputFName, const QVector< QString > &fourfitErrorCodes, const QVector< QString > &frqGrpCodes, const QVector< int > &corelVersions, const QVector< int > &startOffsets, const QVector< QVector< int > > &fourfitVersions, const QVector< QVector< int > > &dbeditVersion, const SgVector *deltaEpochs, const SgMatrix *urvrs, const SgMatrix *instrDelays, const SgMatrix *starElev, const SgMatrix *zenithDelays, const SgMatrix *searchParams, const QVector< QString > &baselineCodes, const QVector< QString > &tapeQualityCodes, const QVector< int > &stopOffsets, const QVector< int > &hopsRevisionNumbers, const SgVector *sampleRate, const SgVector *sbdResids, const SgVector *rateResids, const SgVector *effDurations, const SgVector *startSeconds, const SgVector *stopSeconds, const SgVector *percentOfDiscards, const SgVector *uniformityFactors, const SgVector *geocenterPhaseResids, const SgVector *geocenterPhaseTotals, const SgVector *geocenterSbDelays, const SgVector *geocenterGrDelays, const SgVector *geocenterDelayRates, const SgVector *probOfFalses, const SgVector *corrAprioriDelays, const SgVector *corrAprioriRates, const SgVector *corrAprioriAccs, const SgVector *incohAmps, const SgVector *incohAmps2, const SgVector *delayResids, const QVector< QString > &vlb1FileNames, const QVector< QString > &tapeIds_1, const QVector< QString > &tapeIds_2, const QVector< QVector< int > > &epochsOfCorrelations, const QVector< QVector< int > > &epochsOfCentrals, const QVector< QVector< int > > &epochsOfFourfitings, const QVector< QVector< int > > &epochsOfNominalScanTime, const SgMatrix *corrClocks, const SgMatrix *mDlys, const SgMatrix *mAux)
bool storeCalcEop(const SgVector *pmArrayInfo, const SgVector *utArrayInfo, const SgMatrix *pmValues, const SgVector *utValues, const SgModelsInfo &calcInfo)
bool storeObsPartEOP(const SgMatrix *dV_dPx, const SgMatrix *dV_dPy, const SgMatrix *dV_dUT1)
bool storeObsFractC(const SgVector *v)
bool storeObsDataFlag(const QString &band, const QVector< int > &dataFlags)
bool storeObsPhase(const QString &band, const SgMatrix *phases)
bool storeObsNumPhaseAmbigs(const QString &band, const QVector< int > &numAmbigs)
bool storeEccentricities(const QVector< QString > &stationsNames, const QVector< QString > &eccTypes, const QVector< QString > &eccNums, SgMatrix *eccVals, const QString &eccFileName)
bool storeSelectionStatus(const QVector< int > &sourcesSelection, const QVector< QVector< int > > &stationsSelection)
bool storeObsPartPoleTides(const SgMatrix *dV_dPtdX, const SgMatrix *dV_dPtdY, const QString &kind)
bool saveLocalHistory(const SgVlbiHistory &history)
bool storeObsPartGamma(const SgMatrix *part)
bool storeObsCalFeedCorr(const SgMatrix *)
SgVdbVariable & vClockApriori()
Definition: SgVgosDb.h:352
bool storeStationCrossRefs(const QList< int > &numScansPerStation, const QList< QString > &stations, const QMap< QString, QList< int > > &station2scan, const QMap< QString, QList< int > > &scan2station)
bool storeObsCalTiltRmvr(const SgMatrix *cals)
bool storeObsChannelInfo(const QString &band, SgVlbiSessionInfo::OriginType originType, const QVector< QString > &channelIds, const QVector< QString > &polarizations, const QVector< int > &numOfChannels, const QVector< int > &bitsPerSamples, const QVector< QVector< int > > &errorRates_1, const QVector< QVector< int > > &errorRates_2, const QVector< QVector< int > > &bbcIdxs_1, const QVector< QVector< int > > &bbcIdxs_2, const QVector< QVector< int > > &corelIdxNumbersUsb, const QVector< QVector< int > > &corelIdxNumbersLsb, const SgVector *sampleRate, const SgMatrix *residFringeAmplByChan, const SgMatrix *residFringePhseByChan, const SgMatrix *refFreqByChan, const SgMatrix *numOfSamplesByChan_USB, const SgMatrix *numOfSamplesByChan_LSB, const SgMatrix *numOfAccPeriodsByChan_USB, const SgMatrix *numOfAccPeriodsByChan_LSB, const SgMatrix *loFreqs_1, const SgMatrix *loFreqs_2)
double getDrat_dAxsOfs() const
double getCalcAxisOffset4Rate() const
double getDdel_dTzdGrdN() const
double getCableCalibration() const
double getCalcOLoadHorz4Delay() const
double getCalcOLoadVert4Rate() const
const QString & getTapeId() const
double getCalcAxisOffset4Delay() const
double getCalcOLoadVert4Delay() const
double getElevationAngle() const
double getDrat_dTzdWet() const
double getCalcNwetCont4Delay() const
const Sg3dVector & getOcnLdR() const
double getElevationAngleRate() const
double getDrat_dTzdGrdN() const
double getRefClockOffset() const
double getCalcNdryCont4Rate() const
double getCalcNdryCont4Delay() const
double getParallacticAngle() const
double getDdel_dTzdWet() const
double getCalcNwetCont4Rate() const
const SgVector & cableCorrections() const
double getAzimuthAngle() const
double getDrat_dTzdDry() const
double getDdel_dTzdDry() const
double getAzimuthAngleRate() const
double getDdel_dAxsOfs() const
double getDrat_dTzdGrdE() const
double getCalcOLoadHorz4Rate() const
double getDdel_dTzdGrdE() const
const Sg3dVector & getOcnLdV() const
QMap< QString, SgVlbiStationInfo * > & stationsByName()
Definition: SgVlbiBand.h:368
SgVlbiHistory & history()
Definition: SgVlbiBand.h:360
@ Attr_ESTIMATE_CLOCKS
estimate baseline clocks;
@ Attr_NOT_VALID
omit the baseline;
void addHistoryRecord(const QString &, const SgMJD &t)
double getEffFreq() const
double getGeocenterValue() const
short int getUnweightFlag() const
double getAmbiguitySpacing() const
double ambiguity() const
double getValue() const
int getNumOfAmbiguities() const
double getSigma() const
double getIonoValue() const
double getEffFreqEqWgt() const
double getResidualFringeFitting() const
int getNumOfSubAmbigs() const
double getAlternateValue() const
void setUnweightFlag(short int)
double getIonoSigma() const
QVector< int > * corelIndexNumLSB()
const QString & getFourfitOutputFName() const
double getUvFrPerAsec(int i) const
double getPhaseCalGrDelays(int i) const
int getQualityFactor() const
const SgMJD & getEpochOfCorrelation() const
double getSampleRate() const
QVector< char > * polarization_1ByChan()
double getInstrDelay(int i) const
SgVector * loFreqByChan_1()
QVector< char > * chanIdByChan()
QVector< int > * corelIndexNumUSB()
double getFourfitSearchParameters(int i) const
int getNumOfChannels() const
const QString & getTapeQualityCode() const
SgMatrix * phaseCalData_2ByChan()
const QString & getErrorCode() const
const SgMJD & getEpochOfScan() const
double getIncohChanAddAmp() const
SgVector * numOfAccPeriodsByChan_LSB()
double getAcceptedRatio() const
const SgMJD & getEpochOfFourfitting() const
double getCalcFeedCorrDelay() const
double getProbabOfFalseDetection() const
QVector< char > * polarization_2ByChan()
SgVector * numOfAccPeriodsByChan_USB()
QVector< int > * bbcIdxByChan_1()
SgVlbiMeasurement & phDRate()
double getCorrelZdelay_1() const
double getGeocenterTotalPhase() const
double getEffIntegrationTime() const
const SgMJD & getTstop() const
double getCorrClocks(int i, int j) const
SgVector * fringeAmplitudeByChan()
SgVector * vAuxData()
int getStartOffset() const
double getUrVr(int i) const
double getCentrOffset() const
SgVector * numOfSamplesByChan_LSB()
double getAprioriDra(int i) const
double getCorrelStarElev_2() const
double getDiscardRatio() const
int getNlags() const
double getTotalPhase() const
SgVector * vDlys()
int getHopsRevisionNumber() const
int getFourfitVersion(int idx) const
const QString & getFourfitControlFile() const
double getIncohSegmAddAmp() const
int getStopOffset() const
double getSnr() const
SgMatrix * phaseCalData_1ByChan()
const QString & getBandKey() const
SgVector * numOfSamplesByChan_USB()
const QString & getFourfitCommandOverride() const
double getPhaseCalRates(int i) const
double getCalcFeedCorrRate() const
double getReferenceFrequency() const
SgVlbiMeasurement & phDelay()
double getCorrelStarElev_1() const
int getBitsPerSample() const
const SgMJD & getEpochCentral() const
double getCorrCoeff() const
SgVector * loFreqByChan_2()
SgVlbiMeasurement & grDelay()
SgVlbiMeasurement & sbDelay()
SgVector * fringePhaseByChan()
double getGeocenterResidPhase() const
SgVector * refFreqByChan()
int getMediaIdx() const
QVector< int > * bbcIdxByChan_2()
const SgMJD & getTstart() const
double getCorrelZdelay_2() const
double getDrat_dCipY() const
double getCalcCipXv() const
double getCalcNutWahr_dEpsV() const
double getCalcTiltRemvrRate() const
double getCalcPoleTideOldDelay() const
const Sg3dVector & getVearth() const
double getCalcCipSr() const
double getCalcTiltRemvrDelay() const
SgVlbiStationInfo * stn_1()
const Sg3dMatrix & getTrf2crfAcc() const
double getCalcOceanPoleTideLdDelay() const
double getCalcConsBendingSunRate() const
SgVlbiAuxObservation * auxObs_2()
double getCalcNutWahr_dPsiV() const
double getCalcPmX() const
SgVlbiSourceInfo * src()
double getCalcPxDelay() const
double getCalcOceanTideDelay() const
double getDdel_dDN() const
double getDdel_dParallaxRev() const
double getCalcOceanPoleTideLdRate() const
double getDTecStdDev() const
double getCalcNut2006_dPsiV() const
const Sg3dVector & getRmoon() const
const Sg3dMatrix & getTrf2crfVal() const
double getCalcCipYv() const
double getDrat_dGamma() const
double getCalcPyDelay() const
double getDdel_dBend() const
const Sg3dVector & getVsun() const
double getDdel_dPy() const
double getCalcConsBendingSunHigherRate() const
double getApLength() const
double getDrat_dPx() const
double getCalcNutWahr_dPsiR() const
double getDdel_dPolTideX() const
double getCalcConsBendingSunDelay() const
double getCalcCipXr() const
double getCalcPoleTideOldRate() const
double getCalcConsBendingSunHigherDelay() const
double getCalcNut2006_dEpsV() const
double getCalcConsBendingDelay() const
double getCalcEarthTideDelay() const
const Sg3dVector & getDdel_dR_1() const
double getCalcConsensusRate() const
double getFractC() const
double getCalcHiFyPxyRate() const
double getD2rat_dUT12() const
double getDrat_dCipX() const
double getCalcCipYr() const
double getDrat_dPolTideY() const
double getCalcPxRate() const
double getCalcPyRate() const
const Sg3dVector & getRearth() const
double getCalcPoleTideRate() const
double getDrat_dBend() const
double getCalcCipSv() const
double getCalcHiFyUt1LibrationRate() const
SgVlbiStationInfo * stn_2()
const Sg3dVector & getVmoon() const
const QString & getCorrRootFileName() const
double getDdel_dCipY() const
double getCalcNut2006_dPsiR() const
double getCalcHiFyPxyLibrationRate() const
double getDTec() const
SgVlbiObservable * observable(const QString &)
double getD2del_dUT12() const
double getDrat_dUT1() const
double getCalcConsBendingRate() const
const Sg3dMatrix & getTrf2crfRat() const
double getCalcEarthTideRate() const
const QString & getScanName() const
double getDdel_dPx() const
double getDrat_dPy() const
const Sg3dVector & getDrat_dR_1() const
QMap< QString, SgVlbiObservable * > & observableByKey()
double getCalcHiFyPxyLibrationDelay() const
const QString & getScanId() const
double getDrat_dPolTideX() const
double getCalcPmY() const
double getDdel_dUT1() const
double getDrat_dRA() const
double getDrat_dParallax() const
SgVlbiAuxObservation * auxObs_1()
double getDdel_dParallax() const
double getDdel_dGamma() const
double getCalcNut2006_dEpsR() const
double getCalcOceanTideRate() const
double getCalcNutWahr_dEpsR() const
double getCalcPoleTideDelay() const
double getCalcHiFyUt1Delay() const
const Sg3dVector & getRsun() const
double getCalcOceanTideOldDelay() const
double getCalcConsensusDelay() const
double getDdel_dPolTideY() const
double getDrat_dDN() const
const Sg3dVector & getAearth() const
double getCalcHiFyPxyDelay() const
double getCalcHiFyUt1Rate() const
double getCalcHiFyUt1LibrationDelay() const
double getDrat_dParallaxRev() const
double getCalcUt1_Tai() const
double getDdel_dCipX() const
double getDdel_dRA() const
double getCalcOceanTideOldRate() const
const QString & getCorrelatorType() const
@ OT_MK4
observations are from Mk4-compatible correlator output;
@ OT_AGV
observations are in AGV format;
@ OT_KOMB
observations are from KOMB output (generated by NICT, Japan);
CorrelatorPostProcSoftware cppsSoft_
@ Attr_FF_AUX_OBS_MODIFIED
station log related data were modified; //vgosDbProcLogs
@ Attr_FF_EDIT_INFO_MODIFIED
edit info has been modified by user;
@ Attr_FF_WEIGHTS_CORRECTED
weights have been corrected;
@ Attr_FF_ION_C_CALCULATED
ionospheric corrections have been calculated;
@ Attr_FF_CALC_DATA_MODIFIED
the theoretical values were modified; //vgosDbCalc
@ Attr_FF_PHASE_DEL_USED
station clocks or zenith delays were set.
@ Attr_FF_OUTLIERS_PROCESSED
outliers have been processed;
@ Attr_HAS_DTEC
the session contains diffTec values;
@ Attr_FF_AMBIGS_RESOLVED
ambiguities have been resolved;
@ Attr_FF_CREATED
the session has been imported from correlator;//vgosDbMake
SgMJD tFinis_
last epoch of the observations;
OriginType getOriginType() const
QString correlatorType_
Type of the correlator;.
QString sessionCode_
official session code (from Masterfile);
QString piAgencyName_
Name of P.I. organization.
QString description_
Experiment description;.
QString correlatorName_
Correlator Name (from MasterFile)
OriginType originType_
type of origin of the imported file(s);
QString name_
name of the session (e.g., 10JUL22XE);
SgMJD tStart_
first epoch of the observations;
StationsByName stationsByName_
QList< SgVlbiBand * > & bands()
QList< SgVlbiBand * > bands_
void formObsCalibrationSetup(int &bitFlags, QList< QString > &calList)
SgVector * args4PxyInterpolation_
double getLeapSeconds()
void makeHistoryIntro(SgVlbiHistory &)
QMap< QString, SgVlbiBand * > bandByKey_
QList< SgVlbiObservation * > observations_
SgVlbiHistory contemporaryHistory_
SgModelsInfo calcInfo_
BaselinesByName baselinesByName_
void makeHistory(SgVlbiHistory &)
SgParametersDescriptor * parametersDescriptor_
SgVlbiBand * primaryBand_
bool putDataIntoVgosDb(SgVgosDb *vgosDb)
static QString className()
SgVector * args4Ut1Interpolation_
SgMatrix * tabs4Ut1Interpolation_
SourcesByName sourcesByName_
SgTaskConfig * config_
SgMatrix * tabs4PxyInterpolation_
double getRA() const
double getDN() const
const QString & getAprioriReference() const
QMap< QString, SgVlbiAuxObservation * > * auxObservationByScanId()
void calcCBEpochs4Export(const QMap< QString, SgVlbiAuxObservation * > &)
QVector< QString > & tsysIfSideBands()
CableCalsOrigin getCableCalsOrigin() const
QVector< double > & tsysIfFreqs()
double getAxisOffset() const
QVector< QString > & tsysIfIds()
const QString & getTectonicPlateName() const
@ Attr_NOT_VALID
omit the station;
@ Attr_REFERENCE_CLOCKS
the clocks are the reference ones;
@ Attr_HAS_CABLE_CAL
a station has cable calibration readings;
@ Attr_IGNORE_CABLE_CAL
do not apply cable calibration;
@ Attr_METEO_MODIFIED
a station has meteo parameters;
@ 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;
@ Attr_CABLE_CAL_MODIFIED
a station has cable calibration readings;
@ Attr_HAS_METEO
a station has meteo parameters;
MeteoDataOrigin getMeteoDataOrigin() const
static int mntType2int(MountingType)
const SgParameterCfg & getPcClocks() const
const Sg3dVector & getR()
double getCableCalMultiplierDBCal() const
const SgParameterCfg & getPcZenith() const
const QString & getCableCalsOriginTxt() const
double getTilt(int i) const
MountingType getMntType() const
SgBreakModel & clockBreaks()
double getAPrioriClockTerm_1() const
bool getNeed2useAPrioriClocks() const
double getAPrioriClockTerm_0() const
const QString & getMeteoDataOriginTxt() const
QVector< QString > & tsysIfPolarizations()