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