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