📄 rescor.cpp
字号:
0,"nav"," --nav <file> Navigation (Rinex Nav OR SP3) file(s)"); CommandOption dashnd(CommandOption::hasArgument, CommandOption::stdType, 0,"navdir"," --navdir <dir> Directory of navigation file(s)"); dashnd.setMaxCount(1); // reference position(s) CommandOption dashRx1(CommandOption::hasArgument,CommandOption::stdType,0,"RxLLH", "Reference position input: (there are six ways to input the reference " "position(s):\n --RxLLH <l,l,h> 1.Receiver position (static) in geodetic " "lat, lon(E), ht (deg,deg,m)"); dashRx1.setMaxCount(1); CommandOption dashRx2(CommandOption::hasArgument, CommandOption::stdType,0,"RxXYZ", " --RxXYZ <x,y,z> 2.Receiver position (static) in ECEF coordinates (m)"); dashRx2.setMaxCount(1); CommandOptionNoArg dashRx3(0,"Rxhere", " --Rxhere 3.Reference site positions(time) from this file" " (i.e. -IF<RinexFile>)"); dashRx3.setMaxCount(1); CommandOption dashRx4(CommandOption::hasArgument, CommandOption::stdType,0, "RxRinex"," --RxRinex <fn> 4.Reference site positions(time) from another " "Rinex file named <fn>"); dashRx4.setMaxCount(1); CommandOption dashRx5(CommandOption::hasArgument,CommandOption::stdType,0,"RxFlat", " --RxFlat <fn> 5.Reference site positions and times given in a flat file" " named <fn>"); dashRx5.setMaxCount(1); CommandOptionNoArg dashRxhelp(0,"Rxhelp"," --Rxhelp " "(Enter --Rxhelp for a description of the -RxFlat file format)"); dashRxhelp.setMaxCount(1); CommandOptionNoArg dashRx6(0,"RAIM", " --RAIM 6.Reference site positions computed via RAIM" " (requires P1,P2,EP)"); dashRx6.setMaxCount(1); CommandOptionNoArg dashred(0,"noRAIMedit", " (NB the following four options apply only if --RAIM is found)\n" " --noRAIMedit Do not edit data based on RAIM solution"); dashred.setMaxCount(1); CommandOptionNoArg dashrh(0,"RAIMhead", " --RAIMhead Output average RAIM solution to Rinex header " "(if -HDf also appears)"); dashrh.setMaxCount(1); CommandOptionNoArg dashro(0,"noRefout", " --noRefout Do not output reference solution to Rinex"); dashro.setMaxCount(1); CommandOption dashelev(CommandOption::hasArgument,CommandOption::stdType, 0,"MinElev", " --MinElev <el> Minimum satellite elevation (deg) for output"); dashelev.setMaxCount(1); // residual and correction computation, processing options CommandOption dashdb(CommandOption::hasArgument, CommandOption::stdType,0,"debias", "Residual/Correction computation:\n" " --debias <OT,l> Debias new output type <OT>; " "trigger a bias reset with limit <l>"); CommandOptionNoArg dashca(0,"Callow", " --Callow Allow C1 to replace P1 when P1 is not available"); dashca.setMaxCount(1); CommandOptionNoArg dashcf(0,"Cforce", " --Cforce Force C/A code pseudorange C1 to replace P1"); dashcf.setMaxCount(1); CommandOption dashih(CommandOption::hasArgument, CommandOption::stdType,0,"IonoHt", " --IonoHt <ht> Height of ionosphere in km (default 400) " "(needed for LA,LO,VR,VP)"); dashih.setMaxCount(1); CommandOption dashSV(CommandOption::hasArgument, CommandOption::stdType, 0,"SVonly", " --SVonly <sat> Process this satellite ONLY (use editing command -DS<Sat> to delete Sat)"); dashSV.setMaxCount(1); // output files CommandOption dashLog(CommandOption::hasArgument, CommandOption::stdType, 0,"Log","Output files:\n --Log <file> Output log file name (rc.log)"); dashLog.setMaxCount(1); //CommandOption dashErr(CommandOption::hasArgument, CommandOption::stdType, // 0,"Err"," --Err <file> Output error file name (rc.err)"); //dashErr.setMaxCount(1); // help CommandOptionNoArg dashVerb(0,"verbose", "Help:\n --verbose Print extended output to log file."); dashVerb.setMaxCount(1); CommandOptionNoArg dashDebug(0,"debug", " --debug Print debugging information to log file."); dashDebug.setMaxCount(1); CommandOptionNoArg dashh('h', "help"," --help [or -h] Print syntax and quit."); CommandOptionNoArg dashrech(0, "REChelp", " --REChelp Print syntax of RinexEditor commands and quit."); CommandOptionNoArg dashexth(0, "ROThelp", " --ROThelp Print list of extended Rinex observation types and quit."); // ... other options CommandOptionRest Rest(""); CommandOptionParser Par( "Prgm ResCor will open and read a single Rinex observation file, " "apply editing commands\n" " using the RinexEditor package, compute any of several residuals " "and corrections and\n" " register extended Rinex observation types for them, and then write " "the edited data,\n" " along with the new extended observation types, to an output Rinex " "observation file.\n" "\nRequired arguments:\n" " -IF and -OF (RinexEditor commands: cf. --REChelp) are required arguments.\n"); // ------------------------------------------------- // allow user to put all options in a file // could also scan for debug here vector<string> Args; for(j=1; j<argc; j++) PreProcessArgs(argv[j],Args); argc = Args.size(); if(argc==0) Args.push_back(string("--help")); //if(Debug) { //cout << "List after PreProcessArgs\n"; //for(i=0; i<argc; i++) cout << i << " " << Args[i] << endl; //} // add PRGM and RUNBY strings to the header REC.REVerbose = Verbose; REC.REDebug = Debug; Args.push_back(string("-HDp") + PrgmName + string(" v.") + PrgmVers.substr(0,4)); Args.push_back(string("-HDrARL:UT/SGL/GPSTK")); if(Debug) { cout << "List passed to REditCommandLine:\n"; for(i=0; i<argc; i++) cout << i << " " << Args[i] << endl; } // Add RE cmds; this will strip out the REditCmds from Args REC.AddCommandLine(Args); if(Debug) { cout << "List after REC.AddCommandLine(Args)\n"; argc = Args.size(); for(i=0; i<argc; i++) cout << i << " " << Args[i] << endl; } // get the list of commands and create OTstrings vector<string> cmds=REC.CommandList(); if(Debug) cout << "Here is the list of RE commands:\n"; for(i=0; i<cmds.size(); i++) { string cmd = cmds[i]; if(Debug) cout << " " << cmd << endl; vector<string> field; while(cmd.size() > 0) field.push_back(stripFirstWord(cmd,',')); if(field.size() < 5) continue; if(field[0] == "AO") OTstrings.push_back(field[4]); } if(Debug) cout << "End list of RE commands." << endl; // preprocess the commands // Return 0 ok, -1 no input file name, -2 no output file name iret = REC.ParseCommands(); //if(Debug) { //cout << "\nHere is the parsed list of RE cmds\n"; //it=REC.Cmds.begin(); //while(it != REC.Cmds.end()) { it->Dump(cout,string("")); ++it; } //cout << "End of sorted list of RE cmds" << endl << endl; // pass the rest to the regular command line processor //} // ------------------------------------------------------------------- argc = Args.size()+1; char **CArgs=new char*[argc]; if(!CArgs) { cerr << "Failed to allocate CArgs\n"; return -1; } CArgs[0] = argv[0]; for(j=1; j<argc; j++) { CArgs[j] = new char[Args[j-1].size()+1]; if(!CArgs[j]) { cerr << "Failed to allocate CArgs[j]\n"; return -1; } strcpy(CArgs[j],Args[j-1].c_str()); } //if(Debug) { //cout << "List passed to parser\n"; //for(i=0; i<argc; i++) cout << i << " " << CArgs[i] << endl; //} Par.parseOptions(argc, CArgs); delete[] CArgs; // ------------------------------------------------- // was help requested? if(dashh.getCount() > 0) help=true; if(dashRxhelp.getCount() > 0) Rxhelp=true; if(dashrech.getCount() > 0) REChelp=true; if(dashexth.getCount() > 0) ROThelp=true; // if errors on the command line, dump them and turn on help if(!(help || Rxhelp || REChelp || ROThelp) && (iret<0 || Par.hasErrors())) { cout << "Errors found in command line input:\n"; if(iret==-1 || iret==-3) cout << "Input file name required: use -IF<name>\n"; if(iret==-2 || iret==-3) cout << "Output file name required: use -OF<name>\n"; Par.dumpErrors(cout); cout << "...end of Errors\n\n"; help = true; } // display syntax page(s) if(help || Rxhelp || REChelp || ROThelp) { if(help) Par.displayUsage(cout,false); if(Rxhelp) cout << RxhelpString << endl; if(REChelp) { if(help || Rxhelp) cout << endl; cout << "ResCor is an implementation of the RinexEditor, therefore the" << " following commands are accepted.\n"; DisplayRinexEditUsage(cout); } if(ROThelp) { if(help || Rxhelp || REChelp) cout << endl; DisplayStandardRinexObsTypes(cout); cout << "End of list of standard observation types\n"; DisplayExtendedRinexObsTypes(cout); cout << "End of list of extended observation types\n"; } if(iret < 0) return iret; } // ------------------------------------------------- // get values found on command line vector<string> values; //dashf intercepted above by PreProcessArgs //dashh Handled above (first) //if(dashDebug.getCount()) Debug=true; done by PreProcessArgs //if(dashVerb.getCount()) Verbose=true; done by PreProcessArgs // now do the rest // ephemeris input if(dashnd.getCount()) { values = dashnd.getValue(); NavDir = values[0]; if(help) cout << "Nav Directory is " << NavDir << endl; } if(dashn.getCount()) { values = dashn.getValue(); NavFiles = values; if(help) { cout << "Nav files are:"; for(i=0; i<NavFiles.size(); i++) cout << " " << NavFiles[i]; cout << endl; } } // reference position if(dashRx1.getCount()) { values = dashRx1.getValue(); KnownPos = values[0]; KnownLLH = true; KnownPosInput = true; if(help) cout << "Get reference position from explicit input (LLH) " << KnownPos << endl; } if(dashRx2.getCount()) { values = dashRx2.getValue(); KnownPos = values[0]; KnownLLH = false; KnownPosInput = true; if(help) cout << "Get reference position from explicit input (XYZ) " << KnownPos << endl; } if(dashRx3.getCount()) { // get ref from this input file RefPosInput = true; if(help) cout << "Get reference position from this input file" << endl; } if(dashRx4.getCount()) { values = dashRx4.getValue(); RefPosFile = values[0]; RefPosFlat = false; if(help) cout << "Get reference position from Rinex file " << RefPosFile<<endl; } if(dashRx5.getCount()) { values = dashRx5.getValue(); RefPosFile = values[0]; RefPosFlat = true; if(help) cout << "Get reference position from flat file " << RefPosFile << endl; } if(dashRx6.getCount()) { doRAIM = true; if(help) cout << "Compute a RAIM solution" << endl; } // RAIM options if(dashred.getCount()) { if(doRAIM) { editRAIM = false; if(help) cout << "Do not edit data based on RAIM solution" << endl; } else if(help) cout << "Ignore --noRAIMedit: --RAIM was not set" << endl; } if(dashro.getCount()) { outRef = false; if(help) cout << "Do not output Reference solution to Rinex" << endl; } if(dashelev.getCount()) { values = dashelev.getValue(); minElev = asDouble(values[0]); if(help) cout << "Set minimum elevation angle " << fixed << setprecision(2) << minElev << endl; } if(dashrh.getCount()) { if(doRAIM) { headRAIM = true; if(help) cout << "Output average RAIM solution to header" << endl; } else if(help) cout << "Ignore --RAIMhead: --RAIM was not set" << endl; } if(dashdb.getCount()) { values = dashdb.getValue(); vector<string> subfield; string::size_type pos; for(i=0; i<values.size(); i++ ) { string argbias=values[i]; subfield.clear(); while(argbias.size() > 0) { pos = argbias.find(","); if(pos==string::npos) pos=argbias.size();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -