[6176] | 1 | #include <iostream>
|
---|
[6177] | 2 | #include <iomanip>
|
---|
[6176] | 3 | #include <sstream>
|
---|
[6495] | 4 | #include <newmatio.h>
|
---|
[6144] | 5 |
|
---|
| 6 | #include "satObs.h"
|
---|
[6178] | 7 |
|
---|
[6144] | 8 | using namespace std;
|
---|
| 9 |
|
---|
[6466] | 10 | // Constructor
|
---|
[6144] | 11 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6466] | 12 | t_clkCorr::t_clkCorr() {
|
---|
[6589] | 13 | _updateInt = 0;
|
---|
[6160] | 14 | _iod = 0;
|
---|
| 15 | _dClk = 0.0;
|
---|
| 16 | _dotDClk = 0.0;
|
---|
| 17 | _dotDotDClk = 0.0;
|
---|
[6144] | 18 | }
|
---|
| 19 |
|
---|
| 20 | //
|
---|
| 21 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 22 | void t_clkCorr::writeEpoch(ostream* out, const QList<t_clkCorr>& corrList) {
|
---|
[6456] | 23 | if (!out || corrList.size() == 0) {
|
---|
| 24 | return;
|
---|
| 25 | }
|
---|
[6457] | 26 | out->setf(ios::fixed);
|
---|
| 27 | bncTime epoTime;
|
---|
| 28 | QListIterator<t_clkCorr> it(corrList);
|
---|
| 29 | while (it.hasNext()) {
|
---|
| 30 | const t_clkCorr& corr = it.next();
|
---|
| 31 | if (!epoTime.valid()) {
|
---|
| 32 | epoTime = corr._time;
|
---|
[6556] | 33 | *out << "> CLOCK " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
|
---|
| 34 | << corr._updateInt << " "
|
---|
[6458] | 35 | << corrList.size() << ' ' << corr._staID << endl;
|
---|
[6457] | 36 | }
|
---|
| 37 | *out << corr._prn.toString() << ' ' << setw(3) << corr._iod << ' '
|
---|
| 38 | << setw(10) << setprecision(4) << corr._dClk * t_CST::c << ' '
|
---|
| 39 | << setw(10) << setprecision(4) << corr._dotDClk * t_CST::c << ' '
|
---|
| 40 | << setw(10) << setprecision(4) << corr._dotDotDClk * t_CST::c << endl;
|
---|
| 41 | }
|
---|
[6456] | 42 | out->flush();
|
---|
[6144] | 43 | }
|
---|
| 44 |
|
---|
| 45 | //
|
---|
| 46 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 47 | void t_clkCorr::readEpoch(const string& epoLine, istream& inStream, QList<t_clkCorr>& corrList) {
|
---|
[6556] | 48 | bncTime epoTime;
|
---|
| 49 | unsigned int updateInt;
|
---|
| 50 | int numCorr;
|
---|
| 51 | string staID;
|
---|
| 52 | if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numCorr, staID) != t_corrSSR::clkCorr) {
|
---|
[6502] | 53 | return;
|
---|
| 54 | }
|
---|
[6503] | 55 | for (int ii = 0; ii < numCorr; ii++) {
|
---|
[6504] | 56 | t_clkCorr corr;
|
---|
[6556] | 57 | corr._time = epoTime;
|
---|
| 58 | corr._updateInt = updateInt;
|
---|
| 59 | corr._staID = staID;
|
---|
[6503] | 60 |
|
---|
| 61 | string line;
|
---|
[6507] | 62 | getline(inStream, line);
|
---|
[6503] | 63 | istringstream in(line.c_str());
|
---|
| 64 |
|
---|
[6504] | 65 | in >> corr._prn >> corr._iod >> corr._dClk >> corr._dotDClk >> corr._dotDotDClk;
|
---|
[6503] | 66 |
|
---|
[6513] | 67 | corr._dClk /= t_CST::c;
|
---|
| 68 | corr._dotDClk /= t_CST::c;
|
---|
| 69 | corr._dotDotDClk /= t_CST::c;
|
---|
| 70 |
|
---|
[6504] | 71 | corrList.push_back(corr);
|
---|
[6503] | 72 | }
|
---|
[6180] | 73 | }
|
---|
| 74 |
|
---|
[6466] | 75 | // Constructor
|
---|
[6180] | 76 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6466] | 77 | t_orbCorr::t_orbCorr() {
|
---|
[6589] | 78 | _updateInt = 0;
|
---|
| 79 | _iod = 0;
|
---|
| 80 | _system = 'R';
|
---|
[6160] | 81 | _xr.ReSize(3); _xr = 0.0;
|
---|
| 82 | _dotXr.ReSize(3); _dotXr = 0.0;
|
---|
[6144] | 83 | }
|
---|
| 84 |
|
---|
| 85 | //
|
---|
| 86 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 87 | void t_orbCorr::writeEpoch(ostream* out, const QList<t_orbCorr>& corrList) {
|
---|
[6456] | 88 | if (!out || corrList.size() == 0) {
|
---|
| 89 | return;
|
---|
| 90 | }
|
---|
[6460] | 91 | out->setf(ios::fixed);
|
---|
| 92 | bncTime epoTime;
|
---|
| 93 | QListIterator<t_orbCorr> it(corrList);
|
---|
| 94 | while (it.hasNext()) {
|
---|
| 95 | const t_orbCorr& corr = it.next();
|
---|
| 96 | if (!epoTime.valid()) {
|
---|
| 97 | epoTime = corr._time;
|
---|
[6556] | 98 | *out << "> ORBIT " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
|
---|
| 99 | << corr._updateInt << " "
|
---|
[6460] | 100 | << corrList.size() << ' ' << corr._staID << endl;
|
---|
| 101 | }
|
---|
| 102 | *out << corr._prn.toString() << ' ' << setw(3) << corr._iod << ' '
|
---|
| 103 | << setw(10) << setprecision(4) << corr._xr[0] << ' '
|
---|
| 104 | << setw(10) << setprecision(4) << corr._xr[1] << ' '
|
---|
| 105 | << setw(10) << setprecision(4) << corr._xr[2] << " "
|
---|
| 106 | << setw(10) << setprecision(4) << corr._dotXr[0] << ' '
|
---|
| 107 | << setw(10) << setprecision(4) << corr._dotXr[1] << ' '
|
---|
| 108 | << setw(10) << setprecision(4) << corr._dotXr[2] << endl;
|
---|
| 109 | }
|
---|
[6456] | 110 | out->flush();
|
---|
[6144] | 111 | }
|
---|
| 112 |
|
---|
[6455] | 113 | //
|
---|
| 114 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 115 | void t_orbCorr::readEpoch(const string& epoLine, istream& inStream, QList<t_orbCorr>& corrList) {
|
---|
[6556] | 116 | bncTime epoTime;
|
---|
| 117 | unsigned int updateInt;
|
---|
| 118 | int numCorr;
|
---|
| 119 | string staID;
|
---|
| 120 | if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numCorr, staID) != t_corrSSR::orbCorr) {
|
---|
[6504] | 121 | return;
|
---|
| 122 | }
|
---|
| 123 | for (int ii = 0; ii < numCorr; ii++) {
|
---|
| 124 | t_orbCorr corr;
|
---|
[6556] | 125 | corr._time = epoTime;
|
---|
| 126 | corr._updateInt = updateInt;
|
---|
| 127 | corr._staID = staID;
|
---|
[6504] | 128 |
|
---|
| 129 | string line;
|
---|
[6507] | 130 | getline(inStream, line);
|
---|
[6504] | 131 | istringstream in(line.c_str());
|
---|
| 132 |
|
---|
| 133 | in >> corr._prn >> corr._iod
|
---|
| 134 | >> corr._xr[0] >> corr._xr[1] >> corr._xr[2]
|
---|
| 135 | >> corr._dotXr[0] >> corr._dotXr[1] >> corr._dotXr[2];
|
---|
| 136 |
|
---|
| 137 | corrList.push_back(corr);
|
---|
| 138 | }
|
---|
[6455] | 139 | }
|
---|
[6475] | 140 |
|
---|
| 141 | //
|
---|
| 142 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 143 | void t_satCodeBias::writeEpoch(ostream* out, const QList<t_satCodeBias>& biasList) {
|
---|
[6476] | 144 | if (!out || biasList.size() == 0) {
|
---|
| 145 | return;
|
---|
| 146 | }
|
---|
| 147 | out->setf(ios::fixed);
|
---|
| 148 | bncTime epoTime;
|
---|
| 149 | QListIterator<t_satCodeBias> it(biasList);
|
---|
| 150 | while (it.hasNext()) {
|
---|
| 151 | const t_satCodeBias& satCodeBias = it.next();
|
---|
| 152 | if (!epoTime.valid()) {
|
---|
| 153 | epoTime = satCodeBias._time;
|
---|
[6556] | 154 | *out << "> CODE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
|
---|
| 155 | << satCodeBias._updateInt << " "
|
---|
[6476] | 156 | << biasList.size() << ' ' << satCodeBias._staID << endl;
|
---|
| 157 | }
|
---|
[6567] | 158 | *out << satCodeBias._prn.toString() << " " << setw(2) << satCodeBias._bias.size();
|
---|
[6477] | 159 | for (unsigned ii = 0; ii < satCodeBias._bias.size(); ii++) {
|
---|
| 160 | const t_frqCodeBias& frqCodeBias = satCodeBias._bias[ii];
|
---|
| 161 | *out << " " << frqCodeBias._rnxType2ch << ' '
|
---|
| 162 | << setw(10) << setprecision(4) << frqCodeBias._value;
|
---|
| 163 | }
|
---|
[6476] | 164 | *out << endl;
|
---|
| 165 | }
|
---|
| 166 | out->flush();
|
---|
[6475] | 167 | }
|
---|
| 168 |
|
---|
| 169 | //
|
---|
| 170 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 171 | void t_satCodeBias::readEpoch(const string& epoLine, istream& inStream, QList<t_satCodeBias>& biasList) {
|
---|
[6556] | 172 | bncTime epoTime;
|
---|
| 173 | unsigned int updateInt;
|
---|
| 174 | int numSat;
|
---|
| 175 | string staID;
|
---|
| 176 | if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numSat, staID) != t_corrSSR::codeBias) {
|
---|
[6505] | 177 | return;
|
---|
| 178 | }
|
---|
| 179 | for (int ii = 0; ii < numSat; ii++) {
|
---|
| 180 | t_satCodeBias satCodeBias;
|
---|
[6556] | 181 | satCodeBias._time = epoTime;
|
---|
| 182 | satCodeBias._updateInt = updateInt;
|
---|
| 183 | satCodeBias._staID = staID;
|
---|
[6505] | 184 |
|
---|
| 185 | string line;
|
---|
[6507] | 186 | getline(inStream, line);
|
---|
[6505] | 187 | istringstream in(line.c_str());
|
---|
| 188 |
|
---|
[6567] | 189 | int numBias;
|
---|
| 190 | in >> satCodeBias._prn >> numBias;
|
---|
[6505] | 191 |
|
---|
| 192 | while (in.good()) {
|
---|
| 193 | t_frqCodeBias frqCodeBias;
|
---|
| 194 | in >> frqCodeBias._rnxType2ch >> frqCodeBias._value;
|
---|
| 195 | if (!frqCodeBias._rnxType2ch.empty()) {
|
---|
| 196 | satCodeBias._bias.push_back(frqCodeBias);
|
---|
| 197 | }
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | biasList.push_back(satCodeBias);
|
---|
| 201 | }
|
---|
[6475] | 202 | }
|
---|
[6481] | 203 |
|
---|
| 204 | //
|
---|
| 205 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 206 | void t_satPhaseBias::writeEpoch(ostream* out, const QList<t_satPhaseBias>& biasList) {
|
---|
[6493] | 207 | if (!out || biasList.size() == 0) {
|
---|
| 208 | return;
|
---|
| 209 | }
|
---|
| 210 | out->setf(ios::fixed);
|
---|
| 211 | bncTime epoTime;
|
---|
| 212 | QListIterator<t_satPhaseBias> it(biasList);
|
---|
| 213 | while (it.hasNext()) {
|
---|
| 214 | const t_satPhaseBias& satPhaseBias = it.next();
|
---|
| 215 | if (!epoTime.valid()) {
|
---|
| 216 | epoTime = satPhaseBias._time;
|
---|
[6556] | 217 | *out << "> PHASE_BIAS " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
|
---|
| 218 | << satPhaseBias._updateInt << " "
|
---|
[6857] | 219 | << biasList.size() << ' ' << satPhaseBias._staID << endl;
|
---|
[6859] | 220 | *out << " " << satPhaseBias._dispBiasConstistInd << " "
|
---|
| 221 | << satPhaseBias._MWConsistInd << endl;
|
---|
[6493] | 222 | }
|
---|
[6494] | 223 | *out << satPhaseBias._prn.toString() << ' '
|
---|
| 224 | << setw(12) << setprecision(8) << satPhaseBias._yawDeg << ' '
|
---|
[6567] | 225 | << setw(12) << setprecision(8) << satPhaseBias._yawDegRate << " "
|
---|
| 226 | << setw(2) << satPhaseBias._bias.size();
|
---|
[6493] | 227 | for (unsigned ii = 0; ii < satPhaseBias._bias.size(); ii++) {
|
---|
| 228 | const t_frqPhaseBias& frqPhaseBias = satPhaseBias._bias[ii];
|
---|
| 229 | *out << " " << frqPhaseBias._rnxType2ch << ' '
|
---|
[6494] | 230 | << setw(10) << setprecision(4) << frqPhaseBias._value << ' '
|
---|
| 231 | << setw(3) << frqPhaseBias._fixIndicator << ' '
|
---|
| 232 | << setw(3) << frqPhaseBias._fixWideLaneIndicator << ' '
|
---|
| 233 | << setw(3) << frqPhaseBias._jumpCounter;
|
---|
[6493] | 234 | }
|
---|
| 235 | *out << endl;
|
---|
| 236 | }
|
---|
| 237 | out->flush();
|
---|
[6481] | 238 | }
|
---|
| 239 |
|
---|
| 240 | //
|
---|
| 241 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 242 | void t_satPhaseBias::readEpoch(const string& epoLine, istream& inStream, QList<t_satPhaseBias>& biasList) {
|
---|
[6556] | 243 | bncTime epoTime;
|
---|
| 244 | unsigned int updateInt;
|
---|
| 245 | int numSat;
|
---|
| 246 | string staID;
|
---|
[6859] | 247 | unsigned int dispInd;
|
---|
| 248 | unsigned int mwInd;
|
---|
[6556] | 249 | if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numSat, staID) != t_corrSSR::phaseBias) {
|
---|
[6506] | 250 | return;
|
---|
| 251 | }
|
---|
[6859] | 252 | for (int ii = 0; ii <= numSat; ii++) {
|
---|
[6506] | 253 | t_satPhaseBias satPhaseBias;
|
---|
[6556] | 254 | satPhaseBias._time = epoTime;
|
---|
| 255 | satPhaseBias._updateInt = updateInt;
|
---|
| 256 | satPhaseBias._staID = staID;
|
---|
[6506] | 257 |
|
---|
| 258 | string line;
|
---|
[6507] | 259 | getline(inStream, line);
|
---|
[6506] | 260 | istringstream in(line.c_str());
|
---|
[6857] | 261 |
|
---|
[6859] | 262 | if (ii == 0) {
|
---|
| 263 | in >> dispInd >> mwInd;
|
---|
| 264 | continue;
|
---|
| 265 | }
|
---|
| 266 | satPhaseBias._dispBiasConstistInd = dispInd;
|
---|
| 267 | satPhaseBias._MWConsistInd = mwInd;
|
---|
| 268 |
|
---|
[6567] | 269 | int numBias;
|
---|
[6859] | 270 | in >> satPhaseBias._prn >> satPhaseBias._yawDeg >> satPhaseBias._yawDegRate
|
---|
| 271 | >> numBias;
|
---|
[6506] | 272 |
|
---|
| 273 | while (in.good()) {
|
---|
| 274 | t_frqPhaseBias frqPhaseBias;
|
---|
| 275 | in >> frqPhaseBias._rnxType2ch >> frqPhaseBias._value
|
---|
| 276 | >> frqPhaseBias._fixIndicator >> frqPhaseBias._fixWideLaneIndicator
|
---|
| 277 | >> frqPhaseBias._jumpCounter;
|
---|
| 278 | if (!frqPhaseBias._rnxType2ch.empty()) {
|
---|
| 279 | satPhaseBias._bias.push_back(frqPhaseBias);
|
---|
| 280 | }
|
---|
| 281 | }
|
---|
| 282 |
|
---|
| 283 | biasList.push_back(satPhaseBias);
|
---|
| 284 | }
|
---|
[6481] | 285 | }
|
---|
[6482] | 286 |
|
---|
| 287 | //
|
---|
| 288 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 289 | void t_vTec::write(ostream* out, const t_vTec& vTec) {
|
---|
[6493] | 290 | if (!out || vTec._layers.size() == 0) {
|
---|
| 291 | return;
|
---|
| 292 | }
|
---|
| 293 | out->setf(ios::fixed);
|
---|
| 294 | bncTime epoTime = vTec._time;
|
---|
[6556] | 295 | *out << "> VTEC " << epoTime.datestr(' ') << ' ' << epoTime.timestr(1,' ') << " "
|
---|
| 296 | << vTec._updateInt << " "
|
---|
[6493] | 297 | << vTec._layers.size() << ' ' << vTec._staID << endl;
|
---|
[6495] | 298 | for (unsigned ii = 0; ii < vTec._layers.size(); ii++) {
|
---|
| 299 | const t_vTecLayer& layer = vTec._layers[ii];
|
---|
[6496] | 300 | *out << setw(2) << ii+1 << ' '
|
---|
[6878] | 301 | << setw(2) << layer._C.Nrows()-1 << ' '
|
---|
| 302 | << setw(2) << layer._C.Ncols()-1 << ' '
|
---|
[6496] | 303 | << setw(10) << setprecision(1) << layer._height << endl
|
---|
[6495] | 304 | << setw(10) << setprecision(4) << layer._C
|
---|
| 305 | << setw(10) << setprecision(4) << layer._S;
|
---|
| 306 | }
|
---|
[6493] | 307 | out->flush();
|
---|
[6482] | 308 | }
|
---|
| 309 |
|
---|
| 310 | //
|
---|
| 311 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6507] | 312 | void t_vTec::read(const string& epoLine, istream& inStream, t_vTec& vTec) {
|
---|
[6556] | 313 | bncTime epoTime;
|
---|
| 314 | unsigned int updateInt;
|
---|
| 315 | int numLayers;
|
---|
| 316 | string staID;
|
---|
| 317 | if (t_corrSSR::readEpoLine(epoLine, epoTime, updateInt, numLayers, staID) != t_corrSSR::vTec) {
|
---|
[6507] | 318 | return;
|
---|
| 319 | }
|
---|
| 320 | if (numLayers <= 0) {
|
---|
| 321 | return;
|
---|
| 322 | }
|
---|
[6556] | 323 | vTec._time = epoTime;
|
---|
| 324 | vTec._updateInt = updateInt;
|
---|
| 325 | vTec._staID = staID;
|
---|
[6507] | 326 | for (int ii = 0; ii < numLayers; ii++) {
|
---|
| 327 | t_vTecLayer layer;
|
---|
| 328 |
|
---|
| 329 | string line;
|
---|
| 330 | getline(inStream, line);
|
---|
| 331 | istringstream in(line.c_str());
|
---|
| 332 |
|
---|
| 333 | int dummy, maxDeg, maxOrd;
|
---|
[6515] | 334 | in >> dummy >> maxDeg >> maxOrd >> layer._height;
|
---|
[6507] | 335 |
|
---|
[6878] | 336 | layer._C.ReSize(maxDeg+1, maxOrd+1);
|
---|
| 337 | layer._S.ReSize(maxDeg+1, maxOrd+1);
|
---|
[6507] | 338 |
|
---|
[6878] | 339 | for (int iDeg = 0; iDeg <= maxDeg; iDeg++) {
|
---|
| 340 | for (int iOrd = 0; iOrd <= maxOrd; iOrd++) {
|
---|
[6508] | 341 | inStream >> layer._C[iDeg][iOrd];
|
---|
| 342 | }
|
---|
| 343 | }
|
---|
[6878] | 344 | for (int iDeg = 0; iDeg <= maxDeg; iDeg++) {
|
---|
| 345 | for (int iOrd = 0; iOrd <= maxOrd; iOrd++) {
|
---|
[6508] | 346 | inStream >> layer._S[iDeg][iOrd];
|
---|
| 347 | }
|
---|
| 348 | }
|
---|
[6507] | 349 |
|
---|
| 350 | vTec._layers.push_back(layer);
|
---|
| 351 | }
|
---|
[6482] | 352 | }
|
---|
[6498] | 353 |
|
---|
| 354 | //
|
---|
| 355 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6501] | 356 | t_corrSSR::e_type t_corrSSR::readEpoLine(const string& line, bncTime& epoTime,
|
---|
[6556] | 357 | unsigned int& updateInt, int& numEntries,
|
---|
| 358 | string& staID) {
|
---|
[6498] | 359 |
|
---|
[6500] | 360 | istringstream inLine(line.c_str());
|
---|
| 361 |
|
---|
| 362 | char epoChar;
|
---|
| 363 | string typeString;
|
---|
| 364 | int year, month, day, hour, min;
|
---|
| 365 | double sec;
|
---|
| 366 |
|
---|
[6501] | 367 | inLine >> epoChar >> typeString
|
---|
[6556] | 368 | >> year >> month >> day >> hour >> min >> sec >> updateInt >> numEntries >> staID;
|
---|
[6500] | 369 |
|
---|
| 370 | if (epoChar == '>') {
|
---|
| 371 | epoTime.set(year, month, day, hour, min, sec);
|
---|
| 372 | if (typeString == "CLOCK") {
|
---|
| 373 | return clkCorr;
|
---|
| 374 | }
|
---|
| 375 | else if (typeString == "ORBIT") {
|
---|
| 376 | return orbCorr;
|
---|
| 377 | }
|
---|
| 378 | else if (typeString == "CODE_BIAS") {
|
---|
| 379 | return codeBias;
|
---|
| 380 | }
|
---|
| 381 | else if (typeString == "PHASE_BIAS") {
|
---|
| 382 | return phaseBias;
|
---|
| 383 | }
|
---|
| 384 | else if (typeString == "VTEC") {
|
---|
| 385 | return vTec;
|
---|
| 386 | }
|
---|
| 387 | }
|
---|
| 388 |
|
---|
| 389 | return unknown;
|
---|
[6498] | 390 | }
|
---|