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