DiscCorr.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
46 #ifndef GNSSTK_DISCONTINUITY_CORRECTOR_INCLUDE
47 #define GNSSTK_DISCONTINUITY_CORRECTOR_INCLUDE
48 
49 #include "gnsstk_export.h"
50 #include "Epoch.hpp"
51 #include "Exception.hpp"
52 #include "RinexObsHeader.hpp"
53 #include "RinexSatID.hpp"
54 #include "SatPass.hpp"
55 
56 #include <fstream>
57 #include <iostream>
58 #include <map>
59 #include <sstream>
60 #include <string>
61 #include <vector>
62 
63 namespace gnsstk
64 {
67 
73  {
74  public:
79  {
80  CFG.clear();
81  CFGdescription.clear();
82  }
83 
90  void setParameter(std::string cmd);
91 
97  void setParameter(const std::string& label, double value);
98 
100  double getParameter(const std::string& label)
101  {
102  if (CFG.find(label) == CFG.end())
103  {
104  return 0.0; // TD throw?
105  }
106  return CFG[label];
107  }
108 
110  std::string getDescription(const std::string& label)
111  {
112  if (CFGdescription.find(label) == CFGdescription.end())
113  {
114  return std::string("Invalid label");
115  }
116  return CFGdescription[label];
117  }
118 
120  void setDebugStream(std::ostream& os) { p_oflog = &os; }
121 
128  void DisplayParameterUsage(std::ostream& os, bool advanced = false);
129 
131  std::string Version() { return GDCVersion; }
132 
133  protected:
135  std::map<std::string, double> CFG;
136 
138  std::map<std::string, std::string> CFGdescription;
139 
141  std::ostream *p_oflog;
142 
143  void initialize();
144 
145  GNSSTK_EXPORT
146  static const std::string GDCVersion;
147 
148  }; // end class GDCconfiguration
149 
156  class GDCreturn
157  {
158  public:
160  explicit GDCreturn(std::string msg)
161  {
162  passN = -1;
163  nGFslips = nWLslips = 0;
166  WLsig = GFsig = 0.0;
167  sat = "";
168  GLOn = -99;
169 
170  std::string::size_type pos;
171  std::string word, line;
172  std::vector<std::string> lines, words;
173  if (msg.empty())
174  {
175  return;
176  }
177  // split into lines
178  while (1)
179  {
180  pos = msg.find_first_not_of("\n");
181  if (pos > 0)
182  {
183  msg.erase(0, pos);
184  }
185  if (msg.empty())
186  {
187  break;
188  }
189  pos = msg.find_first_of("\n");
190  if (pos > 0)
191  {
192  word = msg.substr(0, pos);
193  msg.erase(0, pos);
194  }
195  else
196  {
197  word = msg;
198  msg.clear();
199  }
200  lines.push_back(word);
201  }
202 
203  ptsdeleted = ptsgood = 0;
204  for (int i = 0; i < lines.size(); i++)
205  {
206  line = lines[i];
207  if (line.empty())
208  {
209  continue;
210  }
211  // split line into words
212  words.clear();
213  while (1)
214  {
215  pos = line.find_first_not_of(" \t\n");
216  if (pos != 0 && pos != std::string::npos)
217  {
218  line.erase(0, pos);
219  }
220  if (line.empty())
221  {
222  break;
223  }
224  pos = line.find_first_of(" \t\n");
225  if (pos == std::string::npos)
226  {
227  word = line;
228  }
229  else
230  {
231  word = line.substr(0, pos);
232  }
233  if (!word.empty())
234  {
235  words.push_back(word);
236  line.erase(0, word.length() + 1);
237  }
238  }
239 
240  // std::cout << "Line " << i << ":";
241  // for(int j=0; j<words.size(); j++) std::cout << " /" << words[j]
242  // << "/"; std::cout << std::endl;
243 
244  line = lines[i];
245  // std::cout << line << std::endl;
246  if (line.find("WL sigma in cycles", 0) != std::string::npos)
247  {
248  passN = strtol(words[1].c_str(), 0, 10);
249  }
250  else if (line.find("insufficient data", 0) != std::string::npos)
251  {
252  passN = strtol(words[1].c_str(), 0, 10);
253  }
254  else if (line.find("list of Segments", 0) != std::string::npos)
255  {
256  passN = strtol(words[1].c_str(), 0, 10);
257  }
258  if (line.find("bias(wl)", 0) != std::string::npos)
259  {
260  sat = words[2];
261  word = words[5];
262  pos = word.find_first_of("/");
263  if (pos > 0)
264  {
265  word = words[5].substr(0, pos);
266  }
267  ptsgood += strtol(word.c_str(), 0, 10);
268  }
269  if (line.find("WL slip gross", 0) != std::string::npos)
270  {
271  nWLslipGross = strtol(words[3].c_str(), 0, 10);
272  }
273  if (line.find("WL slip small", 0) != std::string::npos)
274  {
275  nWLslipSmall = strtol(words[3].c_str(), 0, 10);
276  }
277  if (line.find("GF slip gross", 0) != std::string::npos)
278  {
279  nGFslipGross = strtol(words[3].c_str(), 0, 10);
280  }
281  if (line.find("GF slip small", 0) != std::string::npos)
282  {
283  nGFslipSmall = strtol(words[3].c_str(), 0, 10);
284  }
285  if (line.find("sigma GF variation", 0) != std::string::npos)
286  {
287  GFsig = strtod(words[3].c_str(), 0);
288  }
289  if (line.find("WL sigma in cycles", 0) != std::string::npos)
290  {
291  WLsig = strtod(words[3].c_str(), 0);
292  }
293  if (line.find("points deleted", 0) != std::string::npos)
294  {
295  ptsdeleted += strtol(words[3].c_str(), 0, 10);
296  }
297  if (line.find("GLONASS frequency channel", 0) != std::string::npos)
298  {
299  GLOn = strtod(words[3].c_str(), 0);
300  }
301  }
302 
305 
306  } // end constructor/parser
307 
308  int passN, GLOn;
312  double WLsig, GFsig;
313  std::string sat;
314 
315  }; // end class GDCreturn
316 
348  std::vector<std::string>& EditCmds,
349  std::string& retMsg, int GLOn = -99);
350 
352 
353 } // end namespace gnsstk
354 
355 //------------------------------------------------------------------------------------
356 #endif
gnsstk::GDCconfiguration::setDebugStream
void setDebugStream(std::ostream &os)
Tell GDCconfiguration to which stream to send debugging output.
Definition: DiscCorr.hpp:120
SatPass.hpp
gnsstk::GDCreturn
Definition: DiscCorr.hpp:156
gnsstk::DiscontinuityCorrector
int DiscontinuityCorrector(SatPass &SP, GDCconfiguration &config, std::vector< std::string > &EditCmds, std::string &retMsg, int GLOn=-99)
Definition: DiscCorr.cpp:698
gnsstk::GDCconfiguration::DisplayParameterUsage
void DisplayParameterUsage(std::ostream &os, bool advanced=false)
Definition: DiscCorr.cpp:171
gnsstk::StringUtils::word
std::string word(const std::string &s, const std::string::size_type wordNum=0, const char delimiter=' ')
Definition: StringUtils.hpp:1112
gnsstk::GDCconfiguration
Definition: DiscCorr.hpp:72
gnsstk::GDCreturn::nGFslips
int nGFslips
Definition: DiscCorr.hpp:309
gnsstk::GDCconfiguration::Version
std::string Version()
Return version string.
Definition: DiscCorr.hpp:131
gnsstk::SatPass
Definition: SatPass.hpp:71
gnsstk::GDCconfiguration::GDCconfiguration
GDCconfiguration()
constructor; this sets a full default set of parameters.
Definition: DiscCorr.hpp:76
gnsstk::GDCreturn::ptsgood
int ptsgood
Definition: DiscCorr.hpp:311
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::GDCconfiguration::setParameter
void setParameter(std::string cmd)
Definition: DiscCorr.cpp:80
gnsstk::StringUtils::words
std::string words(const std::string &s, const std::string::size_type firstWord=0, const std::string::size_type numWords=std::string::npos, const char delimiter=' ')
Definition: StringUtils.hpp:2199
gnsstk::GDCconfiguration::~GDCconfiguration
~GDCconfiguration()
destructor
Definition: DiscCorr.hpp:78
gnsstk::GDCreturn::GFsig
double GFsig
Definition: DiscCorr.hpp:312
gnsstk::GDCreturn::GDCreturn
GDCreturn(std::string msg)
constructor; this parses the string
Definition: DiscCorr.hpp:160
gnsstk::GDCconfiguration::getDescription
std::string getDescription(const std::string &label)
Get the description of a parameter.
Definition: DiscCorr.hpp:110
gnsstk::GDCconfiguration::CFGdescription
std::map< std::string, std::string > CFGdescription
map containing configuration labels and their descriptions
Definition: DiscCorr.hpp:138
gnsstk::GDCreturn::nGFslipSmall
int nGFslipSmall
Definition: DiscCorr.hpp:309
gnsstk::GDCreturn::nGFslipGross
int nGFslipGross
Definition: DiscCorr.hpp:309
gnsstk::GDCconfiguration::CFG
std::map< std::string, double > CFG
map containing configuration labels and their values
Definition: DiscCorr.hpp:135
gnsstk::GDCconfiguration::getParameter
double getParameter(const std::string &label)
Get the parameter in the configuration corresponding to label.
Definition: DiscCorr.hpp:100
example4.pos
pos
Definition: example4.py:125
gnsstk::GDCreturn::GLOn
int GLOn
Definition: DiscCorr.hpp:308
gnsstk::GDCconfiguration::GDCVersion
static const GNSSTK_EXPORT std::string GDCVersion
Definition: DiscCorr.hpp:146
RinexObsHeader.hpp
gnsstk::GDCreturn::nWLslips
int nWLslips
Definition: DiscCorr.hpp:309
Exception.hpp
gnsstk::GDCconfiguration::p_oflog
std::ostream * p_oflog
Stream on which to write debug output.
Definition: DiscCorr.hpp:141
Epoch.hpp
gnsstk::GDCreturn::WLsig
double WLsig
Definition: DiscCorr.hpp:312
gnsstk::GDCconfiguration::initialize
void initialize()
Definition: DiscCorr.cpp:236
gnsstk::GDCreturn::passN
int passN
Definition: DiscCorr.hpp:308
RinexSatID.hpp
gnsstk::GDCreturn::nWLslipGross
int nWLslipGross
Definition: DiscCorr.hpp:309
GLOn
int GLOn
Definition: DiscCorr.cpp:655
gnsstk::GDCreturn::sat
std::string sat
Definition: DiscCorr.hpp:313
gnsstk::GDCreturn::nWLslipSmall
int nWLslipSmall
Definition: DiscCorr.hpp:310
gnsstk::GDCreturn::ptsdeleted
int ptsdeleted
Definition: DiscCorr.hpp:311


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38