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 bool SgVgosDb::loadStationCalCable(const QString& stnName, SgMatrix* &cal,
238  QString& origin, QString& kind)
239 {
240  bool isOk;
241  origin = "";
242  kind = "";
243  if (!stnDescriptorByName_.contains(stnName))
244  {
246  "::loadStationCalCable(): unknown station " + stnName);
247  return false;
248  };
249  isOk = loadStdObsCalibration(cal, origin, "Cal-Cable",
250  stnDescriptorByName_[stnName]->vCal_Cable_, fcCalCable, fcfCalCable, false);
251  kind = stnDescriptorByName_[stnName]->vCal_Cable_.getKind();
252  return isOk;
253 };
254 
255 
256 
257 //
258 bool SgVgosDb::loadStationMet(const QString& stnName,
259  SgVector* &metAtmPres, SgVector* &metAtmRH, SgVector* &metAtmTemp, QString& origin, QString& kind)
260 {
261  origin = "";
262  kind = "";
263  if (!stnDescriptorByName_.contains(stnName))
264  {
266  "::loadStationMet(): unknown station " + stnName);
267  return false;
268  };
270  if (dscr->vMet_.isEmpty())
271  {
273  "::loadStationMet(): there is no vgosDb variable Met for the station " + stnName);
274  return false;
275  };
276  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vMet_.getFileName());
277  ncdf2.getData();
278  if (!checkFormat(fcfMet, ncdf2))
279  {
281  "::loadStationMet(): format check failed");
282  return false;
283  };
284  metAtmPres = new SgVector(dscr->numOfPts_);
285  metAtmRH = new SgVector(dscr->numOfPts_);
286  metAtmTemp = new SgVector(dscr->numOfPts_);
287  const double *pT=ncdf2.lookupVar(fcTempC .name())->data2double();
288  const double *pP=ncdf2.lookupVar(fcAtmPres.name())->data2double();
289  const double *pH=ncdf2.lookupVar(fcRelHum .name())->data2double();
290  for (int i=0; i<dscr->numOfPts_; i++)
291  {
292  metAtmTemp->setElement(i, pT[i]);
293  metAtmPres->setElement(i, pP[i]);
294  metAtmRH ->setElement(i, pH[i]);
295  };
296  //
297  //
298  SgNcdfVariable *svcV;
299  if ( (svcV=ncdf2.lookupServiceVar(SgNetCdf::svcDataOrigin)) )
300  {
301  const char *c=svcV->data2char();
302  int l=svcV->dimensions().at(0)->getN();
303  origin = QString::fromLatin1(c, l);
304  }
305  else
307  "::loadStationMet(): cannot find service variable \"" + SgNetCdf::svcStation +
308  "\" in " + ncdf2.getFileName());
309  //
310  kind = dscr->vMet_.getKind();
311  //
313  "::loadStationMet(): data successfully loaded from " + ncdf2.getFileName());
314  return true;
315 };
316 
317 
318 
319 //
320 bool SgVgosDb::loadStationCalSlantPathTropDry(const QString& stnName, SgMatrix* &cal, QString &kind)
321 {
322  bool isOk;
323  kind = "";
324  QString origin;
325  if (!stnDescriptorByName_.contains(stnName))
326  {
328  "::loadStationCalSlantPathTropDry(): unknown station " + stnName);
329  return false;
330  };
331  isOk = loadStdObsCalibration(cal, origin, "Cal-SlantPathTropDry",
332  stnDescriptorByName_[stnName]->vCal_SlantPathTropDry_, fcCalSlantPathTropDry, fcfCalSlantPathTropDry,
333  false);
334  kind = stnDescriptorByName_[stnName]->vCal_SlantPathTropDry_.getKind();
335  return isOk;
336 };
337 
338 
339 
340 //
341 bool SgVgosDb::loadStationCalSlantPathTropWet(const QString& stnName, SgMatrix* &cal, QString &kind)
342 {
343  bool isOk;
344  kind = "";
345  QString origin;
346  if (!stnDescriptorByName_.contains(stnName))
347  {
349  "::loadStationCalSlantPathTropWet(): unknown station " + stnName);
350  return false;
351  };
352  isOk = loadStdObsCalibration(cal, origin, "Cal-SlantPathTropWet",
353  stnDescriptorByName_[stnName]->vCal_SlantPathTropWet_, fcCalSlantPathTropWet, fcfCalSlantPathTropWet,
354  false);
355  kind = stnDescriptorByName_[stnName]->vCal_SlantPathTropWet_.getKind();
356  return isOk;
357 };
358 
359 
360 
361 //
362 bool SgVgosDb::loadStationCalOceanLoad(const QString& stnName,
363  SgMatrix* &calHorzOLoad, SgMatrix* &calVertOLoad)
364 {
365  if (!stnDescriptorByName_.contains(stnName))
366  {
368  "::loadStationCalOceanLoad(): unknown station " + stnName);
369  return false;
370  };
372  if (dscr->vCal_OceanLoad_.isEmpty())
373  {
375  "::loadStationCalOceanLoad(): there is no vgosDb variable Cal-StationOceanLoad for the station "
376  + stnName);
377  return false;
378  };
379  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vCal_OceanLoad_.getFileName());
380  ncdf2.getData();
381  if (!checkFormat(fcfCalStationOceanLoad, ncdf2))
382  {
384  "::loadStationCalOceanLoad(): format check failed");
385  return false;
386  };
387  calVertOLoad = new SgMatrix(dscr->numOfPts_, 2);
388  calHorzOLoad = new SgMatrix(dscr->numOfPts_, 2);
389  const double *pV=ncdf2.lookupVar(fcCalStationOceanLoadVert .name())->data2double();
390  const double *pH=ncdf2.lookupVar(fcCalStationOceanLoadHoriz.name())->data2double();
391  for (int i=0; i<dscr->numOfPts_; i++)
392  {
393  calVertOLoad->setElement(i, 0, pV[2*i ]);
394  calVertOLoad->setElement(i, 1, pV[2*i + 1]);
395  calHorzOLoad->setElement(i, 0, pH[2*i ]);
396  calHorzOLoad->setElement(i, 1, pH[2*i + 1]);
397  };
399  "::loadStationCalOceanLoad(): data successfully loaded from " + ncdf2.getFileName());
400  return true;
401 };
402 
403 
404 
405 //
406 bool SgVgosDb::loadStationPartAxisOffset(const QString& stnName, SgMatrix* &partAxisOffset)
407 {
408  if (!stnDescriptorByName_.contains(stnName))
409  {
411  "::loadStationPartAxisOffset(): unknown station " + stnName);
412  return false;
413  };
415  if (dscr->vPart_AxisOffset_.isEmpty())
416  {
418  "::loadStationPartAxisOffset(): there is no vgosDb variable Part-AxisOffset for the station " +
419  stnName);
420  return false;
421  };
422  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vPart_AxisOffset_.getFileName());
423  ncdf2.getData();
424  if (!checkFormat(fcfPartAxisOffset, ncdf2))
425  {
427  "::loadStationPartAxisOffset(): format check failed");
428  return false;
429  };
430  const double *p=ncdf2.lookupVar(fcPartAxisOffset.name())->data2double();
431  partAxisOffset = new SgMatrix(dscr->numOfPts_, 2);
432  for (int i=0; i<dscr->numOfPts_; i++)
433  {
434  partAxisOffset->setElement(i, 0, p[2*i ]);
435  partAxisOffset->setElement(i, 1, p[2*i + 1]);
436  };
438  "::loadStationPartAxisOffset(): data successfully loaded from " + ncdf2.getFileName());
439  return true;
440 };
441 
442 
443 
444 //
445 bool SgVgosDb::loadStationOceanLdDisp(const QString& stnName, SgMatrix* &dis, SgMatrix* &vel)
446 {
447  if (!stnDescriptorByName_.contains(stnName))
448  {
450  "::loadStationOceanLdDisp(): unknown station " + stnName);
451  return false;
452  };
454  if (dscr->vDis_OceanLoad_.isEmpty())
455  {
457  "::loadStationOceanLdDisp(): there is no vgosDb variable Dis-OceanLoad for the station " + stnName);
458  return false;
459  };
460  SgNetCdf ncdf2(path2RootDir_ + "/" + dscr->vDis_OceanLoad_.getFileName());
461  ncdf2.getData();
462  if (!checkFormat(fcfDisOceanLoad, ncdf2))
463  {
465  "::loadStationOceanLdDisp(): format check failed");
466  return false;
467  };
468  dis = new SgMatrix(dscr->numOfPts_, 3);
469  vel = new SgMatrix(dscr->numOfPts_, 3);
470  const double *p=ncdf2.lookupVar(fcDisOceanLoad.name())->data2double();
471  for (int i=0; i<dscr->numOfPts_; i++)
472  {
473  dis->setElement(i, 0, p[6*i ]);
474  dis->setElement(i, 1, p[6*i + 1]);
475  dis->setElement(i, 2, p[6*i + 2]);
476  vel->setElement(i, 0, p[6*i + 3]);
477  vel->setElement(i, 1, p[6*i + 4]);
478  vel->setElement(i, 2, p[6*i + 5]);
479  };
481  "::loadStationOceanLdDisp(): data successfully loaded from " + ncdf2.getFileName());
482  return true;
483 };
484 
485 
486 
487 //
488 bool SgVgosDb::loadStationPartZenithDelayDry(const QString& stnName, SgMatrix* &part, QString &kind)
489 {
490  kind = "";
491  if (!stnDescriptorByName_.contains(stnName))
492  {
494  "::loadStationPartZenithDelayDry(): unknown station " + stnName);
495  return false;
496  };
498  if (dscr->vPart_ZenithPathTropDry_.isEmpty())
499  {
501  "::loadStationPartZenithDelayDry(): there is no vgosDb variable Part-ZenithPathTropDry for the "
502  "station " + stnName);
503  return false;
504  };
506  ncdf2.getData();
508  {
510  "::loadStationPartZenithDelayDry(): format check failed");
511  return false;
512  };
513  const double *p=ncdf2.lookupVar(fcPartZenithPathTropDry.name())->data2double();
514  part = new SgMatrix(dscr->numOfPts_, 2);
515  for (int i=0; i<dscr->numOfPts_; i++)
516  {
517  part->setElement(i, 0, p[2*i ]);
518  part->setElement(i, 1, p[2*i + 1]);
519  };
520  kind = dscr->vPart_ZenithPathTropDry_.getKind();
522  "::loadStationPartZenithDelayDry(): data successfully loaded from " + ncdf2.getFileName());
523  return true;
524 };
525 
526 
527 
528 //
529 bool SgVgosDb::loadStationPartZenithDelayWet(const QString& stnName, SgMatrix* &part, QString &kind)
530 {
531  kind = "";
532  if (!stnDescriptorByName_.contains(stnName))
533  {
535  "::loadStationPartZenithDelayWet(): unknown station " + stnName);
536  return false;
537  };
539  if (dscr->vPart_ZenithPathTropWet_.isEmpty())
540  {
542  "::loadStationPartZenithDelayWet(): there is no vgosDb variable Part-ZenithPathTropWet for the "
543  "station " + stnName);
544  return false;
545  };
547  ncdf.getData();
549  {
551  "::loadStationPartZenithDelayWet(): format check failed");
552  return false;
553  };
554  const double *p=ncdf.lookupVar(fcPartZenithPathTropWet.name())->data2double();
555  part = new SgMatrix(dscr->numOfPts_, 2);
556  for (int i=0; i<dscr->numOfPts_; i++)
557  {
558  part->setElement(i, 0, p[2*i ]);
559  part->setElement(i, 1, p[2*i + 1]);
560  };
561  kind = dscr->vPart_ZenithPathTropWet_.getKind();
563  "::loadStationPartZenithDelayWet(): data successfully loaded from " + ncdf.getFileName());
564  return true;
565 };
566 
567 
568 
569 //
570 bool SgVgosDb::loadStationPartHorizonGrad(const QString& stnName, SgMatrix* &part, QString &kind)
571 {
572  kind = "";
573  if (!stnDescriptorByName_.contains(stnName))
574  {
576  "::loadStationPartHorizonGrad(): unknown station " + stnName);
577  return false;
578  };
580  if (dscr->vPart_HorizonGrad_.isEmpty())
581  {
583  "::loadStationPartHorizonGrad(): there is no vgosDb variable Part-HorizonGrad for the station " +
584  stnName);
585  return false;
586  };
588  ncdf.getData();
589  if (!checkFormat(fcfPartHorizonGrad, ncdf))
590  {
592  "::loadStationPartHorizonGrad(): format check failed");
593  return false;
594  };
595  const double *p=ncdf.lookupVar(fcPartHorizonGrad.name())->data2double();
596  part = new SgMatrix(dscr->numOfPts_, 4);
597  for (int i=0; i<dscr->numOfPts_; i++)
598  {
599  part->setElement(i, 0, p[4*i ]);
600  part->setElement(i, 1, p[4*i + 1]);
601  part->setElement(i, 2, p[4*i + 2]);
602  part->setElement(i, 3, p[4*i + 3]);
603  };
604  kind = dscr->vPart_HorizonGrad_.getKind();
606  "::loadStationPartHorizonGrad(): data successfully loaded from " + ncdf.getFileName());
607  return true;
608 };
609 
610 
611 
612 //
613 bool SgVgosDb::loadStationRefClockOffset(const QString& stnName, SgVector* &refClockOffset)
614 {
615  if (!stnDescriptorByName_.contains(stnName))
616  {
618  "::loadStationRefClockOffset(): unknown station " + stnName);
619  return false;
620  };
622  if (dscr->vRefClockOffset_.isEmpty())
623  {
625  "::loadStationRefClockOffset(): the vgosDb variable RefClockOffset for the station " +
626  stnName + " is empty");
627  return false;
628  };
629  SgNetCdf ncdf(path2RootDir_ + "/" + dscr->vRefClockOffset_.getFileName());
630  ncdf.getData();
631  if (!checkFormat(fcfRefClockOffset, ncdf))
632  {
634  "::loadStationRefClockOffset(): format check failed");
635  return false;
636  };
637  const double *d=ncdf.lookupVar(fcRefClockOffset.name())->data2double();
638  refClockOffset = new SgVector(dscr->numOfPts_);
639  for (int i=0; i<dscr->numOfPts_; i++)
640  refClockOffset->setElement(i, d[i]);
641  //
643  "::loadStationRefClockOffset(): data loaded successfully from " + ncdf.getFileName());
644  return true;
645 };
646 
647 
648 
649 //
650 bool SgVgosDb::loadStationTsys(const QString& stnName, SgMatrix* &tsyses, QVector<double>& frqs,
651  QVector<QString>& ids, QVector<QString>& sbs, QVector<QString>& polzs)
652 {
653  if (!stnDescriptorByName_.contains(stnName))
654  {
656  "::loadStationTsys(): unknown station " + stnName);
657  return false;
658  };
660  if (dscr->vTsys_.isEmpty())
661  {
663  "::loadStationTsys(): the vgosDb variable Tsys for the station " +
664  stnName + " is empty");
665  return false;
666  };
667  SgNetCdf ncdf(path2RootDir_ + "/" + dscr->vTsys_.getFileName());
668  ncdf.getData();
669  if (!checkFormat(fcfTsys, ncdf))
670  {
672  "::loadStationTsys(): format check failed");
673  return false;
674  };
675  const double *tsys=ncdf.lookupVar(fcTsysData.name())->data2double();
676  const double *freqs=ncdf.lookupVar(fcTsysIfFreq.name())->data2double();
677  const char *cIds=ncdf.lookupVar(fcTsysIfId.name())->data2char();
678  const char *cSbs=ncdf.lookupVar(fcTsysIfSideBand.name())->data2char();
679  const char *cPzs=ncdf.lookupVar(fcTsysIfPolarization.name())->data2char();
680  int nChans=ncdf.lookupVar(fcTsysIfFreq.name())->dimensions().at(0)->getN();
681  int lIds=ncdf.lookupVar(fcTsysIfId.name())->dimensions().at(1)->getN();
682  int lSbs=ncdf.lookupVar(fcTsysIfSideBand.name())->dimensions().at(1)->getN();
683  int lPzs=ncdf.lookupVar(fcTsysIfPolarization.name())->dimensions().at(1)->getN();
684 
685  tsyses = new SgMatrix(dscr->numOfPts_, nChans);
686  frqs.resize(nChans);
687  ids.resize(nChans);
688  sbs.resize(nChans);
689  polzs.resize(nChans);
690 
691  for (int i=0; i<dscr->numOfPts_; i++)
692  for (int j=0; j<nChans; j++)
693  tsyses->setElement(i, j, tsys[nChans*i + j]);
694  for (int j=0; j<nChans; j++)
695  {
696  frqs [j] = freqs[j];
697  ids [j] = QString::fromLatin1(cIds + lIds*j, lIds);
698  sbs [j] = QString::fromLatin1(cSbs + lSbs*j, lSbs);
699  polzs[j] = QString::fromLatin1(cPzs + lPzs*j, lPzs);
700  };
701  //
703  "::loadStationTsys(): data loaded successfully from " + ncdf.getFileName());
704  return true;
705 };
706 /*=====================================================================================================*/
707 
708 
709 
710 
711 
712 
713 
714 
715 
716 
717 /*=====================================================================================================*/
718 //
719 // Constants:
720 //
721 
722 
723 
724 
725 
726 
727 
728 // Variable descriptions:
730  // FmtChkVar(const char* name, nc_type type, bool isMandatory, const QList<int> l,
731  // const QString& attLCode="", const QString& attDefinition="", const QString& attUnits="",
732  // const QString& attBand="")
733  fcAzTheo ("AzTheo", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
734  "AZ-THEO ", "Azimuth array definition", "radian, radian/sec"),
735  fcElTheo ("ElTheo", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
736  "EL-THEO ", "Elevation array definition", "radian, radian/sec"),
737  fcFeedRotation ("FeedRotation", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
738  "PARANGLE", "Feedhorn rot. angle", "radian"),
739  fcCalAxisOffset ("Cal-AxisOffset", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
740  "AXO CONT", "New Axis Offset Contributions", "second"),
741  fcCalCable ("Cal-Cable", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
742  "CABL DEL", "Cable calibration data", "second"),
743  fcCalSlantPathTropDry ("Cal-SlantPathTropDry",
744  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
745  "NDRYCONT", "Nhmf (dry) atm. contribution", "second"),
746  fcCalSlantPathTropWet ("Cal-SlantPathTropWet",
747  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
748  "NWETCONT", "Whmf (wet) atm. contribution", "second"),
750  ("Cal-StationOceanLoadVert",
751  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
752  "OCE VERT", "Site-dep ocean cont - vertical", "second"),
754  ("Cal-StationOceanLoadHoriz",
755  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
756  "OCE HORZ", "Site-dep ocean cont - horizontal", "second"),
757  fcCalUnPhaseCal ("Cal-UnPhaseCal", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2 ),
758  fcTempC ("TempC", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
759  "TEMP C", "Temp in C at local WX station", "Celsius"),
760  fcAtmPres ("AtmPres", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
761  "ATM PRES", "Pressure in hPa at site", "hPa"),
762  fcRelHum ("RelHum", NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
763  "REL.HUM.", "Rel.Hum. at local WX st; [0...1], 0.5=50%)", "unitless"),
764  fcPartAxisOffset ("Part-AxisOffset", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
765  "AXO PART", "Axis Offset partial deriv. def."),
766  fcDisOceanLoad ("Dis-OceanLoad", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2 << 3,
767  "OCE DELD", "Ocean load site dependent displace", "meter"),
769  ("Part-ZenithPathTropDry",
770  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
771  "NDRYPART", "Nhmf2 dry partial deriv. def."),
773  ("Part-ZenithPathTropWet",
774  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2,
775  "NWETPART", "Whmf2 wet partial deriv. def."),
776  fcPartHorizonGrad ("Part-HorizonGrad",
777  NC_DOUBLE, true, QList<int>() << SD_NumStnPts << 2 << 2,
778  "NGRADPAR", "Niell dry atm. gradient partials"),
779  fcRefClockOffset ("ReferenceClockOffset",
780  NC_DOUBLE, true, QList<int>() << SD_NumStnPts,
781  "", "Difference between reference station clock and UTC at the reference epoch", "sec"),
782 
783  fcTsysData ("TsysData", NC_DOUBLE, true, QList<int>() << SD_NumStnPts << SD_Any,
784  "", "System temperature"),
785  fcTsysIfFreq ("TsysIfreq", NC_DOUBLE, true, QList<int>() << SD_Any,
786  "", "Frequencies of IFs for TSYS data"),
787  fcTsysIfId ("TsysIfId", NC_CHAR , true, QList<int>() << SD_Any << SD_Any,
788  "", "Identifiers of IFs for TSYS data"),
789 
790  fcTsysIfSideBand ("TsysIfSideBand", NC_CHAR , true, QList<int>() << SD_Any << SD_Any,
791  "", "Sidebands of IFs for TSYS data"),
792 
793  fcTsysIfPolarization ("TsysIfPolarization",
794  NC_CHAR , true, QList<int>() << SD_Any << SD_Any,
795  "", "Polarizations of IFs for TSYS data"),
796 
797 
798 
799 
800 
801  fcStub ("", NC_CHAR, true, QList<int>() << 1, "", "")
802  ;
803 
804 
805 
806 
807 // netCDF files:
825 
837 
838  ;
839 
840 /*=====================================================================================================*/
841 
@ SD_NumStnPts
Definition: SgIoDriver.h:56
@ SD_Any
Definition: SgIoDriver.h:62
SgLogger * logger
Definition: SgLogger.cpp:231
SgVgosDb::FmtChkVar fcCalCable("Cal-Cable", NC_DOUBLE, true, QList< int >()<< SD_NumStnPts, "CABL DEL", "Cable calibration data", "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 * > 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")
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:2655
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:2159
QMap< QString, StationDescriptor > stnDescriptorByKey_
Definition: SgVgosDb.h:1444
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 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:1446
bool loadStationEpochs(const QString &stnName, QList< SgMJD > &epochs)
QString path2RootDir_
Definition: SgVgosDb.h:1394
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:1290
SgVdbVariable vPart_HorizonGrad_
Definition: SgVgosDb.h:1287
SgVdbVariable vPart_ZenithPathTropDry_
Definition: SgVgosDb.h:1285
SgVdbVariable vFeedRotation_
Definition: SgVgosDb.h:1277
SgVdbVariable vPart_AxisOffset_
Definition: SgVgosDb.h:1284
SgVdbVariable vDis_OceanLoad_
Definition: SgVgosDb.h:1288
SgVdbVariable vCal_OceanLoad_
Definition: SgVgosDb.h:1282
SgVdbVariable vPart_ZenithPathTropWet_
Definition: SgVgosDb.h:1286