📄 tecmaps.cpp
字号:
dashBeginLat.setMaxCount(1); CommandOption dashBeginLon(CommandOption::hasArgument, CommandOption::stdType, 0,"BeginLon", " --BeginLon <lon> Beginning longitude (230 deg E)"); dashBeginLon.setMaxCount(1); CommandOption dashDeltaLat(CommandOption::hasArgument, CommandOption::stdType, 0,"DeltaLat", " --DeltaLat <del> Grid spacing in latitude (0.25 deg)"); dashDeltaLat.setMaxCount(1); CommandOption dashDeltaLon(CommandOption::hasArgument, CommandOption::stdType, 0,"DeltaLon", " --DeltaLon <del> Grid spacing in longitude (1.0 deg)"); dashDeltaLon.setMaxCount(1); CommandOption dashXsat(CommandOption::hasArgument, CommandOption::stdType, '0', "XSat", "Other options:\n --XSat <sat> Exclude this satellite " "(<sat> may be <system> only)"); // ... other options CommandOptionNoArg dashv('v', "verbose", "Help:\n [-v|--verbose] print extended output info."); CommandOptionNoArg dashd('d', "debug", " [-d|--debug] print extended output info."); CommandOptionNoArg dashh('h', "help", " [-h|--help] print syntax and summary of input, then quit."); // ... rest of the command line CommandOptionRest Rest(""); CommandOptionParser Par( " Prgm TECMaps will open and read several preprocessed Rinex obs files\n" " (containing obs types EL,AZ,VR|SR) and use the data to ...\n" " Input is on the command line, or of the same format in a file (-f<file>).\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); if(Args.size()==0) Args.push_back(string("-h")); // pass the rest 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 parse\n"; //for(i=0; i<argc; i++) cout << i << " " << CArgs[i] << endl; //} Par.parseOptions(argc, CArgs); delete[] CArgs; // help first if(dashh.getCount() > 0) { help = true; } // get values found on command line vector<string> values; // log file next if(dashl.getCount()) { values = dashl.getValue(); if(help) cout << "Input name of output log file: " << values[0] << endl; LogFile = values[0]; } oflog.open(LogFile.c_str(),ios_base::out); if(!oflog) { cerr << "Failed to open log file " << LogFile << endl; return -1; } cout << "TECMaps output directed to log file " << LogFile << endl; oflog << Title; // print syntax if(help) { Par.displayUsage(oflog,false); oflog << endl; Par.displayUsage(cout,false); cout << endl; } // errors on command line if(Par.hasErrors()) { cerr << "\nErrors found in command line input:\n"; Par.dumpErrors(cerr); cerr << "...end of Errors\n\n"; oflog << "\nErrors found in command line input:\n"; Par.dumpErrors(oflog); oflog << "...end of Errors\n\n"; help = true; } // f never appears because we intercept it above //if(dashf.getCount()) { cout << "Option f "; dashf.dumpValue(cout); } // input path; do path before input file names if(dashp.getCount()) { values = dashp.getValue(); if(help) cout << "Input path name: " << values[0] << endl; InputPath = values[0]; } else InputPath = string(""); // input file names -- create vector of Station here if(dashin.getCount()) { values = dashin.getValue(); if(help) cout << "Input Rinex obs file names are:\n"; string::size_type pos; string fname; for(i=0; i<values.size(); i++) { fname = values[i]; // expand filenames of the form @name or name@ // into the *contents* (one name per line) of file 'name'. pos = fname.find('@'); if(pos == string::npos || (pos != 0 && pos != fname.length()-1)) { // value is a Rinex file name if(InputPath.size() > 0) { fname = InputPath + "/" + fname; } AddStation(fname); if(help) cout << " " << fname << endl; } else { // value is a file containing Rinex file names fname.erase(pos,1); if(InputPath.size() > 0) { fname = InputPath + "/" + fname; } if(help) cout << " " << "(Open and read file names from: " << fname << ")" << endl; ifstream infile(fname.c_str()); if(!infile) { oflog << "Error: could not open file " << fname << endl; } else { while(infile >> fname) { if(fname[0] == '#') { // skip to end of line char c; while(infile.get(c)) { if(c=='\n') break; } } else { AddStation(fname); if(debug) oflog << " " << fname << endl; } } // end loop over lines in the file infile.close(); } // end opened file } // end if value is a file containing file names } // end loop over values on command line } // end dashin // reference position if(dashllh.getCount()) { values = dashllh.getValue(); KnownPos = values[0]; KnownLLH = true; if(help) cout << "Get reference position from explicit input (LLH):\n " << KnownPos << endl; } if(dashxyz.getCount()) { values = dashxyz.getValue(); KnownPos = values[0]; KnownLLH = false; if(help) cout << "Get reference position from explicit input (XYZ):\n " << KnownPos << endl; } if(KnownPos != string("")) { ECEF e; string::size_type pos; values.clear(); while(KnownPos.size() > 0) { pos = KnownPos.find(","); if(pos==string::npos) pos=KnownPos.size(); if(pos==0) values.push_back(" "); else values.push_back(KnownPos.substr(0,pos)); if(pos >= KnownPos.size()) break; KnownPos.erase(0,pos+1); }; refSite.filename = string("reference"); if(values.size() > 3) refSite.filename=values[3]; if(KnownLLH) { refSite.llr.setGeodetic(asDouble(values[0]), asDouble(values[1]), asDouble(values[2])); //WGS84 is default refSite.xyz = refSite.llr; try { refSite.llr.transformTo(Position::Geocentric); refSite.xyz.transformTo(Position::Cartesian); } catch(Exception& e) { cerr << "ERROR: Reference site input (geodetic LLH) is invalid\n"; oflog << "ERROR: Reference site input (geodetic LLH) is invalid\n"; return -2; } } else { refSite.xyz.setECEF(asDouble(values[0]), asDouble(values[1]), asDouble(values[2])); refSite.llr = refSite.xyz; refSite.llr.transformTo(Position::Geocentric); } } // ephemeris input if(dashnd.getCount()) { values = dashnd.getValue(); NavDir = values[0]; if(help) cout << "Input Nav Directory: " << NavDir << endl; } if(dashn.getCount()) { values = dashn.getValue(); NavFiles = values; if(help) { cout << "Input Nav files :"; for(i=0; i<NavFiles.size(); i++) cout << " " << NavFiles[i]; cout << endl; } } if(dasheb.getCount()) { values = dasheb.getValue(); BegTime.setToString(values[0], "%Y,%m,%d,%H,%M,%S"); if(help) cout << "Input BeginTime " << BegTime << endl; } if(dashee.getCount()) { values = dashee.getValue(); EndTime.setToString(values[0], "%Y,%m,%d,%H,%M,%S"); if(help) cout << "Input EndTime " << EndTime << endl; } if(dashgb.getCount()) { values = dashgb.getValue(); BegTime.setToString(values[0], "%F,%g"); if(help) cout << "Input BeginGPSTime " << BegTime << endl; } if(dashge.getCount()) { values = dashge.getValue(); EndTime.setToString(values[0], "%F,%g"); if(help) cout << "Input EndGPSTime " << EndTime << endl; } // processing if(dashVmap.getCount()) { doVTECmap = false; if(help) cout << "Do NOT create VTEC map" << endl; } if(dashMUF.getCount()) { doMUFmap = true; if(help) cout << "Create MUF map" << endl; } if(dashF0F2.getCount()) { doF0F2map = true; if(help) cout << "Create F0F2 map" << endl; } if(dashTitle1.getCount()) { values = dashTitle1.getValue(); Title1 = values[0]; if(help) cout << "Primary Title is " << Title1 << endl; } if(dashTitle2.getCount()) { values = dashTitle2.getValue(); Title2 = values[0]; if(help) cout << "Secondary Title is " << Title2 << endl; } if(dashBaseName.getCount()) { values = dashBaseName.getValue(); BaseName = values[0]; if(help) cout << "Base name for output files is " << BaseName << endl; } if(dashDecor.getCount()) { values = dashDecor.getValue(); DecorrelError = asDouble(values[0]); if(help) cout << "Decorrelation error rate (TECU/1000km) is " << DecorrelError << endl; } if(dashNumLat.getCount()) { values = dashNumLat.getValue(); NumLat = asInt(values[0]); if(help) cout << "Number of latitude grid points is " << NumLat << endl; } if(dashNumLon.getCount()) { values = dashNumLon.getValue(); NumLon = asInt(values[0]); if(help) cout << "Number of longitude grid points is " << NumLon << endl; } if(dashBiases.getCount()) { values = dashBiases.getValue(); BiasFile = values[0]; if(help) cout << "Input sat+rx biases from file " << BiasFile << endl; } if(dashElevThresh.getCount()) { values = dashElevThresh.getValue(); ElevThresh = asDouble(values[0]); if(help) cout << "Minimum elevation (deg) is " << ElevThresh << endl; } if(dashMinAcqTime.getCount()) { values = dashMinAcqTime.getValue(); MinAcqTime = asDouble(values[0]); if(help) cout << "Minimum acquisition time (sec) is " << MinAcqTime << endl; } if(dashBeginLat.getCount()) { values = dashBeginLat.getValue(); BeginLat = asDouble(values[0]); if(help) cout << "Beginning latitude (deg) is " << BeginLat << endl; } if(dashBeginLon.getCount()) { values = dashBeginLon.getValue(); BeginLon = asDouble(values[0]); if(help) cout << "Beginning longitude (deg E) is " << BeginLon << endl; } if(dashDeltaLat.getCount()) { values = dashDeltaLat.getValue(); DeltaLat = asDouble(values[0]); if(help) cout << "Grid step in latitude (deg) is " << DeltaLat << endl; } if(dashDeltaLon.getCount()) { values = dashDeltaLon.getValue(); DeltaLon = asDouble(values[0]); if(help) cout << "Grid step in longitude (deg) is " << DeltaLon << endl; } if(dashUniSpace.getCount()) { typegrid = VTECMap::UniformSpace; if(help) cout << "Grid type is set to 'uniform spacing': " << typegrid << endl; } if(dashUniGrid.getCount()) { typegrid = VTECMap::UniformLatLon; if(help) cout << "Grid type is set to uniform: " << typegrid << endl; } if(dashOutGrid.getCount()) { GridOut = true; if(help) cout << "Output grid to file " << BaseName << ".LL" << endl; } if(dashGnuOut.getCount()) { GnuplotFormat = true; if(help) cout << "Output grid in gnuplot format" << endl; } if(dashFlatFit.getCount()) { typefit = VTECMap::Constant; if(help) cout << "Set fit type to FLAT" << endl; } if(dashLinearFit.getCount()) { typefit = VTECMap::Linear; if(help) cout << "Set fit type to LINEAR" << endl; } if(dashIonoHt.getCount()) { values = dashIonoHt.getValue(); IonoHt = asDouble(values[0]); if(help) cout << "Ionosphere height = " << IonoHt << " km" << endl; } if(dashXsat.getCount()) { values = dashXsat.getValue(); for(i=0; i<values.size(); i++) { sat.fromString(values[i]); if(help) cout << "Input: exclude satellite " << sat << endl; ExSV.push_back(sat); } } if(dashh.getCount()) oflog << "Option h appears " << dashh.getCount() << " times\n"; if(dashv.getCount()) { verbose = true; if(help) cout << "Option v appears " << dashv.getCount() << " times\n"; } if(dashd.getCount()) { debug = true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -