General Purpose Geodetic Library
SgVgosDbLoadStation.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 
24 
25 #include <math.h>
26 
27 #include <SgLogger.h>
28 #include <SgNetCdf.h>
29 #include <SgVgosDb.h>
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 /*=====================================================================================================*/
41 /* */
42 /* SgVgosDb implementation (continue -- loadStation part of vgosDb data tree) */
43 /* */
44 /*=====================================================================================================*/
45 //
46 //
47 bool SgVgosDb::loadStationName(const QString& stnKey)
48 {
49  if (!stnDescriptorByKey_.contains(stnKey))
50  {
52  "::loadStationName(): unknown station " + stnKey);
53  return false;
54  };
56  if (dscr.vTimeUTC_.isEmpty())
57  {
59  "::loadStationName(): there is no epochs for the station " + stnKey +
60  ", the vgosDb variable TimeUTC is empty");
61  return false;
62  };
63  SgNetCdf ncdf(path2RootDir_ + "/" + dscr.vTimeUTC_.getFileName());
64  ncdf.getData();
65  if (!checkFormat(fcfTimeUTC, ncdf))
66  {
68  "::loadStationName(): format check failed");
69  return false;
70  };
71  //
72  SgNcdfVariable *svcV;
73  if ( (svcV=ncdf.lookupServiceVar(SgNetCdf::svcStation)) )
74  {
75  const char *c=svcV->data2char();
76  int l=svcV->dimensions().at(0)->getN();
77  dscr.stationName_ = QString::fromLatin1(c, l);
78  if (dscr.stationName_.size() < 8)
79  {
80  dscr.stationName_ = dscr.stationName_.leftJustified(8, ' '); // grrr..
81  };
82  }
83  else
84  {
86  "::loadStationName(): there is no service variable \"" + SgNetCdf::svcStation +
87  "\" for the station " + stnKey);
88  return false;
89  };
91  "::loadStationName(): found station name " + dscr.stationName_ +
92  " for the station key " + stnKey + " from the file " + ncdf.getFileName());
93  return true;
94 };
95 
96 
97 
98 
99 
100 
101 //
102 bool SgVgosDb::loadStationEpochs(const QString& stnName, QList<SgMJD>& epochs)
103 {
104  if (!stnDescriptorByName_.contains(stnName))
105  {
107  "::loadStationEpochs(): unknown station [" + stnName + "]");
108  return false;
109  };
111  if (dscr->vTimeUTC_.isEmpty())
112  {
114  "::loadStationEpochs(): there is no epochs for the station " + stnName +
115  ", the vgosDb variable TimeUTC is empty");
116  return false;
117  };
118  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vTimeUTC_.getFileName());
119  ncdf2.getData();
120  if (!checkFormat(fcfTimeUTC, ncdf2))
121  {
123  "::loadStationEpochs(): format check failed");
124  return false;
125  };
126  const double *pSeconds=ncdf2.lookupVar(fcSecond.name())->data2double();
127  const short *pYMDHM =ncdf2.lookupVar(fcYmdhm .name())->data2short();
128  dscr->numOfPts_ = ncdf2.lookupVar(fcSecond.name())->dimensions().at(0)->getN();
129  epochs.clear();
130  for (int i=0; i<dscr->numOfPts_; i++)
131  epochs.append( SgMJD(pYMDHM[5*i ], pYMDHM[5*i+1], pYMDHM[5*i+2], pYMDHM[5*i+3],
132  pYMDHM[5*i+4], pSeconds[i]));
133  if (epochs.size())
135  "::loadStationEpochs(): read " + QString("").setNum(epochs.size()) +
136  " epochs for the station " + stnName + " from " + ncdf2.getFileName());
137  return true;
138 };
139 
140 
141 
142 //
143 bool SgVgosDb::loadStationAzEl(const QString& stnName, SgMatrix* &azTheo, SgMatrix* &elTheo)
144 {
145  if (!stnDescriptorByName_.contains(stnName))
146  {
148  "::loadStationAzEl(): unknown station " + stnName);
149  return false;
150  };
152  if (dscr->vAzEl_.isEmpty())
153  {
155  "::loadStationAzEl(): there is no vgosDb variable AzEl for the station " + stnName);
156  return false;
157  };
158  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vAzEl_.getFileName());
159  ncdf2.getData();
160  if (!checkFormat(fcfAzEl, ncdf2))
161  {
163  "::loadStationAzEl(): format check failed");
164  return false;
165  };
166  azTheo = new SgMatrix(dscr->numOfPts_, 2);
167  elTheo = new SgMatrix(dscr->numOfPts_, 2);
168  const double *pAz=ncdf2.lookupVar(fcAzTheo.name())->data2double();
169  const double *pEl=ncdf2.lookupVar(fcElTheo.name())->data2double();
170  for (int i=0; i<dscr->numOfPts_; i++)
171  {
172  azTheo->setElement(i, 0, pAz[2*i ]);
173  azTheo->setElement(i, 1, pAz[2*i + 1]);
174  elTheo->setElement(i, 0, pEl[2*i ]);
175  elTheo->setElement(i, 1, pEl[2*i + 1]);
176  };
178  "::loadStationAzEl(): data successfully loaded from " + ncdf2.getFileName());
179  return true;
180 };
181 
182 
183 
184 //
185 bool SgVgosDb::loadStationParAngle(const QString& stnName, SgVector* &parAngle)
186 {
187  if (!stnDescriptorByName_.contains(stnName))
188  {
190  "::loadStationParAngle(): unknown station " + stnName);
191  return false;
192  };
194  if (dscr->vFeedRotation_.isEmpty())
195  {
197  "::loadStationParAngle(): there is no Vdb variable FeedRotation for the station " + stnName);
198  return false;
199  };
200  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vFeedRotation_.getFileName());
201  ncdf2.getData();
202  if (!checkFormat(fcfFeedRotation, ncdf2))
203  {
205  "::loadStationParAngle(): format check failed");
206  return false;
207  };
208  parAngle = new SgVector(dscr->numOfPts_);
209  const double *pAngle=ncdf2.lookupVar(fcFeedRotation.name())->data2double();
210  for (int i=0; i<dscr->numOfPts_; i++)
211  parAngle->setElement(i, pAngle[i]);
212  //
214  "::loadStationParAngle(): data successfully loaded from " + ncdf2.getFileName());
215  return true;
216 };
217 
218 
219 
220 //
221 bool SgVgosDb::loadStationCalAxisOffset(const QString& stnName, SgMatrix* &cal)
222 {
223  QString origin;
224  if (!stnDescriptorByName_.contains(stnName))
225  {
227  "::loadStationCalAxisOffset(): unknown station " + stnName);
228  return false;
229  };
230  return loadStdObsCalibration(cal, origin, "Cal-AxisOffset",
231  stnDescriptorByName_[stnName]->vCal_AxisOffset_, fcCalAxisOffset, fcfCalAxisOffset);
232 };
233 
234 
235 
236 
237 //
238 bool SgVgosDb::loadStationCalCable(const QString& stnName, SgMatrix* &cal,
239  QString& origin, QString& kind)
240 {
241  bool isOk;
242  origin = "";
243  kind = "";
244  if (!stnDescriptorByName_.contains(stnName))
245  {
247  "::loadStationCalCable(): unknown station " + stnName);
248  return false;
249  };
250  isOk = loadStdObsCalibration(cal, origin, "Cal-Cable",
251  stnDescriptorByName_[stnName]->vCal_Cable_, fcCalCable, fcfCalCable, false);
252  kind = stnDescriptorByName_[stnName]->vCal_Cable_.getKind();
253  return isOk;
254 };
255 
256 
257 
258 //
259 bool SgVgosDb::loadStationCalCblCorrections(const QString& stnName, SgMatrix* &cal,
260  QString& origin, QString& kind)
261 {
262  bool isOk=false;
263  origin = "";
264  kind = "";
265  if (!stnDescriptorByName_.contains(stnName))
266  {
268  "::loadStationCalCblCorrections(): unknown station " + stnName);
269  return isOk;
270  };
271  //
272  if (!stnDescriptorByName_[stnName]->vCal_CblCorrections_.isEmpty())
273  {
274  isOk = loadStdObsCalibration(cal, origin, "Cal-CblCorrections",
275  stnDescriptorByName_[stnName]->vCal_CblCorrections_, fcCalCblCorrections,
276  fcfCalCblCorrections, false);
277  kind = stnDescriptorByName_[stnName]->vCal_CblCorrections_.getKind();
278  }
279  else if (!stnDescriptorByName_[stnName]->vCal_CableCorrections_.isEmpty())
280  {
281  isOk = loadStdObsCalibration(cal, origin, "Cal-CableCorrections",
282  stnDescriptorByName_[stnName]->vCal_CableCorrections_, fcCalCableCorrections,
283  fcfCalCableCorrections, false);
284  kind = stnDescriptorByName_[stnName]->vCal_CableCorrections_.getKind();
285  };
286  return isOk;
287 };
288 
289 
290 
291 //
292 bool SgVgosDb::loadStationMet(const QString& stnName,
293  SgVector* &metAtmPres, SgVector* &metAtmRH, SgVector* &metAtmTemp, QString& origin, QString& kind)
294 {
295  origin = "";
296  kind = "";
297  if (!stnDescriptorByName_.contains(stnName))
298  {
300  "::loadStationMet(): unknown station " + stnName);
301  return false;
302  };
304  if (dscr->vMet_.isEmpty())
305  {
307  "::loadStationMet(): there is no vgosDb variable Met for the station " + stnName);
308  return false;
309  };
310  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vMet_.getFileName());
311  ncdf2.getData();
312  if (!checkFormat(fcfMet, ncdf2))
313  {
315  "::loadStationMet(): format check failed");
316  return false;
317  };
318  metAtmPres = new SgVector(dscr->numOfPts_);
319  metAtmRH = new SgVector(dscr->numOfPts_);
320  metAtmTemp = new SgVector(dscr->numOfPts_);
321  const double *pT=ncdf2.lookupVar(fcTempC .name())->data2double();
322  const double *pP=ncdf2.lookupVar(fcAtmPres.name())->data2double();
323  const double *pH=ncdf2.lookupVar(fcRelHum .name())->data2double();
324  for (int i=0; i<dscr->numOfPts_; i++)
325  {
326  metAtmTemp->setElement(i, pT[i]);
327  metAtmPres->setElement(i, pP[i]);
328  metAtmRH ->setElement(i, pH[i]);
329  };
330  //
331  //
332  SgNcdfVariable *svcV;
333  if ( (svcV=ncdf2.lookupServiceVar(SgNetCdf::svcDataOrigin)) )
334  {
335  const char *c=svcV->data2char();
336  int l=svcV->dimensions().at(0)->getN();
337  origin = QString::fromLatin1(c, l);
338  }
339  else
341  "::loadStationMet(): cannot find service variable \"" + SgNetCdf::svcStation +
342  "\" in " + ncdf2.getFileName());
343  //
344  kind = dscr->vMet_.getKind();
345  //
347  "::loadStationMet(): data successfully loaded from " + ncdf2.getFileName());
348  return true;
349 };
350 
351 
352 
353 //
354 bool SgVgosDb::loadStationCalSlantPathTropDry(const QString& stnName, SgMatrix* &cal, QString &kind)
355 {
356  bool isOk;
357  kind = "";
358  QString origin;
359  if (!stnDescriptorByName_.contains(stnName))
360  {
362  "::loadStationCalSlantPathTropDry(): unknown station " + stnName);
363  return false;
364  };
365  isOk = loadStdObsCalibration(cal, origin, "Cal-SlantPathTropDry",
366  stnDescriptorByName_[stnName]->vCal_SlantPathTropDry_, fcCalSlantPathTropDry, fcfCalSlantPathTropDry,
367  false);
368  kind = stnDescriptorByName_[stnName]->vCal_SlantPathTropDry_.getKind();
369  return isOk;
370 };
371 
372 
373 
374 //
375 bool SgVgosDb::loadStationCalSlantPathTropWet(const QString& stnName, SgMatrix* &cal, QString &kind)
376 {
377  bool isOk;
378  kind = "";
379  QString origin;
380  if (!stnDescriptorByName_.contains(stnName))
381  {
383  "::loadStationCalSlantPathTropWet(): unknown station " + stnName);
384  return false;
385  };
386  isOk = loadStdObsCalibration(cal, origin, "Cal-SlantPathTropWet",
387  stnDescriptorByName_[stnName]->vCal_SlantPathTropWet_, fcCalSlantPathTropWet, fcfCalSlantPathTropWet,
388  false);
389  kind = stnDescriptorByName_[stnName]->vCal_SlantPathTropWet_.getKind();
390  return isOk;
391 };
392 
393 
394 
395 //
396 bool SgVgosDb::loadStationCalOceanLoad(const QString& stnName,
397  SgMatrix* &calHorzOLoad, SgMatrix* &calVertOLoad)
398 {
399  if (!stnDescriptorByName_.contains(stnName))
400  {
402  "::loadStationCalOceanLoad(): unknown station " + stnName);
403  return false;
404  };
406  if (dscr->vCal_OceanLoad_.isEmpty())
407  {
409  "::loadStationCalOceanLoad(): there is no vgosDb variable Cal-StationOceanLoad for the station "
410  + stnName);
411  return false;
412  };
413  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vCal_OceanLoad_.getFileName());
414  ncdf2.getData();
415  if (!checkFormat(fcfCalStationOceanLoad, ncdf2))
416  {
418  "::loadStationCalOceanLoad(): format check failed");
419  return false;
420  };
421  calVertOLoad = new SgMatrix(dscr->numOfPts_, 2);
422  calHorzOLoad = new SgMatrix(dscr->numOfPts_, 2);
423  const double *pV=ncdf2.lookupVar(fcCalStationOceanLoadVert .name())->data2double();
424  const double *pH=ncdf2.lookupVar(fcCalStationOceanLoadHoriz.name())->data2double();
425  for (int i=0; i<dscr->numOfPts_; i++)
426  {
427  calVertOLoad->setElement(i, 0, pV[2*i ]);
428  calVertOLoad->setElement(i, 1, pV[2*i + 1]);
429  calHorzOLoad->setElement(i, 0, pH[2*i ]);
430  calHorzOLoad->setElement(i, 1, pH[2*i + 1]);
431  };
433  "::loadStationCalOceanLoad(): data successfully loaded from " + ncdf2.getFileName());
434  return true;
435 };
436 
437 
438 
439 //
440 bool SgVgosDb::loadStationPartAxisOffset(const QString& stnName, SgMatrix* &partAxisOffset)
441 {
442  if (!stnDescriptorByName_.contains(stnName))
443  {
445  "::loadStationPartAxisOffset(): unknown station " + stnName);
446  return false;
447  };
449  if (dscr->vPart_AxisOffset_.isEmpty())
450  {
452  "::loadStationPartAxisOffset(): there is no vgosDb variable Part-AxisOffset for the station " +
453  stnName);
454  return false;
455  };
456  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vPart_AxisOffset_.getFileName());
457  ncdf2.getData();
458  if (!checkFormat(fcfPartAxisOffset, ncdf2))
459  {
461  "::loadStationPartAxisOffset(): format check failed");
462  return false;
463  };
464  const double *p=ncdf2.lookupVar(fcPartAxisOffset.name())->data2double();
465  partAxisOffset = new SgMatrix(dscr->numOfPts_, 2);
466  for (int i=0; i<dscr->numOfPts_; i++)
467  {
468  partAxisOffset->setElement(i, 0, p[2*i ]);
469  partAxisOffset->setElement(i, 1, p[2*i + 1]);
470  };
472  "::loadStationPartAxisOffset(): data successfully loaded from " + ncdf2.getFileName());
473  return true;
474 };
475 
476 
477 
478 //
479 bool SgVgosDb::loadStationOceanLdDisp(const QString& stnName, SgMatrix* &dis, SgMatrix* &vel)
480 {
481  if (!stnDescriptorByName_.contains(stnName))
482  {
484  "::loadStationOceanLdDisp(): unknown station " + stnName);
485  return false;
486  };
488  if (dscr->vDis_OceanLoad_.isEmpty())
489  {
491  "::loadStationOceanLdDisp(): there is no vgosDb variable Dis-OceanLoad for the station " + stnName);
492  return false;
493  };
494  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vDis_OceanLoad_.getFileName());
495  ncdf2.getData();
496  if (!checkFormat(fcfDisOceanLoad, ncdf2))
497  {
499  "::loadStationOceanLdDisp(): format check failed");
500  return false;
501  };
502  dis = new SgMatrix(dscr->numOfPts_, 3);
503  vel = new SgMatrix(dscr->numOfPts_, 3);
504  const double *p=ncdf2.lookupVar(fcDisOceanLoad.name())->data2double();
505  for (int i=0; i<dscr->numOfPts_; i++)
506  {
507  dis->setElement(i, 0, p[6*i ]);
508  dis->setElement(i, 1, p[6*i + 1]);
509  dis->setElement(i, 2, p[6*i + 2]);
510  vel->setElement(i, 0, p[6*i + 3]);
511  vel->setElement(i, 1, p[6*i + 4]);
512  vel->setElement(i, 2, p[6*i + 5]);
513  };
515  "::loadStationOceanLdDisp(): data successfully loaded from " + ncdf2.getFileName());
516  return true;
517 };
518 
519 
520 
521 //
522 bool SgVgosDb::loadStationPartZenithDelayDry(const QString& stnName, SgMatrix* &part, QString &kind)
523 {
524  kind = "";
525  if (!stnDescriptorByName_.contains(stnName))
526  {
528  "::loadStationPartZenithDelayDry(): unknown station " + stnName);
529  return false;
530  };
532  if (dscr->vPart_ZenithPathTropDry_.isEmpty())
533  {
535  "::loadStationPartZenithDelayDry(): there is no vgosDb variable Part-ZenithPathTropDry for the "
536  "station " + stnName);
537  return false;
538  };
540  ncdf2.getData();
542  {
544  "::loadStationPartZenithDelayDry(): format check failed");
545  return false;
546  };
547  const double *p=ncdf2.lookupVar(fcPartZenithPathTropDry.name())->data2double();
548  part = new SgMatrix(dscr->numOfPts_, 2);
549  for (int i=0; i<dscr->numOfPts_; i++)
550  {
551  part->setElement(i, 0, p[2*i ]);
552  part->setElement(i, 1, p[2*i + 1]);
553  };
554  kind = dscr->vPart_ZenithPathTropDry_.getKind();
556  "::loadStationPartZenithDelayDry(): data successfully loaded from " + ncdf2.getFileName());
557  return true;
558 };
559 
560 
561 
562 //
563 bool SgVgosDb::loadStationPartZenithDelayWet(const QString& stnName, SgMatrix* &part, QString &kind)
564 {
565  kind = "";
566  if (!stnDescriptorByName_.contains(stnName))
567  {
569  "::loadStationPartZenithDelayWet(): unknown station " + stnName);
570  return false;
571  };
573  if (dscr->vPart_ZenithPathTropWet_.isEmpty())
574  {
576  "::loadStationPartZenithDelayWet(): there is no vgosDb variable Part-ZenithPathTropWet for the "
577  "station " + stnName);
578  return false;
579  };
581  ncdf.getData();
583  {
585  "::loadStationPartZenithDelayWet(): format check failed");
586  return false;
587  };
588  const double *p=ncdf.lookupVar(fcPartZenithPathTropWet.name())->data2double();
589  part = new SgMatrix(dscr->numOfPts_, 2);
590  for (int i=0; i<dscr->numOfPts_; i++)
591  {
592  part->setElement(i, 0, p[2*i ]);
593  part->setElement(i, 1, p[2*i + 1]);
594  };
595  kind = dscr->vPart_ZenithPathTropWet_.getKind();
597  "::loadStationPartZenithDelayWet(): data successfully loaded from " + ncdf.getFileName());
598  return true;
599 };
600 
601 
602 
603 //
604 bool SgVgosDb::loadStationPartHorizonGrad(const QString& stnName, SgMatrix* &part, QString &kind)
605 {
606  kind = "";
607  if (!stnDescriptorByName_.contains(stnName))
608  {
610  "::loadStationPartHorizonGrad(): unknown station " + stnName);
611  return false;
612  };
614  if (dscr->vPart_HorizonGrad_.isEmpty())
615  {
617  "::loadStationPartHorizonGrad(): there is no vgosDb variable Part-HorizonGrad for the station " +
618  stnName);
619  return false;
620  };
622  ncdf.getData();
623  if (!checkFormat(fcfPartHorizonGrad, ncdf))
624  {
626  "::loadStationPartHorizonGrad(): format check failed");
627  return false;
628  };
629  const double *p=ncdf.lookupVar(fcPartHorizonGrad.name())->data2double();
630  part = new SgMatrix(dscr->numOfPts_, 4);
631  for (int i=0; i<dscr->numOfPts_; i++)
632  {
633  part->setElement(i, 0, p[4*i ]);
634  part->setElement(i, 1, p[4*i + 1]);
635  part->setElement(i, 2, p[4*i + 2]);
636  part->setElement(i, 3, p[4*i + 3]);
637  };
638  kind = dscr->vPart_HorizonGrad_.getKind();
640  "::loadStationPartHorizonGrad(): data successfully loaded from " + ncdf.getFileName());
641  return true;
642 };
643 
644 
645 
646 //
647 bool SgVgosDb::loadStationRefClockOffset(const QString& stnName, SgVector* &refClockOffset)
648 {
649  if (!stnDescriptorByName_.contains(stnName))
650  {
652  "::loadStationRefClockOffset(): unknown station " + stnName);
653  return false;
654  };
656  if (dscr->vRefClockOffset_.isEmpty())
657  {
659  "::loadStationRefClockOffset(): the vgosDb variable RefClockOffset for the station " +
660  stnName + " is empty");
661  return false;
662  };
663  SgNetCdf ncdf(path2RootDir_ + "/" + dscr->vRefClockOffset_.getFileName());
664  ncdf.getData();
665  if (!checkFormat(fcfRefClockOffset, ncdf))
666  {
668  "::loadStationRefClockOffset(): format check failed");
669  return false;
670  };
671  const double *d=ncdf.lookupVar(fcRefClockOffset.name())->data2double();
672  refClockOffset = new SgVector(dscr->numOfPts_);
673  for (int i=0; i<dscr->numOfPts_; i++)
674  refClockOffset->setElement(i, d[i]);
675  //
677  "::loadStationRefClockOffset(): data loaded successfully from " + ncdf.getFileName());
678  return true;
679 };
680 
681 
682 
683 //
684 bool SgVgosDb::loadStationTsys(const QString& stnName, SgMatrix* &tsyses, QVector<double>& frqs,
685  QVector<QString>& ids, QVector<QString>& sbs, QVector<QString>& polzs)
686 {
687  if (!stnDescriptorByName_.contains(stnName))
688  {
690  "::loadStationTsys(): unknown station " + stnName);
691  return false;
692  };
694  if (dscr->vTsys_.isEmpty())
695  {
697  "::loadStationTsys(): the vgosDb variable Tsys for the station " +
698  stnName + " is empty");
699  return false;
700  };
701  SgNetCdf ncdf(path2RootDir_ + "/" + dscr->vTsys_.getFileName());
702  ncdf.getData();
703  if (!checkFormat(fcfTsys, ncdf))
704  {
706  "::loadStationTsys(): format check failed");
707  return false;
708  };
709  const double *tsys=ncdf.lookupVar(fcTsysData.name())->data2double();
710  const double *freqs=ncdf.lookupVar(fcTsysIfFreq.name())->data2double();
711  const char *cIds=ncdf.lookupVar(fcTsysIfId.name())->data2char();
712  const char *cSbs=ncdf.lookupVar(fcTsysIfSideBand.name())->data2char();
713  const char *cPzs=ncdf.lookupVar(fcTsysIfPolarization.name())->data2char();
714  int nChans=ncdf.lookupVar(fcTsysIfFreq.name())->dimensions().at(0)->getN();
715  int lIds=ncdf.lookupVar(fcTsysIfId.name())->dimensions().at(1)->getN();
716  int lSbs=ncdf.lookupVar(fcTsysIfSideBand.name())->dimensions().at(1)->getN();
717  int lPzs=ncdf.lookupVar(fcTsysIfPolarization.name())->dimensions().at(1)->getN();
718 
719  tsyses = new SgMatrix(dscr->numOfPts_, nChans);
720  frqs.resize(nChans);
721  ids.resize(nChans);
722  sbs.resize(nChans);
723  polzs.resize(nChans);
724 
725  for (int i=0; i<dscr->numOfPts_; i++)
726  for (int j=0; j<nChans; j++)
727  tsyses->setElement(i, j, tsys[nChans*i + j]);
728  for (int j=0; j<nChans; j++)
729  {
730  frqs [j] = freqs[j];
731  ids [j] = QString::fromLatin1(cIds + lIds*j, lIds);
732  sbs [j] = QString::fromLatin1(cSbs + lSbs*j, lSbs);
733  polzs[j] = QString::fromLatin1(cPzs + lPzs*j, lPzs);
734  };
735  //
737  "::loadStationTsys(): data loaded successfully from " + ncdf.getFileName());
738  return true;
739 };
740 /*=====================================================================================================*/
741 
742 
743 
744 
745 
746 
747 
748 
749 
750 
751 /*=====================================================================================================*/
752 //
753 // Constants:
754 //
755 
756 
757 
758 
759 
760 
761 
762 // Variable descriptions:
764  // FmtChkVar(const char* name, nc_type type, bool isMandatory, const QList<int> l,
765  // const QString& attLCode="", const QString& attDefinition="", const QString& attUnits="",
766  // const QString& attBand="")
767  fcAzTheo ("AzTheo", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
768  "AZ-THEO ", "Azimuth array definition", "radian, radian/sec"),
769  fcElTheo ("ElTheo", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
770  "EL-THEO ", "Elevation array definition", "radian, radian/sec"),
771  fcFeedRotation ("FeedRotation", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
772  "PARANGLE", "Feedhorn rot. angle", "radian"),
773  fcCalAxisOffset ("Cal-AxisOffset", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
774  "AXO CONT", "New Axis Offset Contributions", "second"),
775  fcCalCable ("Cal-Cable", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
776  "CABL DEL", "Cable calibration data", "second"),
777  fcCalCblCorrections ("Cal-CblCorrections",
778  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 3,
779  "", "A set of cable calibration corrections: (FS Logs, CDMS, PCMT)", "second"),
780  // tmp:
781  fcCalCableCorrections ("Cal-CableCorrections",
782  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 3,
783  "", "A set of cable calibration corrections: (FS Logs, CDMS, PCMT)", "second"),
784  //
785  fcCalSlantPathTropDry ("Cal-SlantPathTropDry",
786  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
787  "NDRYCONT", "Nhmf (dry) atm. contribution", "second"),
788  fcCalSlantPathTropWet ("Cal-SlantPathTropWet",
789  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
790  "NWETCONT", "Whmf (wet) atm. contribution", "second"),
792  ("Cal-StationOceanLoadVert",
793  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
794  "OCE VERT", "Site-dep ocean cont - vertical", "second"),
796  ("Cal-StationOceanLoadHoriz",
797  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
798  "OCE HORZ", "Site-dep ocean cont - horizontal", "second"),
799  fcCalUnPhaseCal ("Cal-UnPhaseCal", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2 ),
800  fcTempC ("TempC", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
801  "TEMP C", "Temp in C at local WX station", "Celsius"),
802  fcAtmPres ("AtmPres", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
803  "ATM PRES", "Pressure in hPa at site", "hPa"),
804  fcRelHum ("RelHum", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
805  "REL.HUM.", "Rel.Hum. at local WX st; [0...1], 0.5=50%)", "unitless"),
806  fcPartAxisOffset ("Part-AxisOffset", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
807  "AXO PART", "Axis Offset partial deriv. def."),
808  fcDisOceanLoad ("Dis-OceanLoad", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2 << 3,
809  "OCE DELD", "Ocean load site dependent displace", "meter"),
811  ("Part-ZenithPathTropDry",
812  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
813  "NDRYPART", "Nhmf2 dry partial deriv. def."),
815  ("Part-ZenithPathTropWet",
816  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
817  "NWETPART", "Whmf2 wet partial deriv. def."),
818  fcPartHorizonGrad ("Part-HorizonGrad",
819  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2 << 2,
820  "NGRADPAR", "Niell dry atm. gradient partials"),
821  fcRefClockOffset ("ReferenceClockOffset",
822  NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
823  "", "Difference between reference station clock and UTC at the reference epoch", "sec"),
824 
825  fcTsysData ("TsysData", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << SD_Any,
826  "", "System temperature"),
827  fcTsysIfFreq ("TsysIfreq", NC_DOUBLE, true, QList<int>() << SD_Any,
828  "", "Frequencies of IFs for TSYS data"),
829  fcTsysIfId ("TsysIfId", NC_CHAR , true, QList<int>() << SD_Any << SD_Any,
830  "", "Identifiers of IFs for TSYS data"),
831 
832  fcTsysIfSideBand ("TsysIfSideBand", NC_CHAR , true, QList<int>() << SD_Any << SD_Any,
833  "", "Sidebands of IFs for TSYS data"),
834 
835  fcTsysIfPolarization ("TsysIfPolarization",
836  NC_CHAR , true, QList<int>() << SD_Any << SD_Any,
837  "", "Polarizations of IFs for TSYS data"),
838 
839 
840 
841 
842 
843  fcStub ("", NC_CHAR, true, QList<int>() << 1, "", "")
844  ;
845 
846 
847 
848 
849 // netCDF files:
871 
883 
884  ;
885 
886 /*=====================================================================================================*/
887 
@ SD_NumStnPts
Definition: SgIoDriver.h:56
@ SD_Any
Definition: SgIoDriver.h:62
SgLogger * logger
Definition: SgLogger.cpp:231
SgVgosDb::FmtChkVar fcCalCableCorrections("Cal-CableCorrections", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 3, "", "A set of cable calibration corrections: (FS Logs, CDMS, PCMT)", "second")
SgVgosDb::FmtChkVar fcCalCable("Cal-Cable", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "CABL DEL", "Cable calibration data", "second")
SgVgosDb::FmtChkVar fcCalCblCorrections("Cal-CblCorrections", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 3, "", "A set of cable calibration corrections: (FS Logs, CDMS, PCMT)", "second")
QList< SgVgosDb::FmtChkVar * > fcfCalSlantPathTropDry
SgVgosDb::FmtChkVar fcCalStationOceanLoadVert("Cal-StationOceanLoadVert", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "OCE VERT", "Site-dep ocean cont - vertical", "second")
QList< SgVgosDb::FmtChkVar * > fcfCalUnPhaseCal
QList< SgVgosDb::FmtChkVar * > fcfCalAxisOffset
SgVgosDb::FmtChkVar fcTsysIfPolarization("TsysIfPolarization", NC_CHAR, true, QList< int >()<< SD_Any<< SD_Any, "", "Polarizations of IFs for TSYS data")
QList< SgVgosDb::FmtChkVar * > fcfMet
SgVgosDb::FmtChkVar fcTsysIfFreq("TsysIfreq", NC_DOUBLE, true, QList< int >()<< SD_Any, "", "Frequencies of IFs for TSYS data")
QList< SgVgosDb::FmtChkVar * > fcfPartZenithPathTropDry
QList< SgVgosDb::FmtChkVar * > fcfPartZenithPathTropWet
QList< SgVgosDb::FmtChkVar * > fcfCalCableCorrections
QList< SgVgosDb::FmtChkVar * > fcfRefClockOffset
SgVgosDb::FmtChkVar fcCalSlantPathTropDry("Cal-SlantPathTropDry", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "NDRYCONT", "Nhmf (dry) atm. contribution", "second")
QList< SgVgosDb::FmtChkVar * > fcfTsys
SgVgosDb::FmtChkVar fcDisOceanLoad("Dis-OceanLoad", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2<< 3, "OCE DELD", "Ocean load site dependent displace", "meter")
QList< SgVgosDb::FmtChkVar * > fcfCalStationOceanLoad
SgVgosDb::FmtChkVar fcCalAxisOffset("Cal-AxisOffset", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "AXO CONT", "New Axis Offset Contributions", "second")
SgVgosDb::FmtChkVar fcStub("", NC_CHAR, true, QList< int >()<< 1, "", "")
SgVgosDb::FmtChkVar fcTsysIfId("TsysIfId", NC_CHAR, true, QList< int >()<< SD_Any<< SD_Any, "", "Identifiers of IFs for TSYS data")
SgVgosDb::FmtChkVar fcPartZenithPathTropDry("Part-ZenithPathTropDry", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "NDRYPART", "Nhmf2 dry partial deriv. def.")
QList< SgVgosDb::FmtChkVar * > fcfDisOceanLoad
QList< SgVgosDb::FmtChkVar * > fcfPartHorizonGrad
SgVgosDb::FmtChkVar fcAzTheo("AzTheo", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "AZ-THEO ", "Azimuth array definition", "radian, radian/sec")
QList< SgVgosDb::FmtChkVar * > fcfCalCable
QList< SgVgosDb::FmtChkVar * > fcfCalSlantPathTropWet
SgVgosDb::FmtChkVar fcPartZenithPathTropWet("Part-ZenithPathTropWet", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "NWETPART", "Whmf2 wet partial deriv. def.")
SgVgosDb::FmtChkVar fcTsysData("TsysData", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< SD_Any, "", "System temperature")
SgVgosDb::FmtChkVar fcCalSlantPathTropWet("Cal-SlantPathTropWet", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "NWETCONT", "Whmf (wet) atm. contribution", "second")
SgVgosDb::FmtChkVar fcPartHorizonGrad("Part-HorizonGrad", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2<< 2, "NGRADPAR", "Niell dry atm. gradient partials")
SgVgosDb::FmtChkVar fcRelHum("RelHum", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "REL.HUM.", "Rel.Hum. at local WX st; [0...1], 0.5=50%)", "unitless")
SgVgosDb::FmtChkVar fcFeedRotation("FeedRotation", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "PARANGLE", "Feedhorn rot. angle", "radian")
QList< SgVgosDb::FmtChkVar * > fcfCalCblCorrections
SgVgosDb::FmtChkVar fcElTheo("ElTheo", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "EL-THEO ", "Elevation array definition", "radian, radian/sec")
SgVgosDb::FmtChkVar fcPartAxisOffset("Part-AxisOffset", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "AXO PART", "Axis Offset partial deriv. def.")
SgVgosDb::FmtChkVar fcTsysIfSideBand("TsysIfSideBand", NC_CHAR, true, QList< int >()<< SD_Any<< SD_Any, "", "Sidebands of IFs for TSYS data")
QList< SgVgosDb::FmtChkVar * > fcfPartAxisOffset
SgVgosDb::FmtChkVar fcCalUnPhaseCal("Cal-UnPhaseCal", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2)
SgVgosDb::FmtChkVar fcAtmPres("AtmPres", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "ATM PRES", "Pressure in hPa at site", "hPa")
SgVgosDb::FmtChkVar fcRefClockOffset("ReferenceClockOffset", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "", "Difference between reference station clock and UTC at the reference epoch", "sec")
SgVgosDb::FmtChkVar fcTempC("TempC", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "TEMP C", "Temp in C at local WX station", "Celsius")
SgVgosDb::FmtChkVar fcCalStationOceanLoadHoriz("Cal-StationOceanLoadHoriz", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts<< 2, "OCE HORZ", "Site-dep ocean cont - horizontal", "second")
QList< SgVgosDb::FmtChkVar * > fcfFeedRotation
QList< SgVgosDb::FmtChkVar * > fcfAzEl
SgVgosDb::FmtChkVar fcSecond("Second", NC_DOUBLE, true, QList< int >()<< SD_Any, "SEC TAG ", "Seconds part of UTC TAG.........", "second")
SgVgosDb::FmtChkVar fcYmdhm("YMDHM", NC_SHORT, true, QList< int >()<< SD_Any<< 5, "UTC TAG ", "Epoch UTC YMDHM.................")
QList< SgVgosDb::FmtChkVar * > fcfTimeUTC
Definition: SgVgosDb.cpp:2669
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
@ IO_NCDF
Definition: SgLogger.h:66
Definition: SgMJD.h:59
void setElement(unsigned int i, unsigned int j, double d)
Definition: SgMatrix.h:402
const char * data2char() const
Definition: SgNetCdf.cpp:459
const short * data2short() const
Definition: SgNetCdf.cpp:481
const QList< SgNcdfDimension * > & dimensions() const
Definition: SgNetCdf.h:247
const double * data2double() const
Definition: SgNetCdf.cpp:525
SgNcdfVariable * lookupVar(const QString &name) const
Definition: SgNetCdf.h:395
static const QString svcDataOrigin
Definition: SgNetCdf.h:334
static const QString svcStation
Definition: SgNetCdf.h:338
const QString & getFileName() const
Definition: SgNetCdf.h:497
SgNcdfVariable * lookupServiceVar(const QString &name) const
Definition: SgNetCdf.h:391
bool getData()
Definition: SgNetCdf.cpp:1053
bool isEmpty() const
Definition: SgVgosDb.cpp:159
const QString & getKind() const
Definition: SgVgosDb.h:94
const QString & getFileName() const
Definition: SgVgosDb.h:100
void setElement(unsigned int i, double d)
Definition: SgVector.h:348
const QString & name() const
Definition: SgVgosDb.h:213
bool loadStationCalOceanLoad(const QString &stnName, SgMatrix *&calHorzOLoad, SgMatrix *&calVertOLoad)
bool loadStationCalSlantPathTropDry(const QString &stnName, SgMatrix *&calNmfDry, QString &kind)
static const QString className()
Definition: SgVgosDb.cpp:251
bool checkFormat(const QList< FmtChkVar * > &, const SgNetCdf &, bool ok2fail=false)
Definition: SgVgosDb.cpp:2173
QMap< QString, StationDescriptor > stnDescriptorByKey_
Definition: SgVgosDb.h:1457
bool loadStationCalSlantPathTropWet(const QString &stnName, SgMatrix *&calNmfWet, QString &kind)
bool loadStationCalAxisOffset(const QString &stnName, SgMatrix *&cal)
bool loadStationOceanLdDisp(const QString &stnName, SgMatrix *&dis, SgMatrix *&vel)
bool loadStationMet(const QString &stnName, SgVector *&metAtmPres, SgVector *&metAtmRH, SgVector *&metAtmTemp, QString &origin, QString &kind)
bool loadStationRefClockOffset(const QString &stnName, SgVector *&refClockOffset)
bool loadStationName(const QString &stnKey)
bool loadStationCalCable(const QString &stnName, SgMatrix *&cal, QString &origin, QString &kind)
bool loadStationPartZenithDelayDry(const QString &stnName, SgMatrix *&part, QString &kind)
bool loadStationParAngle(const QString &stnName, SgVector *&parAngle)
bool loadStationCalCblCorrections(const QString &stnName, SgMatrix *&cal, QString &origin, QString &kind)
bool loadStationTsys(const QString &stnName, SgMatrix *&tsyses, QVector< double > &frqs, QVector< QString > &ids, QVector< QString > &sbs, QVector< QString > &polzs)
bool loadStationPartHorizonGrad(const QString &stnName, SgMatrix *&part, QString &kind)
QMap< QString, StationDescriptor * > stnDescriptorByName_
Definition: SgVgosDb.h:1459
bool loadStationEpochs(const QString &stnName, QList< SgMJD > &epochs)
QString path2RootDir_
Definition: SgVgosDb.h:1406
bool loadStationPartZenithDelayWet(const QString &stnName, SgMatrix *&part, QString &kind)
bool loadStationAzEl(const QString &stnName, SgMatrix *&azTheo, SgMatrix *&elTheo)
bool loadStdObsCalibration(SgMatrix *&cals, QString &origin, const QString &varName, const SgVdbVariable &odbV, const FmtChkVar &fc, const QList< FmtChkVar * > &fcf, bool=true)
bool loadStationPartAxisOffset(const QString &stnName, SgMatrix *&partAxisOffset)
SgVdbVariable vRefClockOffset_
Definition: SgVgosDb.h:1302
SgVdbVariable vPart_HorizonGrad_
Definition: SgVgosDb.h:1299
SgVdbVariable vPart_ZenithPathTropDry_
Definition: SgVgosDb.h:1297
SgVdbVariable vFeedRotation_
Definition: SgVgosDb.h:1287
SgVdbVariable vPart_AxisOffset_
Definition: SgVgosDb.h:1296
SgVdbVariable vDis_OceanLoad_
Definition: SgVgosDb.h:1300
SgVdbVariable vCal_OceanLoad_
Definition: SgVgosDb.h:1294
SgVdbVariable vPart_ZenithPathTropWet_
Definition: SgVgosDb.h:1298