RinexObsFilterOperators.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_RINEXOBSFILTEROPERATORS_HPP
45 #define GNSSTK_RINEXOBSFILTEROPERATORS_HPP
46 
47 #include "FileFilter.hpp"
48 #include "RinexObsData.hpp"
49 #include "RinexObsHeader.hpp"
50 
51 #include <set>
52 #include <algorithm>
53 
54 namespace gnsstk
55 {
57 
58 
62  public std::binary_function<gnsstk::RinexObsData,
63  gnsstk::RinexObsData, bool>
64  {
65  public:
70  (const std::set<gnsstk::RinexObsType>& rohset)
71  : obsSet(rohset)
72  {}
73 
75  const gnsstk::RinexObsData& r) const
76  {
77  // compare the times, offsets, then only those elements
78  // that are common to both. this ignores the flags
79  // that are set to 0
80  if (l.time < r.time)
81  return true;
82  else if (l.time == r.time)
83  {
84  if (l.epochFlag < r.epochFlag)
85  return true;
86  else if (l.epochFlag == r.epochFlag)
87  {
88  if (l.clockOffset < r.clockOffset)
89  return true;
90  else if (l.clockOffset > r.clockOffset)
91  return false;
92  }
93  else
94  return false;
95  }
96  else
97  return false;
98 
99  // for the obs, first check that they're the same size
100  // i.e. - contain the same number of PRNs
101  if (l.obs.size() < r.obs.size())
102  return true;
103 
104  if (l.obs.size() > r.obs.size())
105  return false;
106 
107  // then check that each PRN has the same data for each of the
108  // shared fields
109  gnsstk::RinexObsData::RinexSatMap::const_iterator lItr =
110  l.obs.begin(), rItr;
111 
112  gnsstk::SatID sat;
113 
114  while (lItr != l.obs.end())
115  {
116  sat = (*lItr).first;
117  rItr = r.obs.find(sat);
118  if (rItr == r.obs.end())
119  return false;
120 
122  lObs = (*lItr).second,
123  rObs = (*rItr).second;
124 
125  std::set<gnsstk::RinexObsType>::const_iterator obsItr =
126  obsSet.begin();
127 
128  while (obsItr != obsSet.end())
129  {
130  gnsstk::RinexDatum lData, rData;
131  lData = lObs[*obsItr];
132  rData = rObs[*obsItr];
133 
134  if (lData.data < rData.data)
135  return true;
136 
137  if ( (lData.lli != 0) && (rData.lli != 0) )
138  if (lData.lli < rData.lli)
139  return true;
140 
141  if ( (lData.ssi != 0) && (rData.ssi != 0) )
142  if (lData.ssi < rData.ssi)
143  return true;
144 
145  obsItr++;
146  }
147 
148  lItr++;
149  }
150 
151  // the data is either == or > at this point
152  return false;
153  }
154 
155  private:
156  std::set<gnsstk::RinexObsType> obsSet;
157  };
158 
162  public std::binary_function<gnsstk::RinexObsData,
163  gnsstk::RinexObsData, bool>
164  {
165  public:
167  const gnsstk::RinexObsData& r) const
168  {
169  if (l.time < r.time)
170  return true;
171  return false;
172  }
173  };
174 
178  public std::binary_function<gnsstk::RinexObsData,
179  gnsstk::RinexObsData, bool>
180  {
181  public:
183  const gnsstk::RinexObsData& r) const
184  {
185  if (l.time == r.time)
186  return true;
187  return false;
188  }
189  };
190 
199  public std::unary_function<gnsstk::RinexObsHeader, bool>
200  {
201  public:
203  : firstHeader(true)
204  {}
205 
207  {
208  if (firstHeader)
209  {
210  theHeader = l;
211  firstHeader = false;
212  }
213  else
214  {
215  std::set<gnsstk::RinexObsType> thisObsSet,
216  tempObsSet;
217  std::set<std::string> commentSet;
218  obsSet.clear();
219 
220  // insert the comments to the set
221  // and let the set take care of uniqueness
222  copy(theHeader.commentList.begin(),
223  theHeader.commentList.end(),
224  inserter(commentSet, commentSet.begin()));
225  copy(l.commentList.begin(),
226  l.commentList.end(),
227  inserter(commentSet, commentSet.begin()));
228  // then copy the comments back into theHeader
229  theHeader.commentList.clear();
230  copy(commentSet.begin(), commentSet.end(),
231  inserter(theHeader.commentList,
232  theHeader.commentList.begin()));
233 
234  // find the set intersection of the obs types
235  copy(theHeader.obsTypeList.begin(),
236  theHeader.obsTypeList.end(),
237  inserter(thisObsSet, thisObsSet.begin()));
238  copy(l.obsTypeList.begin(),
239  l.obsTypeList.end(),
240  inserter(tempObsSet, tempObsSet.begin()));
241  set_intersection(thisObsSet.begin(), thisObsSet.end(),
242  tempObsSet.begin(), tempObsSet.end(),
243  inserter(obsSet, obsSet.begin()));
244  // then copy the obsTypes back into theHeader
245  theHeader.obsTypeList.clear();
246  copy(obsSet.begin(), obsSet.end(),
247  inserter(theHeader.obsTypeList,
248  theHeader.obsTypeList.begin()));
249  }
250  return true;
251  }
252 
255  std::set<gnsstk::RinexObsType> obsSet;
256  };
257 
259 
260 }
261 
262 
263 #endif
gnsstk::RinexObsDataOperatorLessThanSimple
Definition: RinexObsFilterOperators.hpp:161
gnsstk::RinexDatum
Storage for single RINEX OBS data measurements.
Definition: RinexDatum.hpp:55
gnsstk::RinexObsHeader::obsTypeList
std::vector< RinexObsType > obsTypeList
NUMBER & TYPES OF OBSERV.
Definition: RinexObsHeader.hpp:272
gnsstk::RinexObsData::obs
RinexSatMap obs
the map of observations
Definition: RinexObsData.hpp:95
gnsstk::SatID
Definition: SatID.hpp:89
FileFilter.hpp
gnsstk::RinexDatum::data
double data
The actual data point.
Definition: RinexDatum.hpp:76
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
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::RinexObsData::epochFlag
short epochFlag
Definition: RinexObsData.hpp:89
gnsstk::RinexObsDataOperatorLessThanFull::operator()
bool operator()(const gnsstk::RinexObsData &l, const gnsstk::RinexObsData &r) const
Definition: RinexObsFilterOperators.hpp:74
gnsstk::RinexObsHeaderTouchHeaderMerge::RinexObsHeaderTouchHeaderMerge
RinexObsHeaderTouchHeaderMerge()
Definition: RinexObsFilterOperators.hpp:202
gnsstk::RinexObsDataOperatorEqualsSimple
Definition: RinexObsFilterOperators.hpp:177
gnsstk::RinexObsDataOperatorEqualsSimple::operator()
bool operator()(const gnsstk::RinexObsData &l, const gnsstk::RinexObsData &r) const
Definition: RinexObsFilterOperators.hpp:182
gnsstk::RinexObsHeaderTouchHeaderMerge::firstHeader
bool firstHeader
Definition: RinexObsFilterOperators.hpp:253
gnsstk::RinexObsHeaderTouchHeaderMerge
Definition: RinexObsFilterOperators.hpp:198
gnsstk::RinexObsHeaderTouchHeaderMerge::obsSet
std::set< gnsstk::RinexObsType > obsSet
Definition: RinexObsFilterOperators.hpp:255
gnsstk::RinexObsData::clockOffset
double clockOffset
optional clock offset
Definition: RinexObsData.hpp:94
gnsstk::RinexObsDataOperatorLessThanFull::obsSet
std::set< gnsstk::RinexObsType > obsSet
Definition: RinexObsFilterOperators.hpp:156
gnsstk::RinexObsHeaderTouchHeaderMerge::theHeader
gnsstk::RinexObsHeader theHeader
Definition: RinexObsFilterOperators.hpp:254
RinexObsData.hpp
RinexObsHeader.hpp
gnsstk::RinexObsData::RinexObsTypeMap
std::map< RinexObsType, gnsstk::RinexDatum > RinexObsTypeMap
map from RinexObsType to RinexDatum.
Definition: RinexObsData.hpp:73
gnsstk::RinexObsDataOperatorLessThanFull::RinexObsDataOperatorLessThanFull
RinexObsDataOperatorLessThanFull(const std::set< gnsstk::RinexObsType > &rohset)
Definition: RinexObsFilterOperators.hpp:70
gnsstk::RinexObsHeader
Definition: RinexObsHeader.hpp:107
gnsstk::RinexObsHeaderTouchHeaderMerge::operator()
bool operator()(const gnsstk::RinexObsHeader &l)
Definition: RinexObsFilterOperators.hpp:206
gnsstk::RinexObsHeader::commentList
std::vector< std::string > commentList
Comments in header (optional)
Definition: RinexObsHeader.hpp:258
gnsstk::RinexObsDataOperatorLessThanFull
Definition: RinexObsFilterOperators.hpp:61
gnsstk::RinexObsData
Definition: RinexObsData.hpp:68
gnsstk::RinexObsData::time
gnsstk::CommonTime time
the time corresponding to the observations
Definition: RinexObsData.hpp:77
gnsstk::RinexObsDataOperatorLessThanSimple::operator()
bool operator()(const gnsstk::RinexObsData &l, const gnsstk::RinexObsData &r) const
Definition: RinexObsFilterOperators.hpp:166


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