General Purpose Geodetic Library
SgVlbiSessionIoSupport.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/QDir>
28 #include <QtCore/QFile>
29 #include <QtCore/QRegularExpression>
30 #include <QtCore/QTextStream>
31 
32 
33 #include <SgVlbiSession.h>
34 
35 #include <SgLogger.h>
36 
37 
38 
39 
40 /*=======================================================================================================
41 *
42 * Auxiliary data structures
43 *
44 *======================================================================================================*/
45 extern const QString sStationCalibrationList[]=
46  { "CABL DEL", "UNPHASCL", "NDRYCONT", "NWETCONT", " ", "WVR DELY" };
47 
48 extern const QString sFlybyCalibrationList[]=
49  { "CFAKBDRY", "CFAKBWET", "CFAJJDRY", "IFADRFLY", "IFADRYSS", "MTTDRFLY", "MTTDRYSS", "NMFDRFLY" };
50 
51 extern const QString sObsCalibrationList_v10[]=
52  { "PTD CONT", "WOBXCONT", "WOBYCONT", "ETD CONT", "OCE CONT", "PTOLDCON",
53  "UT1ORTHO", "WOBORTHO", "WOBNUTAT", "FEED.COR", "WAHRCONT", "TILTRMVR" };
54 
55 extern const QString sObsCalibrationList_v11[]=
56  { "PTD CONT", "WOBXCONT", "WOBYCONT", "ETD CONT", "OCE CONT", "UT1ORTHO", "WOBORTHO",
57  "WOBLIBRA", "UT1LIBRA", "OPTLCONT", "FEED.COR", "OCE_OLD ", "TILTRMVR", "PTOLDCON" };
58 
59 extern const QString sAntennaMountTypes[]=
60  {"AZEL", "EQUA", "X_YN", "X_YE", "RICHMOND", "UNKN"};
61 
63 {
76 };
78 {
93 };
94 
95 
96 
97 /*=======================================================================================================
98 *
99 * I/O support:
100 *
101 *======================================================================================================*/
102 //
103 bool SgVlbiSession::guessWrapperFileNameBySession(const QString& inputArg, const QString& path2VgosDb,
104  const QString& acAbbName,
105  QString& path2wrapperFile, QString& wrapperFileName, QString& sessionName, int& version, bool noYears)
106 {
107  // here inputArg is a session name with or without version part, e.g.:
108  // 15AUG01XK_V004
109  // 15AUG01XK
110  //
112  "::guessWrapperFileNameBySession(): processing: " + inputArg);
113  bool isOk;
114  int nn;
115  QString vVer("");
116  QString kKind("");
117  QString iInst("");
118  QString sYr("");
119  //QRegExp reVer(".*_V([0-9]{3}).*");
120  QRegularExpression reVer(".*_V([0-9]{3}).*");
121  QRegularExpression reOldDbName("^(\\d{2}[A-Z]{3}\\d{2}[A-Z0-9]{1,2}).*");
122  QRegularExpression reNewDbName("^(\\d{8})-([^\\s_]{2,12}).*");
123  QRegularExpressionMatch match;
124  version = -1;
125  //
126  // guess version number, if provided:
127  if ((match=reVer.match(inputArg)).hasMatch())
128  {
129  nn = match.captured(1).toInt(&isOk);
130  if (isOk)
131  {
132  version = nn;
133  vVer.sprintf("_V%03d", version);
135  "::guessWrapperFileNameBySession(): user provided version is: " + QString("").setNum(version));
136  }
137  else
138  {
140  "::guessWrapperFileNameBySession(): cannot guess the version number form: \"" + inputArg + "\"");
141  return false;
142  };
143  };
144 
145  if ((match=reOldDbName.match(inputArg)).hasMatch()) // dbName: 12JUL16XA
146  {
147  sessionName = match.captured(1);
148  sYr = sessionName.left(2);
149  }
150  else if ((match=reNewDbName.match(inputArg)).hasMatch())
151  {
152  sessionName = match.captured(1) + "-" + match.captured(2);
153  sYr = sessionName.left(4);
154  };
155  //
156  //
157  path2wrapperFile = path2VgosDb;
158  if (path2wrapperFile.right(1) == '/')
159  path2wrapperFile.chop(1);
160  //
161  //
162  if (!noYears)
163  {
164  nn = sYr.toInt();
165  if (77 < nn && nn < 100)
166  nn += 1900;
167  else if (nn < 40)
168  nn += 2000;
169  sYr.sprintf("%4d", nn);
170  if (path2wrapperFile.right(4) != sYr)
171  path2wrapperFile += "/" + sYr;
172  };
173  path2wrapperFile += "/" + sessionName;
174  //
175  //
176  if (!QDir(path2wrapperFile).exists())
177  {
179  "::guessWrapperFileNameBySession(): the input directory \"" + path2wrapperFile +
180  "\" does not exist");
181  return false;
182  }
183  else
185  "::guessWrapperFileNameBySession(): the path to the wrapper file is: \"" + path2wrapperFile +
186  "\"");
187 
188 
189 //std::cout << " +++ 1: "
190 //<< "version = " << version << " "
191 //<< "sessionName = [" << qPrintable(sessionName) << "] "
192 //<< "path2wrapperFile = [" << qPrintable(path2wrapperFile) << "] "
193 //<< "vVer = [" << qPrintable(vVer) << "] "
194 //<< "sYr = [" << qPrintable(sYr) << "] "
195 //<< "\n";
196 
197 
198  // look up the file:
199  QStringList fltList;
200  fltList << sessionName + vVer + "*.wrp";
201  QStringList fList=QDir(path2wrapperFile).entryList(fltList,
202  QDir::Files | QDir::Readable, QDir::Name);
203  if (fList.size() == 0)
204  {
206  "::guessWrapperFileNameBySession(): no any wrapper file was found in \"" + path2wrapperFile +
207  "\"");
208  return false;
209  }
210  else if (fList.size() == 1)
211  {
212 //std::cout << " +++ 2: "
213 //<< "fList.at(0) = [" << qPrintable(fList.at(0)) << "] "
214 //<< "\n";
215  wrapperFileName = fList.at(0);
216  if (version == -1)
217  {
218  if ((match=reVer.match(wrapperFileName)).hasMatch())
219  {
220  nn = match.captured(1).toInt(&isOk);
221  if (isOk)
222  {
223  version = nn;
225  "::guessWrapperFileNameBySession(): guessed version is: " + QString("").setNum(version));
226  }
227  else
228  {
230  "::guessWrapperFileNameBySession(): cannot guess the version number form: \"" +
231  wrapperFileName + "\"");
232  return false;
233  };
234  };
235  };
237  "::guessWrapperFileNameBySession(): the wrapper file name is: \"" + wrapperFileName + "\"");
238  return true;
239  }
240  else
241  {
242  if (version == -1)
243  {
244  // find out the largest version number (the list is sorted by name):
245  QString str=fList.at(fList.size() - 1);
246 // QRegExp reSn(".*([0-9]{2}[A-Z]{3}[0-9]{2}[A-Z0-9]{1,2})_V([0-9]{3}).*");
247  QRegularExpression reSn("^(\\d{2}[A-Z]{3}\\d{2}[A-Z0-9]{1,2}|\\d{8}-[\\S]{2,12})_V([0-9]{3}).*");
248 
249  QString sVer("");
250 // if (-1 < reSn.indexIn(str))
251  if ((match=reSn.match(str)).hasMatch())
252  {
253 //std::cout << " +++ 3: "
254 //<< "match.capture(1) = [" << qPrintable(match.captured(1)) << "] "
255 //<< "match.capture(2) = [" << qPrintable(match.captured(2)) << "] "
256 //<< "\n";
257  vVer = match.captured(2);
258  bool isOk;
259  int nn;
260  nn = vVer.toInt(&isOk);
261  if (isOk)
262  {
263  version = nn;
264  vVer.sprintf("_V%03d", version);
266  "::guessWrapperFileNameBySession(): guessed version is: " + QString("").setNum(version));
267  }
268  else
269  {
271  "::guessWrapperFileNameBySession(): cannot guess a database version from the file \"" +
272  str + "\"");
273  return false;
274  };
275  }
276  else
277  {
279  "::guessWrapperFileNameBySession(): cannot parse the string \"" + str +
280  "\", need to update the template");
281  return false;
282  };
283  //
284  fList.clear();
285  fltList.clear();
286  fltList << sessionName + vVer + "*.wrp";
287  fList = QDir(path2wrapperFile).entryList(fltList, QDir::Files | QDir::Readable, QDir::Name);
288  if (fList.size() == 1) // if only one file, stop searching:
289  {
290  wrapperFileName = fList.at(0);
292  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" + wrapperFileName +
293  "\"");
294  return true;
295  };
296  };
297  // ok, at this point all files have the same version.
298  QStringList noK, kAll;
299  for (int i=0; i<fList.size(); i++)
300  {
301  if (fList.at(i).contains("_kall", Qt::CaseInsensitive))
302  kAll << fList.at(i);
303  if (!fList.at(i).contains("_k", Qt::CaseInsensitive))
304  noK << fList.at(i);
305  };
306  if (noK.size() == 1)
307  {
308  wrapperFileName = noK.at(0);
310  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" + wrapperFileName + "\"");
311  return true;
312  }
313  else if (kAll.size() == 1)
314  {
315  wrapperFileName = kAll.at(0);
317  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" + wrapperFileName + "\"");
318  return true;
319  }
320  else if (/*noK.size() == 0 &&*/ 1 < kAll.size()) // more than one _kall:
321  {
322  QStringList noI, iUs, iIvs;
323  QString usId("_i"), ivsId("_iIVS");
324  usId += acAbbName;
325  for (int i=0; i<kAll.size(); i++)
326  {
327  if (kAll.at(i).contains(usId, Qt::CaseInsensitive))
328  iUs << kAll.at(i);
329  if (kAll.at(i).contains(ivsId, Qt::CaseInsensitive))
330  iIvs << kAll.at(i);
331 
332  if (!kAll.at(i).contains("_i", Qt::CaseInsensitive))
333  noI << kAll.at(i);
334  };
335  if (iUs.size() == 1)
336  {
337  wrapperFileName = iUs.at(0);
339  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" +
340  wrapperFileName + "\"");
341  return true;
342  }
343  if (iIvs.size() == 1)
344  {
345  wrapperFileName = iIvs.at(0);
347  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" +
348  wrapperFileName + "\"");
349  return true;
350  }
351  else if (noI.size() == 1)
352  {
353  wrapperFileName = noI.at(0);
355  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" +
356  wrapperFileName + "\"");
357  return true;
358  }
359  else if (1 < iUs.size())
360  {
361  wrapperFileName = iUs.at(0);
363  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" +
364  wrapperFileName + "\"");
365  return true;
366  }
367  else if (1 < iIvs.size())
368  {
369  wrapperFileName = iIvs.at(0);
371  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" +
372  wrapperFileName + "\"");
373  return true;
374  }
375  else if (1 < noI.size())
376  {
377  wrapperFileName = noI.at(0);
379  "::guessWrapperFileNameBySession(): guessed the wrapper file name: \"" +
380  wrapperFileName + "\"");
381  return true;
382  }
383  else
384  {
385  wrapperFileName = kAll.at(0);
387  "::guessWrapperFileNameBySession(): guessed the wrapper file name (last resort): \"" +
388  wrapperFileName + "\"");
389  return true;
390  };
391  }
392  else
393  {
395  "::guessWrapperFileNameBySession(): cannot guess wrapper file name: noK.size()=" +
396  QString("").setNum(noK.size()) + ", kAll.size()=" + QString("").setNum(kAll.size()) );
397  return false;
398  };
399  };
400  //
401  return true;
402 };
403 
404 
405 
406 //
407 bool SgVlbiSession::guessSessionByWrapperFileName(const QString& inputArg, const QString& path2VgosDb,
408  QString& path2wrapperFile, QString& wrapperFileName, QString& sessionName, int& version)
409 {
411  "::guessSessionByWrapperFileName(): processing: " + inputArg);
412  //
413  // split input on path and filename:
414  int idx=inputArg.lastIndexOf("/");
415  if (idx == -1)
416  {
417  path2wrapperFile = ".";
418  wrapperFileName = inputArg;
419  }
420  else if (idx == 0) // ?
421  {
422  path2wrapperFile = "/";
423  wrapperFileName = inputArg.mid(1);
424  }
425  else
426  {
427  path2wrapperFile = inputArg.left(idx);
428  wrapperFileName = inputArg.mid(idx + 1);
429  };
430  // add the default path:
431  if (path2wrapperFile.at(0) != QChar('/') && path2wrapperFile.at(0) != QChar('.'))
432  {
433  path2wrapperFile = path2VgosDb + "/" + path2wrapperFile;
435  "::guessSessionByWrapperFileName(): the path to wrapper file has been modified to \"" +
436  path2wrapperFile + "\"");
437  };
438  //
439  // check for existance:
440  if (!QFile::exists((path2wrapperFile.size()?path2wrapperFile + "/" : "") + wrapperFileName))
441  {
443  "::guessSessionByWrapperFileName(): the provided file, " + path2wrapperFile + "/" +
444  wrapperFileName + ", does not exist");
445  return false;
446  };
447  //
448  //
450 // QRegExp reSn(".*([0-9]{2}[A-Z]{3}[0-9]{2}[A-Z0-9]{1,2})_V([0-9]{3}).*");
451  QString sVer("");
452  QRegularExpression reOldDbName(".*(\\d{2}[A-Z]{3}\\d{2}[A-Z0-9]{1,2})_V([0-9]{3}).*");
453  QRegularExpression reNewDbName(".*(\\d{8})-([\\S]{2,12})_V([0-9]{3}).*");
454  QRegularExpressionMatch match;
455 
456  if ((match=reOldDbName.match(inputArg)).hasMatch()) // dbName: 12JUL16XA
457  {
458  sessionName = match.captured(1);
459  sVer = match.captured(2);
460  }
461  else if ((match=reNewDbName.match(inputArg)).hasMatch()) // dbName: 20120716-r1542
462  {
463  sessionName = match.captured(1) + "-" + match.captured(2);
464  sVer = match.captured(3);
465  }
466  else
467  {
469  "::guessSessionByWrapperFileName(): cannot guess a database name from the string \"" +
470  inputArg + "\"");
471  return false;
472  };
473  bool isOk;
474  int v;
475  v = sVer.toInt(&isOk);
476  if (isOk)
477  version = v;
478  else
480  "::guessSessionByWrapperFileName(): cannot guess a database version from the string \"" +
481  inputArg + "\"");
482  //
483  return true;
484 };
485 
486 
487 
488 //
489 void SgVlbiSession::applyObsCalibrationSetup(int bitFlags, const QList<QString> &calList)
490 {
491  int num=calList.size();
492  if ((calcInfo_.getDversion()<11.0 && num!=12) ||
493  (calcInfo_.getDversion()>=11.0 && num!=14) )
494  {
496  "::applyObsCalibrationSetup(): for the version " + QString("").setNum(calcInfo_.getDversion()) +
497  " of CALC the size of calibration list is unexpected, " + QString("").setNum(num) +
498  "; it have to be " + QString("").setNum(calcInfo_.getDversion()<11.0?12:14));
499  // return;
500  };
501  if (bitFlags == 0)
502  {
504  "::applyObsCalibrationSetup(): all the bit flags are zeros, nothing to apply");
505  return;
506  };
507 
508  //
509  // clear all flags that can be overwritten from database setup:
525  bool isOn;
526  for (int i=0; i<num; i++)
527  {
528  const QString &str=calList.at(i);
529  isOn = bitFlags & (1<<i);
530  if (str == "PTD CONT")
532  else if (str == "WOBXCONT")
534  else if (str == "WOBYCONT")
536  else if (str == "ETD CONT")
538  else if (str == "OCE CONT")
540  else if (str == "UT1ORTHO")
542  else if (str == "WOBORTHO")
544  else if (str == "WOBNUTAT")
546  else if (str == "FEED.COR")
548  else if (str == "TILTRMVR")
550  else if (str == "WOBLIBRA")
552  else if (str == "UT1LIBRA")
554  else if (str == "OPTLCONT")
556  else if (str == "OCE_OLD ")
558  else if (str == "PTOLDCON")
560  else if (str == "WAHRCONT")
561  {}
562  else
564  "::applyObsCalibrationSetup(): got an unexpected contribution code: " + str + "; ignored");
565  };
568  "::applyObsCalibrationSetup(): calibration set up has been applied assuming version #" +
569  QString("").setNum(calcInfo_.getDversion()) + " of CALC");
570 };
571 
572 
573 
574 //
576 {
577  bitFlags = 0;
578  calList.clear();
579  if (calcInfo_.getDversion() < 11.0)
580  {
581  for (int i=0; i<12; i++)
582  calList << sObsCalibrationList_v10[i];
583  //
585  bitFlags += 1 << O10_OCEAN_TIDE;
587  bitFlags += 1 << O10_POLE_TIDE;
589  bitFlags += 1 << O10_EARTH_TIDE;
591  bitFlags += 1 << O10_WOBBLE_X;
593  bitFlags += 1 << O10_WOBBLE_Y;
595  bitFlags += 1 << O10_WOB_NUTAT;
597  bitFlags += 1 << O10_WOB_ORTHO;
599  bitFlags += 1 << O10_UT1_ORTHO;
601  bitFlags += 1 << O10_FEED_ROT;
603  bitFlags += 1 << O10_TILT_RMVR;
605  bitFlags += 1 << O10_POLE_TIDE_OLD;
606  }
607  else
608  {
609  for (int i=0; i<14; i++)
610  calList << sObsCalibrationList_v11[i];
611  //
613  bitFlags += 1 << O11_OCEAN_TIDE;
615  bitFlags += 1 << O11_POLE_TIDE;
617  bitFlags += 1 << O11_EARTH_TIDE;
619  bitFlags += 1 << O11_WOBBLE_X;
621  bitFlags += 1 << O11_WOBBLE_Y;
623  bitFlags += 1 << O11_OCN_POLE_TIDE;
625  bitFlags += 1 << O11_WOB_LIBRA;
627  bitFlags += 1 << O11_UT1_LIBRA;
629  bitFlags += 1 << O11_WOB_ORTHO;
631  bitFlags += 1 << O11_UT1_ORTHO;
633  bitFlags += 1 << O11_FEED_ROT;
635  bitFlags += 1 << O11_TILT_RMVR;
637  bitFlags += 1 << O11_OCEAN_TIDE_OLD;
639  bitFlags += 1 << O11_POLE_TIDE_OLD;
640  };
642  "::formObsCalibrationSetup(): calibration set up has been formed assuming version #" +
643  QString("").setNum(calcInfo_.getDversion()) + " of CALC");
644 };
645 
646 
647 
648 //
649 void SgVlbiSession::importMapFile(const QString& mapFileName, QMap<QString, QString>& map4Stn,
650  QMap<QString, QString>& map4Src, QMap<QString, QString>& map4Bnd)
651 {
652  if (map4Stn.size())
653  map4Stn.clear();
654  if (map4Src.size())
655  map4Src.clear();
656  if (!mapFileName.size()) // empty string, nothing to do (even complain)
657  return;
658  //
659  //
660  QFile f(mapFileName);
661  if (!f.exists())
662  {
664  "::importMapFile(): the map file [" + f.fileName() + "] does not exist");
665  return;
666  }
667  else
668  {
669  if (f.open(QFile::ReadOnly))
670  {
671  QTextStream s(&f);
672  QString str(""), from(""), to("");
673  int numOfStrs, numOfSrc, numOfStn, numOfBnd;
674  QRegExp reStn("^stn:\\s*([0-9A-Z]{1}[\\.0-9A-Z\\s_+-]{1,6}[0-9A-Z_]{1})\\s*=>"
675  "\\s*([0-9A-Z-]{1}[0-9A-Z\\s_+-]{1,6}[0-9A-Z_-]{1}).*");
676  QRegExp reSrc("^src:\\s*([0-9A-Z]{1}[\\.0-9A-Z\\s_+-]{1,6}[0-9A-Z_]{1})\\s*=>"
677  "\\s*([0-9A-Z-]{1}[0-9A-Z\\s_+-]{1,6}[0-9A-Z_-]{1}).*");
678  QRegExp reBnd("^bnd:\\s*([0-9A-Za-z]{1,2})\\s*=>\\s*([0-9A-Za-z-]{1,3}).*");
679  numOfStrs = numOfSrc = numOfStn = numOfBnd = 0;
680  while (!s.atEnd())
681  {
682  str = s.readLine();
683  numOfStrs++;
684  if (str.size())
685  {
686  if (-1 < reStn.indexIn(str))
687  {
688  if (reStn.cap(2) == sSkipCode_)
689  {
690  from = reStn.cap(1).leftJustified(8, ' ', true);
691  if (!map4Stn.contains(from))
692  map4Stn.insert(from, sSkipCode_);
693  else
694  map4Stn[from] = sSkipCode_;
696  "::importMapFile(): the station \"" + from + "\" will be excluded from the session");
697  }
698  else
699  {
700  from = reStn.cap(1).leftJustified(8, ' ', true);
701  to = reStn.cap(2).leftJustified(8, ' ', true);
702  if (!map4Stn.contains(from))
703  {
704  map4Stn.insert(from, to);
706  "::importMapFile(): a station map record added: \"" + from + "\" => \"" + to + "\"");
707  }
708  else if (map4Stn.value(from) == to)
710  "::importMapFile(): a station map record \"" + from + "\" => \"" + to +
711  "\" is already in the map");
712  else
714  "::importMapFile(): an attempt to change a station map record \"" + from +
715  "\" => \"" + to + "\"; ignored");
716  };
717  }
718  else if (str.left(4) == "stn:")
720  "::importMapFile(): cannot parse a station map string: \"" + str + "\"");
721  //
722  // sources:
723  if (-1 < reSrc.indexIn(str))
724  {
725  if (reSrc.cap(2) == sSkipCode_)
726  {
727  from = reSrc.cap(1).leftJustified(8, ' ', true);
728  if (!map4Src.contains(from))
729  map4Src.insert(from, sSkipCode_);
730  else
731  map4Src[from] = sSkipCode_;
733  "::importMapFile(): the source \"" + from + "\" will be excluded from the session");
734  }
735  else
736  {
737  from = reSrc.cap(1).leftJustified(8, ' ', true);
738  to = reSrc.cap(2).leftJustified(8, ' ', true);;
739  if (!map4Src.contains(from))
740  {
741  map4Src.insert(from, to);
743  "::importMapFile(): a source map record added: \"" + from + "\" => \"" + to + "\"");
744  }
745  else if (map4Src.value(from) == to)
747  "::importMapFile(): a source map record \"" + from + "\" => \"" + to +
748  "\" is already in the map");
749  else
751  "::importMapFile(): an attempt to change a source map record \"" + from +
752  "\" => \"" + to + "\"; ignored");
753  };
754  }
755  else if (str.left(4) == "src:")
757  "::importMapFile(): cannot parse a source map string: \"" + str + "\"");
758  //
759  // bands:
760  if (-1 < reBnd.indexIn(str))
761  {
762  if (reBnd.cap(2) == sSkipCode_)
763  {
764  from = reBnd.cap(1).trimmed();
765  if (!map4Bnd.contains(from))
766  map4Bnd.insert(from, sSkipCode_);
767  else
768  map4Bnd[from] = sSkipCode_;
770  "::importMapFile(): the band \"" + from + "\" will be excluded from the session");
771  }
772  else
773  {
774  from = reBnd.cap(1).trimmed();
775  to = reBnd.cap(2).trimmed();
776  if (!map4Bnd.contains(from))
777  {
778  map4Bnd.insert(from, to);
780  "::importMapFile(): a band map record added: \"" + from + "\" => \"" + to + "\"");
781  }
782  else if (map4Bnd.value(from) == to)
784  "::importMapFile(): a band map record \"" + from + "\" => \"" + to +
785  "\" is already in the map");
786  else
788  "::importMapFile(): an attempt to change a band map record \"" + from +
789  "\" => \"" + to + "\"; ignored");
790  };
791  }
792  else if (str.left(4) == "bnd:")
794  "::importMapFile(): cannot parse a band map string: \"" + str + "\"");
795  };
796  };
797  f.close();
798  s.setDevice(NULL);
800  "::importMapFile(): read " + QString("").setNum(numOfStrs) +
801  " strings from the map file [" + f.fileName() + "]");
802  }
803  else
804  {
806  "::importMapFile(): cannot open the map file [" + f.fileName() + "] for read access");
807  return;
808  };
809  };
810 };
811 
812 
813 
814 
815 //
816 bool SgVlbiSession::check4NameMap(const QMap<QString, QString> &map, QString& name)
817 {
818  if (!map.size()) // nothing to do
819  return true;
820  if (map.contains(name))
821  {
822  if (map.value(name) == sSkipCode_)
823  {
825  "::check4stationNameMap(): the object \"" + name + "\" have to be skipped");
826  return false;
827  };
829  "::check4stationNameMap(): the input object name \"" + name + "\" is mapping to \"" +
830  map.value(name) + "\"");
831  name = map.value(name);
832  };
833  return true;
834 };
835 
836 
837 
838 
839 /*=====================================================================================================*/
840 
841 /*=====================================================================================================*/
SgLogger * logger
Definition: SgLogger.cpp:231
const QString sObsCalibrationList_v11[]
@ O10_POLE_TIDE_OLD
const QString sObsCalibrationList_v10[]
const QString sAntennaMountTypes[]
const QString sFlybyCalibrationList[]
@ O11_OCN_POLE_TIDE
@ O11_OCEAN_TIDE_OLD
@ O11_POLE_TIDE_OLD
const QString sStationCalibrationList[]
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ IO_TXT
Definition: SgLogger.h:65
@ IO_DBH
Definition: SgLogger.h:67
@ SESSION
Definition: SgLogger.h:77
double getDversion() const
Definition: SgModelsInfo.h:114
void setHave2ApplyUt1OceanTideHFContrib(bool b)
Definition: SgTaskConfig.h:616
bool getHave2ApplyNutationHFContrib() const
Definition: SgTaskConfig.h:386
bool getHave2ApplyOldPoleTideContrib() const
Definition: SgTaskConfig.h:393
void setContribsAreFromDatabase(bool b)
Definition: SgTaskConfig.h:608
void setHave2ApplyEarthTideContrib(bool b)
Definition: SgTaskConfig.h:611
void setHave2ApplyOceanPoleTideContrib(bool b)
Definition: SgTaskConfig.h:621
void setHave2ApplyTiltRemvrContrib(bool b)
Definition: SgTaskConfig.h:623
bool getHave2ApplyEarthTideContrib() const
Definition: SgTaskConfig.h:379
bool getHave2ApplyPyContrib() const
Definition: SgTaskConfig.h:378
bool getHave2ApplyOceanTideContrib() const
Definition: SgTaskConfig.h:380
bool getHave2ApplyUt1OceanTideHFContrib() const
Definition: SgTaskConfig.h:384
bool getHave2ApplyPxyOceanTideHFContrib() const
Definition: SgTaskConfig.h:385
void setHave2ApplyOceanTideContrib(bool b)
Definition: SgTaskConfig.h:612
bool getHave2ApplyOldOceanTideContrib() const
Definition: SgTaskConfig.h:392
bool getHave2ApplyPoleTideContrib() const
Definition: SgTaskConfig.h:381
void setHave2ApplyPoleTideContrib(bool b)
Definition: SgTaskConfig.h:613
void setHave2ApplyOldPoleTideContrib(bool b)
Definition: SgTaskConfig.h:625
bool getHave2ApplyPxyLibrationContrib() const
Definition: SgTaskConfig.h:388
void setHave2ApplyPxyOceanTideHFContrib(bool b)
Definition: SgTaskConfig.h:617
bool getHave2ApplyTiltRemvrContrib() const
Definition: SgTaskConfig.h:391
void setHave2ApplyOldOceanTideContrib(bool b)
Definition: SgTaskConfig.h:624
bool getHave2ApplyPxContrib() const
Definition: SgTaskConfig.h:377
void setHave2ApplyPxyLibrationContrib(bool b)
Definition: SgTaskConfig.h:620
void setHave2ApplyPyContrib(bool b)
Definition: SgTaskConfig.h:610
void setHave2ApplyPxContrib(bool b)
Definition: SgTaskConfig.h:609
void setHave2ApplyFeedCorrContrib(bool b)
Definition: SgTaskConfig.h:622
void setHave2ApplyNutationHFContrib(bool b)
Definition: SgTaskConfig.h:618
void setHave2ApplyUt1LibrationContrib(bool b)
Definition: SgTaskConfig.h:619
bool getHave2ApplyFeedCorrContrib() const
Definition: SgTaskConfig.h:390
bool getHave2ApplyUt1LibrationContrib() const
Definition: SgTaskConfig.h:387
void formObsCalibrationSetup(int &bitFlags, QList< QString > &calList)
void applyObsCalibrationSetup(int bitFlags, const QList< QString > &calList)
static bool guessSessionByWrapperFileName(const QString &inputArg, const QString &path2VgosDb, QString &path2wrapperFile, QString &wrapperFileName, QString &sessionName, int &version)
SgModelsInfo calcInfo_
void importMapFile(const QString &mapFileName, QMap< QString, QString > &map4Stn, QMap< QString, QString > &map4Src, QMap< QString, QString > &map4Bnd)
static bool guessWrapperFileNameBySession(const QString &inputArg, const QString &path2VgosDb, const QString &acAbbName, QString &path2wrapperFile, QString &wrapperFileName, QString &sessionName, int &version, bool noYears=false)
static const QString sSkipCode_
static QString className()
SgTaskConfig * config_
bool check4NameMap(const QMap< QString, QString > &map, QString &name)