📄 discfix.cpp
字号:
// f never appears because we intercept it above //if(dashf.getCount()) { cout << "Option f "; dashf.dumpValue(cout); } // do help first if(dashh.getCount()) help=true; // now get the rest of the options if(dashVerb.getCount()) config.verbose=true; if(dashi.getCount()) { values = dashi.getValue(); if(help) cout << "Input RINEX obs files are:\n"; for(i=0; i<values.size(); i++) { config.InputObsName.push_back(values[i]); if(help) cout << " " << values[i] << endl; } } if(dashd.getCount()) { values = dashd.getValue(); config.Directory = values[0]; if(help) cout << "Input Directory is " << config.Directory << endl; } if(dashith.getCount()) { values = dashith.getValue(); config.ith = asDouble(values[0]); if(help) cout << "Decimate value is " << config.ith << endl; } // TD put try {} around setToString and catch invalid formats... if(dashbt.getCount()) { values = dashbt.getValue(); msg = values[0]; field.clear(); while(msg.size() > 0) field.push_back(stripFirstWord(msg,',')); if(field.size() == 2) config.begTime.setToString(field[0]+","+field[1], "%F,%g"); else if(field.size() == 6) config.begTime.setToString(field[0]+","+field[1]+","+field[2]+"," +field[3]+","+field[4]+","+field[5], "%Y,%m,%d,%H,%M,%S"); else { cout << "Error: invalid --beginTime input: " << values[0] << endl; } if(help) cout << " Input: begin time " << values[0] << " = " << config.begTime.printf("%Y/%02m/%02d %2H:%02M:%06.3f = %F/%10.3g") << endl; } if(dashet.getCount()) { values = dashet.getValue(); msg = values[0]; field.clear(); while(msg.size() > 0) field.push_back(stripFirstWord(msg,',')); if(field.size() == 2) config.endTime.setToString(field[0]+","+field[1], "%F,%g"); else if(field.size() == 6) config.endTime.setToString(field[0]+","+field[1]+","+field[2] +","+field[3]+","+field[4]+","+field[5], "%Y,%m,%d,%H,%M,%S"); else { cout << "Error: invalid --endTime input: " << values[0] << endl; } if(help) cout << " Input: end time " << values[0] << " = " << config.endTime.printf("%Y/%02m/%02d %2H:%02M:%06.3f = %F/%10.3g") << endl; } if(dashCA.getCount()) { config.UseCA = true; if(help) cout << "Input: Set the 'Use C/A code range' flag\n"; } if(dashDT.getCount()) { values = dashDT.getValue(); config.dt = asDouble(values[0]); if(help) cout << "dt is set to " << config.dt << " seconds." << endl; } if(dashGap.getCount()) { values = dashGap.getValue(); config.MaxGap = asDouble(values[0]); if(help) cout << "Max gap is " << config.MaxGap << " seconds which is " << int(config.MaxGap/config.dt) << " points." << endl; } //if(dashPts.getCount()) { //values = dashPts.getValue(); //config.MinPts = asInt(values[0]); //if(help) cout << "Minimum points is " << config.MinPts << endl; //} if(dashXsat.getCount()) { values = dashXsat.getValue(); for(i=0; i<values.size(); i++) { GSatID p(values[i]); if(help) cout << "Exclude satellite " << p << endl; config.ExSV.push_back(p); } } if(dashSV.getCount()) { values = dashSV.getValue(); GSatID p(values[0]); config.SVonly = p; if(help) cout << "Process only satellite : " << p << endl; } if(dashFormat.getCount()) { values = dashFormat.getValue(); config.format = values[0]; if(help) cout << "Output times with format: " << config.format << endl; } if(dashOut.getCount()) { values = dashOut.getValue(); config.OutFile = values[0]; if(help) cout << "Command output file is " << config.OutFile << endl; } if(dashRfile.getCount()) { values = dashRfile.getValue(); // pick the last one entered config.OutRinexObs = values[values.size()-1]; if(help) cout << "Output RINEX file name is " << config.OutRinexObs << endl; } if(dashRrun.getCount()) { values = dashRrun.getValue(); config.HDRunby = values[0]; if(help) cout << "Output RINEX 'RUN BY' is " << config.HDRunby << endl; } if(dashRobs.getCount()) { values = dashRobs.getValue(); config.HDObs = values[0]; if(help) cout << "Output RINEX 'OBSERVER' is " << config.HDObs << endl; } if(dashRag.getCount()) { values = dashRag.getValue(); config.HDAgency = values[0]; if(help) cout << "Output RINEX 'AGENCY' is " << config.HDAgency << endl; } if(dashRmark.getCount()) { values = dashRmark.getValue(); config.HDMarker = values[0]; if(help) cout << "Output RINEX 'MARKER' is " << config.HDMarker << endl; } if(dashRnumb.getCount()) { values = dashRnumb.getValue(); config.HDNumber = values[0]; if(help) cout << "Output RINEX 'NUMBER' is " << config.HDNumber << endl; } if(dashSmooth.getCount()) { config.smoothPH = config.smoothPR = true; if(help) cout << "'smooth both' option is on\n"; } if(dashSmoothPR.getCount()) { config.smoothPR = true; if(help) cout << "smooth the pseudorange\n"; } if(dashSmoothPH.getCount()) { config.smoothPH = true; if(help) cout << "debias the phase\n"; } //if(dashCAOut.getCount()) { // config.CAOut = true; // if(help) cout << "Output the C/A code to RINEX\n"; //} //if(dashDOut.getCount()) { // config.DopOut = true; // if(help) cout << "Output the doppler to RINEX\n"; //} if(Rest.getCount() && help) { cout << "Remaining options:" << endl; values = Rest.getValue(); for (i=0; i<values.size(); i++) cout << values[i] << endl; } //if(config.verbose && help) { // cout << "\nTokens on command line (" << Args.size() << ") are:" // << endl; // for(j=0; j<Args.size(); j++) cout << Args[j] << endl; //} //if(config.verbose) { // if GDCorrector::Debug is not set higher, set to 2 //GDCorrector.SetParameter(string("Debug=2")); //} // if help, print usage and quit if(help || DChelp) { if(help) Par.displayUsage(cout,false); if(DChelp) { GDConfig.DisplayParameterUsage(cout,DChelpall); cout << "For " << PrgmName << ", GDC commands are of the form --DC<GDCcmd>," << " e.g. --DCWLSigma=1.5\n" << endl; } return 1; } // get the log file name if(dashLog.getCount()) { values = dashLog.getValue(); // pick the last one entered config.LogFile = values[values.size()-1]; //if(help) cout << "Log file is " << config.LogFile << endl; } // open the log file config.oflog.open(config.LogFile.c_str(),ios::out); if(config.oflog.fail()) { cout << PrgmName << " failed to open log file " << config.LogFile << ". Abort.\n"; return -1; } else { cout << PrgmName << " is writing to log file " << config.LogFile << endl; // output first stuff to log file config.oflog << Title; // allow GDC to output to log file GDConfig.setDebugStream(config.oflog); } if(config.dt <= 0.0) { config.oflog << PrgmName << ": dt must be positive" << endl; return -1; } if(!config.smooth) config.smooth = (config.smoothPR || config.smoothPH); // set the commands now (setParameter may write to log file) for(i=0; i<DCcmds.size(); i++) GDConfig.setParameter(DCcmds[i]); // also, use the dt in SatPass to define the dt in GDC // NB this means --DCDT on the DiscFix command line is ignored! GDConfig.setParameter("DT",config.dt); // print config to log, first DF config.oflog << "\nHere is the " << PrgmName << " configuration:\n"; config.oflog << " Input RINEX obs files are:\n"; for(i=0; i<config.InputObsName.size(); i++) { config.oflog << " " << config.InputObsName[i] << endl; } config.oflog << " Input Directory is " << config.Directory << endl; config.oflog << " Ithing time interval is " << config.ith << endl; if(config.begTime > DayTime(DayTime::BEGINNING_OF_TIME)) config.oflog << " Begin time is " << config.begTime.printf("%04Y/%02m/%02d %02H:%02M:%.3f") << " = " << config.begTime.printf("%04F/%10.3g") << endl; if(config.endTime < DayTime(DayTime::END_OF_TIME)) config.oflog << " End time is " << config.endTime.printf("%04Y/%02m/%02d %02H:%02M:%.3f") << " = " << config.endTime.printf("%04F/%10.3g") << endl; if(config.UseCA) config.oflog << " 'Use the C/A pseudorange' flag is set\n"; else config.oflog << "Do not use C/A code range (C1) unless P1 is absent\n"; config.oflog << " dt is set to " << config.dt << " seconds." << endl; config.oflog << " Max gap is " << config.MaxGap << " seconds which is " << int(config.MaxGap/config.dt) << " points." << endl; //config.oflog << " Minimum points is " << config.MinPts << endl; if(config.ExSV.size()) { config.oflog << " Exclude satellites"; for(i=0; i<config.ExSV.size(); i++) { if(config.ExSV[i].id == -1) config.oflog << " (all " << config.ExSV[i].systemString() << ")" << endl; else config.oflog << " " << config.ExSV[i]; } config.oflog << endl; } if(config.SVonly.id > 0) config.oflog << " Process only satellite : " << config.SVonly << endl; config.oflog << " Log file is " << config.LogFile << endl; config.oflog << " Out file is " << config.OutFile << endl; config.oflog << " Output times in this format " << config.format << endl; if(!config.OutRinexObs.empty()) config.oflog << " Output RINEX file name is " << config.OutRinexObs << endl; if(!config.HDRunby.empty()) config.oflog << " Output RINEX 'RUN BY' is " << config.HDRunby << endl; if(!config.HDObs.empty()) config.oflog << " Output RINEX 'OBSERVER' is " << config.HDObs << endl; if(!config.HDAgency.empty()) config.oflog << " Output RINEX 'AGENCY' is " << config.HDAgency << endl; if(!config.HDMarker.empty()) config.oflog << " Output RINEX 'MARKER' is " << config.HDMarker << endl; if(!config.HDNumber.empty()) config.oflog << " Output RINEX 'NUMBER' is " << config.HDNumber << endl; if(config.smoothPR) config.oflog << " 'Smoothed range' option is on\n"; if(config.smoothPH) config.oflog << " 'Smoothed phase' option is on\n"; if(!config.smooth) config.oflog << " No smoothing.\n"; //if(config.CAOut) config.oflog << " 'C/A output' option is on\n"; //if(config.DopOut) config.oflog << " 'Doppler output' option is on\n"; // print config to log, second GDC config.oflog << "\nHere is the GPSTk DC configuration:\n"; GDConfig.DisplayParameterUsage(config.oflog,DChelpall); config.oflog << endl; return 0; } // end try catch(Exception& e) { GPSTK_RETHROW(e); } catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }}//------------------------------------------------------------------------------------void PreProcessArgs(const char *arg, vector<string>& Args) throw(Exception){ try { static bool found_cfg_file=false; if(string(arg) == string()) return; if(found_cfg_file || (arg[0]=='-' && arg[1]=='f')) { string filename(arg); if(!found_cfg_file) filename.erase(0,2); else found_cfg_file = false; ifstream infile(filename.c_str()); if(!infile) { cout << "Error: could not open options file " << filename << endl; return; } bool again_cfg_file=false; char c; string buffer,word; while(1) { getline(infile,buffer); stripTrailing(buffer,'\r'); while(!buffer.empty()) { word = firstWord(buffer); if(again_cfg_file) { word = "-f" + word; again_cfg_file = false; PreProcessArgs(word.c_str(),Args); } else if(word[0] == '#') { // skip this line buffer.clear(); } else if(word == "--file" || word == "-f") again_cfg_file = true; else if(word[0] == '"') { word = stripFirstWord(buffer,'"'); buffer = "dummy " + buffer; PreProcessArgs(word.c_str(),Args); } else PreProcessArgs(word.c_str(),Args); word = stripFirstWord(buffer); // this simply removes it from buffer } // break on EOF here b/c there can be a line w/o LF at EOF if(infile.eof() || !infile.good()) break; } } else if(string(arg) == "--file" || string(arg) == "-f") found_cfg_file = true; // -v or --verbose else if((arg[0]=='-' && arg[1]=='v') || string(arg)==string("--verbose")) { config.verbose = true; } // old versions of args -- deprecated else if(string(arg)==string("--directory")) { Args.push_back("--inputdir"); } else if(string(arg)==string("--EpochBeg")) { Args.push_back("--beginTime"); } else if(string(arg)==string("--EpochEnd")) { Args.push_back("--endTime"); } else if(string(arg)==string("--GPSBeg")) { Args.push_back("--beginTime"); } else if(string(arg)==string("--GPSEnd")) { Args.push_back("--endTime"); } else if(string(arg)==string("--CA")) { Args.push_back("--forceCA"); } else if(string(arg)==string("--useCA")) { Args.push_back("--forceCA"); } else if(string(arg)==string("--DT")) { Args.push_back("--dt"); } else if(string(arg)==string("--Gap")) { Args.push_back("--gap"); } else if(string(arg)==string("--Smooth")) { Args.push_back("--smooth"); } else if(string(arg)==string("--SmoothPR")) { Args.push_back("--smoothPR"); } else if(string(arg)==string("--SmoothPH")) { Args.push_back("--smoothPH"); } else if(string(arg)==string("--XPRN")) { Args.push_back("--exSat"); } else if(string(arg)==string("--SVonly")) { Args.push_back("--onlySat"); } else if(string(arg)==string("--Log")) { Args.push_back("--logOut"); } else if(string(arg)==string("--Out")) { Args.push_back("--cmdOut"); } // else its a regular command else Args.push_back(arg); //if(debug) cout << "arg " << string(arg) << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); } catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }}//------------------------------------------------------------------------------------//------------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -