Class gdc encapsulates configuration and processing for cycle slip detection and fixing using class SatPass.
#include <gdc.hpp>
Public Member Functions | |
double | cfg_func (std::string a) |
int | DiscontinuityCorrector (const RinexSatID &sat, const double &nominalDT, const Epoch &beginTime, std::vector< double > dataL1, std::vector< double > dataL2, std::vector< double > dataP1, std::vector< double > dataP2, std::vector< double > dt, std::vector< int > flags, std::string &retMsg, std::vector< std::string > &cmds, int GLOn=-99, std::string outfmt=std::string("%4F %10.3g")) |
int | DiscontinuityCorrector (SatPass &SP, std::string &retMsg, std::vector< std::string > &cmds, int GLOn=-99) |
void | DisplayParameterUsage (std::ostream &os, std::string tag=std::string(), bool advanced=false) |
void | ForceUniqueNumber (int n) |
gdc () | |
constructor; this sets a full default set of parameters. More... | |
double | getParameter (std::string label) |
int | getUniqueNumber () |
get the unique number; note that it is incremented at start of Disc..Corr() More... | |
bool | setParameter (std::string cmd) |
bool | setParameter (std::string label, double value) |
~gdc () | |
destructor More... | |
Protected Member Functions | |
bool | addArc (const int index, const unsigned mark) |
void | applyFixesToSatPass (SatPass &SP) |
unsigned | computeNgood (Arc &arc) |
recompute the number of good points in an Arc More... | |
void | DumpArcs (const std::string &tag, const std::string &label, int prec=-1) |
void | dumpData (std::ostream &os, const std::string msg=std::string()) |
dump the data stored in the data arrays More... | |
void | DumpHits (const std::vector< FilterHit< double >> &filterResults, const std::string &tag, const std::string &label, int prec=-1) |
int | filterFirstDiff (const unsigned which, const std::string label, double limit, std::vector< FilterHit< double >> &hits) |
int | filterWindow (const unsigned which, const std::string label, double limit, std::vector< FilterHit< double >> &hits) |
int | FinalCheck () |
void | findArc (const unsigned int ind, std::map< int, Arc >::iterator &ait) |
std::map< int, int > | findGaps (const Arc &arc) |
void | findLargeGaps () |
int | FineProcessing (const unsigned which) |
int | fixSlips (const unsigned which) |
void | fixUpArcs () |
modify Arcs: recompute npts and ngood, remove empty Arcs More... | |
void | flagBadData (const FilterHit< double > &hit, const unsigned flagvalue) |
void | generateCmds (std::vector< std::string > &cmds) |
void | getArcStats (const unsigned which) |
void | getArcStats (std::map< int, Arc >::iterator &ait, const unsigned which) |
int | GrossProcessing (const unsigned which) |
void | init () |
Initializer used in c'tor to define default configuration. More... | |
int | mergeFilterResultsIntoArcs (std::vector< FilterHit< double >> &hits, const unsigned which) |
int | ProcessOneCombo (const unsigned which) |
void | recomputeArcs () |
std::string | returnMessage (int prec=-1, int wid=-1) |
build the string that is returned by the discontinuity corrector More... | |
Epoch | xtime (const int &i) |
compute a time tag from array index: beginT + (xdata[i]==ndt)*dt More... | |
Protected Attributes | |
double | alpha |
alpha, from sat More... | |
std::map< int, Arc > | Arcs |
Epoch | beginT |
begin time from SatPass More... | |
double | beta |
beta, from sat More... | |
std::map< std::string, double > | CFG |
map containing configuration labels and their values More... | |
std::map< std::string, std::string > | CFGdesc |
map containing configuration labels and their descriptions More... | |
int | CFGindex |
map used to keep them in order More... | |
std::map< int, std::string > | CFGlist |
std::vector< double > | dataGF |
std::vector< double > | dataWL |
double | dt |
data time spacing, from SatPass, in sec More... | |
std::vector< int > | flags |
double | GFbias |
bias determined by initial value of GF, in wl More... | |
int | GLOchan |
GLONASS frequency channel (-99 by default in GDC()) More... | |
bool | isGLO |
true if this is a GLONASS satellite More... | |
long long | N1bias |
bias in L1 at initial point (from P1=wl1*(N1bias+L1)) More... | |
long long | N2bias |
bias in L2 at initial point (from P2=wl2*(N2bias+L2)) More... | |
int | osprec |
output stream precision More... | |
int | oswidth |
output stream width More... | |
std::string | outfmt |
output time format, from SatPass More... | |
RinexSatID | sat |
member data used internally More... | |
std::string | SPSstr |
SPS output of SatPass, or generated equivalent. More... | |
std::string | tag |
begin each output line with 'GDC <unique>' ( <label>) More... | |
int | unique |
unique number, counting passes or calls More... | |
double | wl1 |
L1 wavelength, from sat, in meters. More... | |
double | wl2 |
L2 wavelength, from sat, in meters. More... | |
double | WLbias |
bias determined by initial value of WL, in wl More... | |
double | wlGF |
GF wavelength = wl2-wl1 = 5.376cm, in meters. More... | |
double | wlNL |
NL wavelength ~10.7cm, in meters. More... | |
double | wlWL |
WL wavelength ~86cm, in meters. More... | |
std::vector< double > | xdata |
Static Protected Attributes | |
static const unsigned | BAD = 1 |
flag for bad data = 1 NB SatPass::BAD = 0 More... | |
static const std::vector< unsigned > | FIX = gdc::create_vector_FIX() |
slips, fixes More... | |
static const GNSSTK_EXPORT std::string | GDCVersion = string("9.0 5/20/17") |
Version string. More... | |
static const unsigned | GF = 1 |
used internally to denote the GF combo More... | |
static const unsigned | GFOUTLIER = 3 |
flag for data called outlier by GF filter More... | |
static const unsigned | GFSHORT = 5 |
flag for data with Arc.ngood < MinPts More... | |
static const unsigned | ISOLATED |
flag for isolated good data (< MinPts) More... | |
static const std::vector< std::string > | LAB = gdc::create_vector_LAB() |
vector of labels: WL, GF More... | |
static const unsigned | OK = 0 |
Values for flags[] = bit maps. More... | |
static const std::vector< unsigned > | SLIP = gdc::create_vector_SLIP() |
static const unsigned | WL = 0 |
conveniences More... | |
static std::vector< double > | wl |
vector of wavelengths More... | |
static const unsigned | WLOUTLIER = 2 |
flag for data called outlier by WL filter More... | |
static const unsigned | WLSHORT = 4 |
flag for data with Arc.ngood < MinPts More... | |
Static Private Member Functions | |
static std::vector< unsigned > | create_vector_FIX () |
helper routine to initialize vectors More... | |
static std::vector< std::string > | create_vector_LAB () |
helper routine to initialize vectors More... | |
static std::vector< unsigned > | create_vector_SLIP () |
helper routine to initialize vectors More... | |
|
inline |
|
protected |
|
inline |
|
inlineprotected |
|
inlinestaticprivate |
|
inlinestaticprivate |
|
inlinestaticprivate |
int gnsstk::gdc::DiscontinuityCorrector | ( | const RinexSatID & | sat, |
const double & | nominalDT, | ||
const Epoch & | beginTime, | ||
std::vector< double > | dataL1, | ||
std::vector< double > | dataL2, | ||
std::vector< double > | dataP1, | ||
std::vector< double > | dataP2, | ||
std::vector< double > | dt, | ||
std::vector< int > | flags, | ||
std::string & | retMsg, | ||
std::vector< std::string > & | cmds, | ||
int | GLOn = -99 , |
||
std::string | outfmt = std::string("%4F %10.3g") |
||
) |
Overloaded version that accepts input data in parallel arrays. NB phases are in cycles, ranges in meters. See the doc in the SatPass version. This is where the work is done; SatPass version creates arrays and calls this. Flags on input must be either 1(OK) or 0(BAD) (as in SatPass), however on output they are defined by static consts OK, BAD, etc
Exception |
int gnsstk::gdc::DiscontinuityCorrector | ( | SatPass & | SP, |
std::string & | retMsg, | ||
std::vector< std::string > & | cmds, | ||
int | GLOn = -99 |
||
) |
GNSSTK Discontinuity Corrector (GDC). Find, and fix if possible, discontinuities in the GPS or GLONASS carrier phase data, given dual-frequency pseudorange and phase data for a satellite pass.
There are two versions, one accepts the data in parallel vectors, the other uses class SatPass, converts the data to vectors and calls the first version.
Input is the SatPass object, or a set of vectors, that hold the data. Part of the input is a flags array, which is defined in SatPass (ok=1, bad=0); a similarly defined array is required in the array-input version.
Glonass satellites require a frequency channel integer; the caller may pass this in, or let the GDC compute it from the data - if it fails it returns -9.
This call assumes that the GDC has already been configured. See DisplayParameterUsage() for list of cfg.
The results of the process can be found in the flags array, with its values defined by static constants OK, SLIP, etc. NB on output OK=0, the OPPOSITE of input/SatPass where OK/BAD = 1/0.
Other output depends on the two configuration parameters doFix and doCmds. If doFix is on (non-zero) then the SatPass is modified for slips, outliers and bad data. Note that the GDC never splits a SatPass in two, even if rejecting data has created a large gap; this is a function only the caller can apply and so must be done after this call.
If doCmds is on, the call returns a vector of strings which are editing commands for EditRinex or tk-RinEdit; they are the "--IF name" form which is accepted by both (tk-RinEdit only takes this form).
Also, the L1 and L2 arrays in the input SatPass are corrected. The routine will flag bad points in the input data using the values defined in this class, including OK, BAD, WLOUTLIER, GFOUTLIER, Arc::WLSLIP, Arc::GFSLIP Glonass satellites require a frequency channel integer; the caller may pass this in, or let the GDC compute it from the data - if this fails it returns -9.
Output data filter output : use setParameter(WLF,1) RAW data as read from SatPass in m WL1 results of first difference filter of WL in wl WLW results of window filter of WL in wl WLF data with WL slips fixed and outliers removed in m GF1 results of first difference filter of GF in wl GFW results of window filter of GF in wl GFF data with GF slips fixed and outliers removed in m FIN data after final check
SP | SatPass object containing the input data. |
retMsg | string summary of results: see 'GDC' in output |
cmds | vector of strings giving editing commands for RINEX editor. |
GLOn | GLONASS frequency channel (-7<=n<7), -99 (default) : UNKNOWN. if -99, try to compute from SatPass. |
Exception | on the following: input data does not have the required obs types DT is not set, or a memory problem was encountered failed to find the Glonass frequency channel |
void gnsstk::gdc::DisplayParameterUsage | ( | std::ostream & | os, |
std::string | tag = std::string() , |
||
bool | advanced = false |
||
) |
Print help page, including descriptions and current values of all the parameters, to the ostream.
os | ostream to which to write |
tag | string to put at the beginning of each line of output |
advanced | if true, also print advanced parameters. |
Exception |
|
protected |
|
protected |
filter using first differences
[in] | which | is either WL or GF |
[in] | label | string to be passed to dump e.g. "GFG" |
[in] | limit | pass to filter.setLimit() |
[out] | hits | containing all outliers and slips |
Exception |
|
protected |
filter using window filter
[in] | which | is either WL or GF |
[in] | label | string to be passed to dump e.g. "GFG" |
[in] | limit | pass to filter.setLimit() |
[out] | hits | containing all outliers and slips |
Exception |
|
protected |
|
protected |
|
protected |
|
protected |
Fix slips between Arcs, using info.step (NOT info.Nslip), which is defined by the filter in results(FilterHit). Compute an integer from step and ADD it to Nslip. Thus Nslip always has the total slip, while step has only the latest estimate, and is used to fix. In the case of the FirstDifferenceFilter this step is only an approximate fix; for the WindowFilter the step is defined by stats on the two segments (one-sample for WL and two-sample for GF).
which | is either WL or GF |
Exception |
|
protected |
|
protected |
Flag bad data in the flags[] array, using a filter hit object. Don't alter Arcs NB FixUpArcs() must be called after this routine to recompute ngood. Note that flags[] is changed ONLY if flags[] currently OK....TD use bitmap?
hit | the FilterHit, which describes a segment to be marked |
flagvalue | the value to which flags[] is set for each outlier. |
Exception |
|
inline |
Allow caller to force unique number, before call to DiscontinuityCorrector(), which will immediately increment it.
n | integer force unique number in output to be this+1 |
|
protected |
apply the results to generate editing commands; cfg(doCmds) Use tk-RinEdit form for commands (–IF name, etc) since EditRinex also takes.
cmds | vector of strings giving editing commands for RINEX editor. |
Exception |
|
inlineprotected |
|
protected |
compute stats for 'which' data (WL or GF but not both) for the given Arc. NB this is sneaky and goes across fixed slips.... NB do not confuse this with WindowFilter::getStats()
ait | iterator pointing to element of Arcs that contains the Arc |
which | is either WL or GF |
Exception |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
merge filter results (vector<FilterHit>) into the Arcs list, and set flags[]. The merge will mark outliers, add new Arc's where there are slips, and call fixUpArcs(), if necessary. Test with cases where there is huge data rejection in GF, after WL slips, etc.
hits | vector<FilterHit> which is results of filter |
which | is either WL or GF |
Exception |
|
protected |
|
protected |
|
protected |
bool gnsstk::gdc::setParameter | ( | std::string | cmd | ) |
Set a parameter in the configuration; the input string 'cmd' is of the form '[–DC]<id><s><value>' where the separator s is one of (:=,) and leading '-','–', or '–DC' are optional.
cmd | string version of assigning a parameter, e.g. 'debug=0' |
Exception |
bool gnsstk::gdc::setParameter | ( | std::string | label, |
double | value | ||
) |
Set a parameter in the configuration using the label and the value, for booleans use (T,F)=(non-zero,zero).
label | parameter label - cf. DisplayParameterUsage() for list of labels |
value | parameter value to be assigned (0 for false) |
Exception |
|
protected |
The list (map) of arcs used to store beginnings (BEG=first Arc and after gap), slips, number of points, number of good points and stats. The map has key=index into data arrays at which the Arc begins, and value = Arc. Note that Arcs[A.index] = A, always. Since Arcs is a map with key=index, it is sorted on index i.e. in the same order as data[]. The first value in this map (Arcs.begin(), at index 0) is always marked BEG and has index=0 = first data index, and the last Arc in Arcs has index+npts = last data index + 1. New Arcs are created whenever there is a slip, or a gap larger than MaxGap. Arcs hang around, but slips get fixed, e.g. Arc.mark=WLSLIP&GFSLIP&WLFIX&GFFIX. When a slip is fixed, it is marked with xxFIX and the data modified from Arc.index all the way to the end.
|
staticprotected |
flag for bad data = 1 NB SatPass::BAD = 0
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
staticprotected |
Values for flags[] = bit maps.
flag for good data = 0 NB SatPass::OK = 1
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |