Rinex3ObsFilterOperators.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 
44 #ifndef GNSSTK_RINEX3OBSFILTEROPERATORS_HPP
45 #define GNSSTK_RINEX3OBSFILTEROPERATORS_HPP
46 
47 #include <set>
48 #include <algorithm>
49 
50 #include "FileFilter.hpp"
51 #include "Rinex3ObsData.hpp"
52 #include "Rinex3ObsHeader.hpp"
53 #include "ObsID.hpp"
54 
55 namespace gnsstk
56 {
58 
59 
68  public std::binary_function<Rinex3ObsData, Rinex3ObsData, bool>
69  {
70  public:
75  Rinex3ObsHeader::RinexObsMap& unionMap) : rom(unionMap){};
76 
77  bool operator()(const Rinex3ObsData& l, const Rinex3ObsHeader& lheader,
78  const Rinex3ObsData& r, const Rinex3ObsHeader& rheader,
79  double epsilon) const
80  {
81  // compare the times, offsets, then only those elements
82  // that are common to both. this ignores the flags
83  // that are set to 0
84  if (l.time < r.time)
85  {
86  return true;
87  }
88  else if (l.time == r.time)
89  {
90  if (l.epochFlag < r.epochFlag)
91  {
92  return true;
93  }
94  else if (l.epochFlag == r.epochFlag)
95  {
96  if (l.clockOffset < r.clockOffset)
97  {
98  return true;
99  }
100  else if (l.clockOffset > r.clockOffset)
101  return false;
102  }
103  else
104  return false;
105  }
106  else
107  return false;
108 
109  // for the obs, first check that they're the same size
110  // i.e. - contain the same number of PRNs
111  if (l.obs.size() < r.obs.size())
112  {
113  return true;
114  }
115 
116  if (l.obs.size() > r.obs.size())
117  {
118  return false;
119  }
120 
121  // then check that each PRN has the same data for each of the
122  // fields
123  Rinex3ObsData::DataMap::const_iterator lItr;
124  for (lItr = l.obs.begin(); lItr != l.obs.end(); lItr++)
125  {
126  SatID sat = lItr->first;
127  Rinex3ObsData::DataMap::const_iterator rItr = r.obs.find(sat);
128  if (rItr == r.obs.end())
129  {
130  return false;
131  }
132 
133  std::vector<RinexDatum> lObs = lItr->second,
134  rObs = rItr->second;
135  Rinex3ObsHeader::RinexObsMap::const_iterator romItr;
136  for(romItr = rom.begin(); romItr != rom.end(); romItr++)
137  {
138  Rinex3ObsHeader::RinexObsVec::const_iterator rvItr;
139  for(rvItr = romItr->second.begin();
140  rvItr != romItr->second.end();
141  rvItr++)
142  {
143  RinexDatum lData, rData;
144  lData = lObs[lheader.getObsIndex(romItr->first,*rvItr)];
145  rData = rObs[rheader.getObsIndex(romItr->first,*rvItr)];
146 
147  if (lData.data + epsilon < rData.data)
148  {
149  return true;
150  }
151 
152  if (lData.lli != 0 && rData.lli != 0) if (lData.lli <
153  rData.lli)
154  {
155  return true;
156  }
157 
158  if (lData.ssi != 0 && rData.ssi != 0) if (lData.ssi <
159  rData.ssi)
160  {
161  return true;
162  }
163  }
164  }
165  }
166 
167  // the data is either == or > at this point
168 
169  return false;
170  }
172  };
173 
177  public std::binary_function<Rinex3ObsData, Rinex3ObsData, bool>
178  {
179  public:
180  bool operator()(const Rinex3ObsData& l, const Rinex3ObsData& r) const
181  {
182  if (l.time < r.time)
183  return true;
184  return false;
185  }
186  };
187 
191  public std::binary_function<Rinex3ObsData, Rinex3ObsData, bool>
192  {
193  public:
194  bool operator()(const Rinex3ObsData& l, const Rinex3ObsData& r) const
195  {
196  if (l.time == r.time)
197  return true;
198  return false;
199  }
200  };
201 
210  public std::unary_function<Rinex3ObsHeader, bool>
211  {
212  public:
214  : firstHeader(true)
215  {}
216 
220  {
221  if (firstHeader)
222  {
223  theHeader = l;
224  firstHeader = false;
225  }
226  else
227  {
228  std::set<std::string> commentSet;
229 
230  // insert the comments to the set
231  // and let the set take care of uniqueness
232  std::copy(theHeader.commentList.begin(),
233  theHeader.commentList.end(),
234  std::inserter(commentSet, commentSet.begin()));
235  std::copy(l.commentList.begin(),
236  l.commentList.end(),
237  std::inserter(commentSet, commentSet.begin()));
238  // then copy the comments back into theHeader
239  theHeader.commentList.clear();
240  std::copy(commentSet.begin(), commentSet.end(),
241  std::inserter(theHeader.commentList,
242  theHeader.commentList.begin()));
243 
244  Rinex3ObsHeader::RinexObsMap::const_iterator i;
245  Rinex3ObsHeader::RinexObsVec::const_iterator j, k;
247  for( i = l.mapObsTypes.begin(); i != l.mapObsTypes.end(); i++)
248  {
249  const std::string& sys = i->first;
250  const Rinex3ObsHeader::RinexObsVec& rov = i->second;
251  if (rom.count(sys) ==0)
252  rom[sys] = Rinex3ObsHeader::RinexObsVec();
253  for (j = rov.begin(); j != rov.end(); j++)
254  {
255  k = std::find(rom[sys].begin(), rom[sys].end(), *j);
256  if (k == rom[sys].end())
257  {
258  std::cout << "Adding " << *j << std::endl;
259  rom[sys].push_back(*j);
260  }
261  }
262  }
263  }
264  return true;
265  }
266 
269  };
270 
272 
273 } // namespace gnsstk
274 
275 #endif // GNSSTK_RINEX3OBSFILTEROPERATORS_HPP
gnsstk::Rinex3ObsHeader::commentList
StringVec commentList
comments in header
Definition: Rinex3ObsHeader.hpp:498
gnsstk::RinexDatum
Storage for single RINEX OBS data measurements.
Definition: RinexDatum.hpp:55
gnsstk::Rinex3ObsDataOperatorLessThanSimple::operator()
bool operator()(const Rinex3ObsData &l, const Rinex3ObsData &r) const
Definition: Rinex3ObsFilterOperators.hpp:180
gnsstk::Rinex3ObsHeaderTouchHeaderMerge::Rinex3ObsHeaderTouchHeaderMerge
Rinex3ObsHeaderTouchHeaderMerge()
Definition: Rinex3ObsFilterOperators.hpp:213
gnsstk::Rinex3ObsHeader
Definition: Rinex3ObsHeader.hpp:155
gnsstk::Rinex3ObsData::obs
DataMap obs
the map of observations
Definition: Rinex3ObsData.hpp:114
gnsstk::Rinex3ObsHeader::getObsIndex
virtual std::size_t getObsIndex(const std::string &type) const
Definition: Rinex3ObsHeader.cpp:2502
gnsstk::Rinex3ObsDataOperatorLessThanSimple
Definition: Rinex3ObsFilterOperators.hpp:176
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::Rinex3ObsDataOperatorEqualsSimple
Definition: Rinex3ObsFilterOperators.hpp:190
gnsstk::Rinex3ObsDataOperatorLessThanFull::Rinex3ObsDataOperatorLessThanFull
Rinex3ObsDataOperatorLessThanFull(Rinex3ObsHeader::RinexObsMap &unionMap)
Definition: Rinex3ObsFilterOperators.hpp:74
FileFilter.hpp
gnsstk::RinexDatum::data
double data
The actual data point.
Definition: RinexDatum.hpp:76
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Rinex3ObsData::epochFlag
short epochFlag
Definition: Rinex3ObsData.hpp:104
gnsstk::Rinex3ObsHeader::mapObsTypes
RinexObsMap mapObsTypes
SYS / # / OBS TYPES.
Definition: Rinex3ObsHeader.hpp:519
gnsstk::RinexDatum::lli
short lli
See the RINEX Spec. for an explanation.
Definition: RinexDatum.hpp:78
gnsstk::RinexDatum::ssi
short ssi
See the RINEX Spec. for an explanation.
Definition: RinexDatum.hpp:80
gnsstk::Rinex3ObsData::time
CommonTime time
Time corresponding to the observations.
Definition: Rinex3ObsData.hpp:91
gnsstk::Rinex3ObsData
Definition: Rinex3ObsData.hpp:75
Rinex3ObsHeader.hpp
gnsstk::Rinex3ObsHeaderTouchHeaderMerge::theHeader
Rinex3ObsHeader theHeader
Definition: Rinex3ObsFilterOperators.hpp:268
gnsstk::Rinex3ObsHeader::RinexObsVec
std::vector< RinexObsID > RinexObsVec
Vector of obervables.
Definition: Rinex3ObsHeader.hpp:338
gnsstk::Rinex3ObsHeaderTouchHeaderMerge::operator()
bool operator()(const Rinex3ObsHeader &l)
Definition: Rinex3ObsFilterOperators.hpp:219
Rinex3ObsData.hpp
gnsstk::Rinex3ObsDataOperatorLessThanFull::rom
Rinex3ObsHeader::RinexObsMap rom
Definition: Rinex3ObsFilterOperators.hpp:171
gnsstk::Rinex3ObsHeaderTouchHeaderMerge
Definition: Rinex3ObsFilterOperators.hpp:209
gnsstk::Rinex3ObsDataOperatorEqualsSimple::operator()
bool operator()(const Rinex3ObsData &l, const Rinex3ObsData &r) const
Definition: Rinex3ObsFilterOperators.hpp:194
gnsstk::Rinex3ObsData::clockOffset
double clockOffset
optional clock offset in seconds
Definition: Rinex3ObsData.hpp:112
gnsstk::Rinex3ObsDataOperatorLessThanFull
Definition: Rinex3ObsFilterOperators.hpp:67
ObsID.hpp
gnsstk::Rinex3ObsDataOperatorLessThanFull::operator()
bool operator()(const Rinex3ObsData &l, const Rinex3ObsHeader &lheader, const Rinex3ObsData &r, const Rinex3ObsHeader &rheader, double epsilon) const
Definition: Rinex3ObsFilterOperators.hpp:77
gnsstk::Rinex3ObsHeaderTouchHeaderMerge::firstHeader
bool firstHeader
Definition: Rinex3ObsFilterOperators.hpp:267
gnsstk::Rinex3ObsHeader::RinexObsMap
std::map< std::string, RinexObsVec > RinexObsMap
Definition: Rinex3ObsHeader.hpp:342


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