RinEdit.cpp
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 
228 
232 // system
233 #include "NewNavInc.h"
234 #include <string>
235 #include <vector>
236 #include <map>
237 #include <iostream>
238 #include <fstream>
239 #include <algorithm>
240 
241 // GNSSTK
242 #include <gnsstk/Exception.hpp>
243 #include <gnsstk/StringUtils.hpp>
244 #include <gnsstk/GNSSconstants.hpp>
245 
246 #include <gnsstk/singleton.hpp>
247 #include <gnsstk/expandtilde.hpp>
248 #include <gnsstk/logstream.hpp>
249 #include <gnsstk/CommandLine.hpp>
250 
251 #include <gnsstk/CommonTime.hpp>
252 #include <gnsstk/Epoch.hpp>
253 #include <gnsstk/TimeString.hpp>
254 
255 #include <gnsstk/RinexSatID.hpp>
256 #include <gnsstk/RinexObsID.hpp>
257 #include <gnsstk/Rinex3ObsStream.hpp>
258 #include <gnsstk/Rinex3ObsHeader.hpp>
259 #include <gnsstk/Rinex3ObsData.hpp>
260 
261 //------------------------------------------------------------------------------
262 using namespace std;
263 using namespace gnsstk;
264 using namespace StringUtils;
265 
266 //------------------------------------------------------------------------------
267 string version(string("2.4 9/23/15 rev"));
268 // TD
269 // if reading a R2 file, allow obs types in cmds to be R2 versions (C1,etc)
270 // option to replace input with output?
271 // include optional fmt input for t in edit cmds - is this feasible?
272 // if given a 4-char OT and SV, check their consistency
273 // OK - test it. implement DO - how? copy and edit, or clear and copy?
274 // OK - test it. edit header when DS (alone) or DO appear ... how?
275 // how to handle aux header data if its first - OF not yet opened
276 // END TD
277 
278 //------------------------------------------------------------------------------
279 //------------------------------------------------------------------------------
280 // class to encapsulate editing commands
281 class EditCmd
282 {
283 public:
284  enum CmdType
285  {
286  invalidCT=0,
299  countCT
300  };
301  CmdType type; // the type of this command
302  RinexSatID sat; // satellite
303  RinexObsID obs; // observation type
304  CommonTime ttag; // associated time tag
305  int sign; // sign +1,0,-1 meaning start, one-time, stop
306  int idata; // integer e.g. SSI or LLI
307  double data; // data e.g. bias value
308  string field; // OF file name
309 
310  EditCmd(void) : type(invalidCT) {} // default constructor
311  ~EditCmd(void) {} // destructor
312 
316  EditCmd(const string typestr, const string arg);
318  bool parseTime(const string arg, CommonTime& ttag) throw();
319 
321  inline bool isValid(void) throw()
322  { return (type != invalidCT); }
323 
326  string asString(string msg=string());
327 
328 }; // end class EditCmd
329 
330 
331 // used for sorting
333 {
334 public:
335  bool operator()(const EditCmd& ec1, const EditCmd& ec2)
336  { return (ec1.ttag < ec2.ttag); }
337 };
338 
339 //------------------------------------------------------------------------------
340 //------------------------------------------------------------------------------
341 // Object for command line input and global data
342 class Configuration : public Singleton<Configuration>
343 {
344 public:
345 
346  // Default and only constructor
347  Configuration() throw() { setDefaults(); }
348 
349  // Create, parse and process command line options and user input
350  int processUserInput(int argc, char **argv) throw();
351 
352  // Design the command line
353  string buildCommandLine(void) throw();
354 
355  // Open the output file, and parse the strings used on the command line
356  // return -4 if log file could not be opened
357  int extraProcessing(string& errors, string& extras) throw();
358 
359  // Parse one of the vector<string> of edit cmd options
360  void parseEditCmds(vector<string>& v, const string l, ostringstream& os) throw();
361 
362 private:
363 
364  // Define default values
365  void setDefaults(void) throw()
366  {
367  defaultstartStr = string("[Beginning of dataset]");
368  defaultstopStr = string("[End of dataset]");
369  beginTime = CivilTime(1980,1,6,0,0,0.0,TimeSystem::GPS).convertToCommonTime();
370  endTime = CommonTime::END_OF_TIME;
371  decimate = 0.0;
372 
373  help = verbose = outver2 = false;
374  debug = -1;
375 
376  messHDdc = messHDda = false;
377  } // end Configuration::SetDefaults()
378 
379 public:
380 
381 // member data
382  CommandLine opts; // command line options and syntax page
383  static const string prgmName; // program name
384  string Title; // id line printed to screen and log
385 
386  // start command line input
387  bool help, verbose, outver2;
388  int debug;
389  string cfgfile;
390 
391  vector<string> messIF, messOF; // RINEX obs file names - IF and OF args
392  string InObspath,OutObspath; // obs file path
393 
394  // times derived from --start and --stop
395  string defaultstartStr,startStr;
396  string defaultstopStr,stopStr;
397  CommonTime beginTime,endTime,decTime;
398 
399  double decimate,timetol; // decimate input data
400  string logfile; // output log file
401 
402  // added "mess" to each of these variables because they were
403  // conflicting with precompiler macro definitions and enum names
404  // and I couldn't be bothered to do a more intelligent renaming.
405 
406  // editing commands
407  bool messHDdc,messHDda,messBZ;
408  string messHDp,messHDr,messHDo,messHDa,messHDx,messHDm,messHDn,messHDt,messHDh,messHDj,messHDk,messHDl,messHDs;
409  vector<string> messHDc,messDA,messDAm,messDAp,messDO,messDS,messDSp,messDSm,messDD,messDDp,messDDm;
410  vector<string> messSD,messSS,messSL,messSLp,messSLm,messBD,messBDp,messBDm,messBS,messBL;
411 
412  // end of command line input
413 
414  string msg;
415  ofstream logstrm;
416  static const string calfmt,gpsfmt,longfmt;
417 
418  // handle commands
419  vector<EditCmd> vecCmds, currCmds;
420  Rinex3ObsStream ostrm; // RINEX output
421 
422 }; // end class Configuration
423 
424 //------------------------------------------------------------------------------
425 // const members of Configuration
426 const string Configuration::prgmName = string("RinEdit");
427 const string Configuration::calfmt = string("%04Y/%02m/%02d %02H:%02M:%02S");
428 const string Configuration::gpsfmt = string("%4F %10.3g");
429 const string Configuration::longfmt = calfmt + " = " + gpsfmt + " %P";
430 
431 //------------------------------------------------------------------------------
432 // prototypes
435 int initialize(string& errors);
436 void fixEditCmdList(void) throw();
439 int processFiles(void);
443  Rinex3ObsData& Rdata, Rinex3ObsData& RDout);
446 int executeEditCmd(const vector<EditCmd>::iterator& it, Rinex3ObsHeader& Rhead,
447  Rinex3ObsData& Rdata);
448 
449 //------------------------------------------------------------------------------
450 //------------------------------------------------------------------------------
451 int main(int argc, char **argv)
452 {
453 #include "NewNavInit.h"
454  // get the (single) instance of the configuration
456 
457  try {
458  int iret;
459  clock_t totaltime(clock());
460  Epoch wallclkbeg;
461  wallclkbeg.setLocalTime();
462 
463  // build title = first line of output
464  C.Title = "# " + C.prgmName + ", part of the GNSS Toolkit, Ver " + version
465  + ", Run " + printTime(wallclkbeg,C.calfmt);
466 
467  for(;;) {
468  // get information from the command line
469  // iret -2 -3 -4
470  if((iret = C.processUserInput(argc, argv)) != 0) break;
471 
472  // read stores, check input etc
473  string errs;
474  if((iret = initialize(errs)) != 0) {
475  LOG(ERROR) << "------- Input is not valid: ----------\n" << errs
476  << "\n------- end errors -----------";
477  break;
478  }
479  if(!errs.empty()) LOG(INFO) << errs; // Warnings are here too
480 
481  processFiles();
482  // iret = 0 = success
483  iret = 0;
484 
485  break; // mandatory
486  }
487 
488  if(iret == 0) {
489  // print elapsed time
490  totaltime = clock()-totaltime;
491  Epoch wallclkend;
492  wallclkend.setLocalTime();
493  ostringstream oss;
494  oss << C.prgmName << " timing: processing " << fixed << setprecision(3)
495  << double(totaltime)/double(CLOCKS_PER_SEC) << " sec, wallclock: "
496  << setprecision(0) << (wallclkend-wallclkbeg) << " sec.";
497  LOG(INFO) << oss.str();
498  }
499 
500  if (C.help)
501  return 0; // return 0 when help is requested as this is not an error.
502  return iret;
503  }
504  catch(FFStreamError& e) { cerr << "FFStreamError: " << e.what(); }
505  catch(Exception& e) { cerr << "Exception: " << e.what(); }
506  catch (...) { cerr << "Unknown exception. Abort." << endl; }
507  return 1;
508 
509 } // end main()
510 
511 //------------------------------------------------------------------------------
512 // return -5 if input is not valid
513 int initialize(string& errors)
514 {
515  try
516  {
517  bool isValid(true);
518  int j;
519  size_t i;
521  errors = string("");
522  ostringstream ossE;
523 
524  // must have an input file and an output file
525  if(C.messIF.size() == 0) {
526  ossE << "Error : No valid input files have been specified.";
527  isValid = false;
528  }
529  if(C.messOF.size() == 0) {
530  ossE << "Error : No valid output files have been specified.";
531  isValid = false;
532  }
533 
534  // add path to filenames, and expand tilde (~)
536 
537  // add path to all OF
538  // also if first OF command has a timetag, remove it and make that the start time
539  for(j=0, i=0; i<C.vecCmds.size(); ++i) {
540  if(C.vecCmds[i].type == EditCmd::ofCT) {
541  if(j == 0 && C.vecCmds[i].ttag != CommonTime::BEGINNING_OF_TIME) {
542  if(C.beginTime < C.vecCmds[i].ttag)
543  C.beginTime = C.vecCmds[i].ttag;
545  }
546  j++;
547  include_path(C.OutObspath, C.vecCmds[i].field);
548  //LOG(VERBOSE) << "Full output file name is " << C.vecCmds[i].field;
549  }
550  }
551 
552  // ------ compute and save a reference time for decimation
553  if(C.decimate > 0.0) {
554  // TD what if beginTime == BEGINNING_OF_TIME ?
555  C.decTime = C.beginTime;
556  double s,sow(static_cast<GPSWeekSecond>(C.decTime).sow);
557  s = int(C.decimate * int(sow/C.decimate));
558  if(::fabs(s-sow) > 1.0) LOG(WARNING) << "Warning : decimation reference time "
559  << "(--start) is not an even GPS-seconds-of-week mark.";
560  C.decTime = static_cast<CommonTime>(
561  GPSWeekSecond(static_cast<GPSWeekSecond>(C.decTime).week,0.0));
562  LOG(DEBUG) << "Decimate, with final decimate ref time "
563  << printTime(C.decTime,C.longfmt) << " and step " << C.decimate;
564  }
565 
566  // -------- save errors and output
567  errors = ossE.str();
568  stripTrailing(errors,'\n');
569  replaceAll(errors,"\n","\n# ");
570 
571  if(!isValid) return -5;
572  return 0;
573  }
574  catch(Exception& e) { GNSSTK_RETHROW(e); }
575 } // end initialize()
576 
577 
578 //------------------------------------------------------------------------------
579 // Return 0 ok, >0 number of files successfully read, <0 fatal error
580 int processFiles(void)
581 {
582  try
583  {
585  C.beginTime.setTimeSystem(TimeSystem::GPS);
586  C.endTime.setTimeSystem(TimeSystem::GPS);
587  int iret,nfiles;
588  size_t i,nfile;
589  string tag;
590  RinexSatID sat;
591  ostringstream oss;
592 
593  if (C.debug > -1)
595 
596  for(nfiles=0,nfile=0; nfile<C.messIF.size(); nfile++)
597  {
598  Rinex3ObsStream istrm;
599  Rinex3ObsHeader Rhead,RHout; // use one header for input and output
600  Rinex3ObsData Rdata,RDout;
601  string filename(C.messIF[nfile]);
602 
603  // iret is set to 0 ok, or could not: 1 open file, 2 read header, 3 read data
604  iret = 0;
605 
606  // open the file ------------------------------------------------
607  istrm.open(filename.c_str(),ios::in);
608  if(!istrm.is_open())
609  {
610  LOG(WARNING) << "Warning : could not open file " << filename;
611  iret = 1;
612  continue;
613  }
614  else
615  LOG(DEBUG) << "Opened input file " << filename;
616  istrm.exceptions(ios::failbit);
617 
618  // read the header ----------------------------------------------
619  LOG(INFO) << "Reading header...";
620  try
621  {
622  istrm >> Rhead;
623  }
624  catch(Exception& e)
625  {
626  LOG(WARNING) << "Warning : Failed to read header: " << e.what()
627  << "\n Header dump follows.";
628  Rhead.dump(LOGstrm);
629  istrm.close();
630  iret = 2;
631  continue;
632  }
633  if(C.debug > -1)
634  {
635  LOG(DEBUG) << "Input header for RINEX file " << filename;
636  Rhead.dump(LOGstrm);
637  }
638  // dump the obs types
639  map<string,vector<RinexObsID> >::const_iterator kt;
640  for (kt = Rhead.mapObsTypes.begin(); kt != Rhead.mapObsTypes.end(); kt++)
641  {
642  sat.fromString(kt->first);
643  oss.str("");
644  oss << "# Header ObsIDs " << sat.systemString3()
645  << " (" << kt->second.size() << "):";
646  for(i=0; i<kt->second.size(); i++)
647  oss << " " << kt->second[i].asString();
648  LOG(INFO) << oss.str();
649  }
650  // we have to set the time system of all the timetags using ttag from file
651  vector<EditCmd>::iterator jt;
652  for (jt=C.vecCmds.begin(); jt != C.vecCmds.end(); ++jt)
653  jt->ttag.setTimeSystem(Rhead.firstObs.getTimeSystem());
654  // -----------------------------------------------------------------
655  // generate output header from input header and DO,DS commands
656  bool mungeData(false);
657  map<string, map<int,int> > mapSysObsIDTranslate;
658 
659  RHout = Rhead;
660  vector<EditCmd>::iterator it;
661  for (it = C.vecCmds.begin(); it != C.vecCmds.end(); it++)
662  {
663  LOG(DEBUG) << "Killing " << it->asString() << " " << it->sat;
664 
665  // DO delete obs without sign
666  if (it->type == EditCmd::doCT)
667  {
668  // if the system is defined, delete only for that system
669  string sys(asString(it->sat.systemChar()));
670 
671  // loop over systems (short-circuit if sys is defined)
672  Rinex3ObsHeader::RinexObsMap::iterator jt;
673  for (jt=RHout.mapObsTypes.begin(); jt != RHout.mapObsTypes.end(); ++jt)
674  {
675  if (sys != string("?") && sys != jt->first)
676  continue;
677  RinexObsID obsid(jt->first + it->obs.asString(),
678  Rhead.version);
679 
680  // find the OT in the output header map, and delete it
681  Rinex3ObsHeader::RinexObsVec::iterator kt;
682  kt = find(jt->second.begin(), jt->second.end(), obsid);
683  if(kt == jt->second.end())
684  continue;
685  jt->second.erase(kt);
686  // flag the obs types have changed so the translations need to as well
687  mungeData = true;
688  }
689  }
690 
691  // DS delete sat without sign and without time
692  else if (it->type == EditCmd::dsCT && it->sign >= 0
693  && it->ttag == CommonTime::BEGINNING_OF_TIME)
694  {
695  if (it->sat.id == -1)
696  {
697  // Delete all satellites with this system
698  Rinex3ObsHeader::PRNNumObsMap::iterator i,j;
699  for (i = RHout.numObsForSat.begin(); i != RHout.numObsForSat.end();)
700  {
701  j = i++;
702  if (j->first.system == it->sat.system)
703  RHout.numObsForSat.erase(j);
704  }
705  if (it->sat.system == SatelliteSystem::Glonass)
706  RHout.glonassFreqNo.clear();
707 
708  // Remove obs types for that system
709  string sys(asString(it->sat.systemChar()));
710  RHout.mapObsTypes.erase(sys);
711  }
712  else
713  {
714  // Just delete a single satellite if its there
715  Rinex3ObsHeader::PRNNumObsMap::iterator jt = RHout.numObsForSat.find(it->sat);
716  if (jt != RHout.numObsForSat.end())
717  RHout.numObsForSat.erase(jt);
718 
719  Rinex3ObsHeader::GLOFreqNumMap::iterator kt = RHout.glonassFreqNo.find(it->sat);
720  if (kt != RHout.glonassFreqNo.end())
721  RHout.glonassFreqNo.erase(kt);
722  }
723  }
724  } // end loop over edit commands
725 
726  // if mapObsTypes has changed, must make a map of indexes for translation
727  // mapSysObsIDTranslate[sys][input index] = output index
728  if (mungeData)
729  {
730  map<string, vector<RinexObsID> >::iterator jt;
731  for(jt = Rhead.mapObsTypes.begin(); jt != Rhead.mapObsTypes.end(); ++jt)
732  {
733  string sys(jt->first);
734  // TD what if entire sys is deleted? RHout[sys] does not exist
735  vector<RinexObsID>::iterator kt;
736  for(i=0; i < jt->second.size(); i++)
737  {
738  kt = find(RHout.mapObsTypes[sys].begin(),
739  RHout.mapObsTypes[sys].end(), jt->second[i]);
740  mapSysObsIDTranslate[sys][i]
741  = (kt == RHout.mapObsTypes[sys].end()
742  ? -1 // not found
743  : (kt - RHout.mapObsTypes[sys].begin())); // output index
744  }
745  }
746 
747  // dump it
748  if(C.debug > -1)
749  {
750  for(jt = Rhead.mapObsTypes.begin(); jt != Rhead.mapObsTypes.end(); ++jt)
751  {
752  string sys(jt->first);
753  oss.str("");
754  oss << "Translation map for sys " << sys;
755  for(i=0; i < jt->second.size(); i++)
756  oss << " " << i << ":" << mapSysObsIDTranslate[sys][i];
757  LOG(DEBUG) << oss.str();
758  }
759  }
760  }
761 
762 
763  if (C.outver2)
764  {
765  if (C.debug > -1)
766  {
767  LOG(DEBUG) << "Header pre prepareVer2Write";
768  RHout.dump(LOGstrm);
769  }
770  RHout.prepareVer2Write();
771  }
772 
773  // NB. header will be written by executeEditCmd
774  // -----------------------------------------------------------------
775 
776  if (C.debug > -1)
777  {
778  LOG(DEBUG) << "Output header";
779  RHout.dump(LOGstrm);
780  }
781 
782  // loop over epochs ---------------------------------------------
783  LOG(INFO) << "Reading observations...";
784  while(1)
785  {
786  try { istrm >> Rdata; }
787  catch(Exception& e)
788  {
789  LOG(WARNING) << " Warning : Failed to read obs data (Exception "
790  << e.getText(0) << "); dump follows.";
791  Rdata.dump(LOGstrm,Rhead);
792  istrm.close();
793  iret = 3;
794  break;
795  }
796  catch(std::exception& e) {
797  Exception ge(string("Std excep: ") + e.what());
798  GNSSTK_THROW(ge);
799  }
800  catch(...) {
801  Exception ue("Unknown exception while reading RINEX data.");
802  GNSSTK_THROW(ue);
803  }
804 
805  // normal EOF
806  if(!istrm.good() || istrm.eof()) { iret = 0; break; }
807 
808  LOG(DEBUG) << "";
809  LOG(DEBUG) << " Read RINEX data: flag " << Rdata.epochFlag
810  << ", timetag " << printTime(Rdata.time,C.longfmt);
811 
812  // stay within time limits
813  if(Rdata.time < C.beginTime) {
814  LOG(DEBUG) << " RINEX data timetag " << printTime(C.beginTime,C.longfmt)
815  << " is before begin time.";
816  continue;
817  }
818  if(Rdata.time > C.endTime) {
819  LOG(DEBUG) << " RINEX data timetag " << printTime(C.endTime,C.longfmt)
820  << " is after end time.";
821  break;
822  }
823 
824  // decimate
825  if (C.decimate > 0.0)
826  {
827  double dt(::fabs(Rdata.time - C.decTime));
828  dt -= C.decimate * long(0.5 + dt/C.decimate);
829  LOG(DEBUG) << "Decimate? dt = " << fixed << setprecision(2) << dt;
830  if (::fabs(dt) > 0.25)
831  {
832  LOG(DEBUG) << " Decimation rejects RINEX data timetag "
833  << printTime(Rdata.time,C.longfmt);
834  continue;
835  }
836  }
837 
838  // copy data to output
839  RDout = Rdata;
840  if (mungeData)
841  {
842  // must edit RDout.obs
843  RDout.obs.clear();
844  // loop over satellites -----------------------------
845  Rinex3ObsData::DataMap::const_iterator kt;
846  for (kt=Rdata.obs.begin(); kt!=Rdata.obs.end(); ++kt)
847  {
848  sat = kt->first;
849  string sys(string(1,sat.systemChar()));
850  for (i=0; i<Rdata.obs[sat].size(); i++)
851  if (mapSysObsIDTranslate[sys][i] > -1)
852  RDout.obs[sat].push_back(Rdata.obs[sat][i]);
853  } // end loop over sats
854  }
855 
856  // apply editing commands, including open files, write out headers
857  iret = processOneEpoch(Rhead, RHout, Rdata, RDout);
858  if(iret < 0) break;
859  if(iret > 0) continue;
860 
861  // write data out
862  try { C.ostrm << RDout; }
863  catch(Exception& e) { GNSSTK_RETHROW(e); }
864 
865  // debug: dump the RINEX data objects input and output
866  if (C.debug > -1)
867  {
868  LOG(DEBUG) << "INPUT data ---------------";
869  Rdata.dump(LOGstrm,Rhead);
870  LOG(DEBUG) << "OUTPUT data ---------------";
871  RDout.dump(LOGstrm,Rhead);
872  }
873 
874  } // end while loop over epochs
875 
876  // clean up
877  istrm.close();
878 
879  // failure due to critical error
880  if(iret < 0) break;
881 
882  if(iret >= 0) nfiles++;
883 
884  } // end loop over files
885 
886  // final clean up
887  LOG(INFO) << " Close output file.";
888  C.ostrm.close();
889 
890  if(iret < 0) return iret;
891 
892  return nfiles;
893  }
894  catch(Exception& e) { GNSSTK_RETHROW(e); }
895 } // end processFiles()
896 
897 //------------------------------------------------------------------------------
898 // return <0 fatal; >0 skip this epoch
900  Rinex3ObsData& Rdata, Rinex3ObsData& RDout)
901 {
902  try
903  {
905  int iret(0);
906  RinexSatID sat;
907  CommonTime now(Rdata.time); // TD what if its aux data w/o an epoch?
908 
909  // if aux header data, either output or skip
910  if (RDout.epochFlag > 1)
911  { // aux header data
912  if (C.messHDda)
913  return 1;
914  return 0;
915  }
916 
917  else
918  { // regular data
919  vector<EditCmd>::iterator it, jt;
920  vector<EditCmd> toCurr;
921 
922  // for cmds with ttag <= now either execute and delete, or move to current
923  it = C.vecCmds.begin();
924  while(it != C.vecCmds.end())
925  {
926  if (it->ttag <= now || ::fabs(it->ttag - now) < C.timetol)
927  {
928  LOG(DEBUG) << "Execute vec cmd " << it->asString();
929  // delete one-time cmds, move others to curr and delete
930  iret = executeEditCmd(it, RHout, RDout);
931  if(iret < 0) return iret; // fatal error
932 
933  // keep this command on the current list
934  if (iret > 0) toCurr.push_back(*it); // C.currCmds.push_back(*it);
935 
936  // if this is a '-' cmd to be deleted, find matching '+' and delete
937  // note fixEditCmdList() forced every - to have a corresponding +
938  if (iret == 0 && it->sign == -1)
939  {
940  for (jt = C.currCmds.begin(); jt != C.currCmds.end(); ++jt)
941  if (jt->type==it->type && jt->sat==it->sat && jt->obs==it->obs)
942  break;
943  if (jt == C.currCmds.end())
944  {
945  Exception e(string("Execute failed to find + cmd matching ")+it->asString());
946  GNSSTK_THROW(e);
947  }
948  C.currCmds.erase(jt);
949  }
950 
951  // remove from vecCmds
952  it = C.vecCmds.erase(it); // erase vector element
953  }
954  else
955  ++it;
956  }
957 
958  // apply current commands, deleting obsolete ones
959  it = C.currCmds.begin();
960  while(it != C.currCmds.end())
961  {
962  LOG(DEBUG) << "Execute current cmd " << it->asString();
963  // execute command; delete obsolete commands
964  iret = executeEditCmd(it, RHout, RDout);
965  if(iret < 0)
966  return iret;
967 
968  if(iret == 0)
969  it = C.currCmds.erase(it); // erase vector element
970  else
971  ++it;
972  }
973 
974  for (it = toCurr.begin(); it != toCurr.end(); ++it)
975  C.currCmds.push_back(*it);
976  }
977 
978  return 0;
979  }
980  catch(Exception& e) { GNSSTK_RETHROW(e); }
981 } // end processOneEpoch()
982 
983 
984 //------------------------------------------------------------------------------
985 // return >0 to put/keep the command on the 'current' queue
986 // return <0 for fatal error
987 int executeEditCmd(const vector<EditCmd>::iterator& it, Rinex3ObsHeader& Rhead,
988  Rinex3ObsData& Rdata)
989 {
991  size_t i,j;
992  string sys;
993  vector<string> flds;
994  Rinex3ObsData::DataMap::const_iterator kt;
995  vector<RinexObsID>::iterator jt;
996 
997  try
998  {
999  if(it->type == EditCmd::invalidCT)
1000  {
1001  LOG(DEBUG) << " Invalid command " << it->asString();
1002  return 0;
1003  }
1004 
1005  // OF output file --------------------------------------------------------
1006  else if(it->type == EditCmd::ofCT)
1007  {
1008  // close the old file
1009  if(C.ostrm.is_open()) { C.ostrm.close(); C.ostrm.clear(); }
1010 
1011  // open the new file
1012  C.ostrm.open(it->field.c_str(),ios::out);
1013  if(!C.ostrm.is_open())
1014  {
1015  LOG(ERROR) << "Error : could not open output file " << it->field;
1016  return -1;
1017  }
1018  C.ostrm.exceptions(ios::failbit);
1019 
1020  LOG(INFO) << " Opened output file " << it->field << " at time "
1021  << printTime(Rdata.time,C.longfmt);
1022 
1023  // if this is the first file, apply the header commands
1024  if(it->ttag == CommonTime::BEGINNING_OF_TIME)
1025  {
1026  Rhead.fileProgram = C.prgmName;
1027  if(!C.messHDp.empty()) Rhead.fileProgram = C.messHDp;
1028  if(!C.messHDr.empty()) Rhead.fileAgency = C.messHDr;
1029  if(!C.messHDo.empty()) Rhead.observer = C.messHDo;
1030  if(!C.messHDa.empty()) Rhead.agency = C.messHDa;
1031  if(!C.messHDj.empty()) Rhead.recNo = C.messHDj;
1032  if(!C.messHDk.empty()) Rhead.recType = C.messHDk;
1033  if(!C.messHDl.empty()) Rhead.recVers = C.messHDl;
1034  if(!C.messHDs.empty()) Rhead.antNo = C.messHDs;
1035  if(!C.messHDx.empty())
1036  {
1037  flds = split(C.messHDx,',');
1038  // TD check n==3,doubles in initialize
1039  for(i=0; i<3; i++) Rhead.antennaPosition[i] = asDouble(flds[i]);
1040  }
1041  if(!C.messHDm.empty()) Rhead.markerName = C.messHDm;
1042  if(!C.messHDn.empty())
1043  {
1044  Rhead.markerNumber = C.messHDn;
1045  Rhead.valid |= Rinex3ObsHeader::validMarkerNumber;
1046  }
1047  if(!C.messHDt.empty())
1048  Rhead.antType = C.messHDt;
1049  if(!C.messHDh.empty())
1050  {
1051  flds = split(C.messHDh,','); // TD check n==3,doubles in initialize
1052  for(i=0; i<3; i++) Rhead.antennaDeltaHEN[i] = asDouble(flds[i]);
1053  }
1054  if(C.messHDdc)
1055  {
1056  Rhead.commentList.clear();
1057  Rhead.valid ^= Rinex3ObsHeader::validComment;
1058  }
1059  if(C.messHDc.size() > 0)
1060  {
1061  for(i=0; i<C.messHDc.size(); i++)
1062  Rhead.commentList.push_back(C.messHDc[i]);
1063  Rhead.valid |= Rinex3ObsHeader::validComment;
1064  }
1065  if (C.decimate > 0.0)
1066  {
1067  Rhead.interval = C.decimate;
1068  Rhead.valid |= Rinex3ObsHeader::validInterval;
1069  }
1070  }
1071 
1072  Rhead.firstObs = Rdata.time;
1073  Rhead.valid.clear(Rinex3ObsHeader::validLastTime); // turn off
1074 
1075  // write the header
1076  C.ostrm << Rhead;
1077  return 0;
1078  }
1079 
1080  // DA delete all ---------------------------------------------------------------
1081  else if(it->type == EditCmd::daCT)
1082  {
1083  switch(it->sign)
1084  {
1085  case 1: case 0:
1086  Rdata.numSVs = 0; // clear this data, keep the cmd
1087  Rdata.obs.clear();
1088  if(it->sign == 0) return 0;
1089  break;
1090  case -1:
1091  return 0; // delete the (-) command
1092  break;
1093  }
1094  }
1095 
1096  // DO delete obs type ----------------------------------------------------------
1097  // This is handled above where output header is created w/o the deleted
1098  // obs type in it. The data isn't actually deleted from the obs data objects
1099  // but just doesn't get written out
1100  else if (it->type == EditCmd::doCT)
1101  return 0;
1102 
1103  // DS delete satellite ---------------------------------------------------------
1104  else if(it->type == EditCmd::dsCT)
1105  {
1106  vector<RinexSatID> sats;
1107  if (it->sign == -1)
1108  return 0; // delete the (-) command
1109 
1110  LOG(DEBUG) << " Delete sat " << it->asString();
1111  if (it->sat.id > 0)
1112  {
1113  // Find a specific satellite
1114  kt = Rdata.obs.find(it->sat);
1115  if (kt != Rdata.obs.end()) // found the SV
1116  sats.push_back(kt->first);
1117  else
1118  LOG(DEBUG) << " Execute: sat " << it->sat << " not found in data";
1119  }
1120  else
1121  {
1122  // Delete all with the specified system
1123  for (kt=Rdata.obs.begin(); kt!=Rdata.obs.end(); ++kt)
1124  if (kt->first.system == it->sat.system)
1125  sats.push_back(kt->first);
1126  }
1127 
1128  LOG(DEBUG) << " sats.size() " << sats.size() << " Rdata.obs.size() " << Rdata.obs.size();
1129 
1130  for (j=0; j<sats.size(); j++)
1131  Rdata.obs.erase(sats[j]);
1132 
1133  Rdata.numSVs = Rdata.obs.size();
1134 
1135  if (it->sign == 0)
1136  return 0; // delete the one-time command
1137  }
1138 
1139  // -----------------------------------------------------------------------------
1140  // the rest require that we find satellite and obsid in Rdata.obs
1141  else
1142  {
1143  vector<RinexSatID> sats;
1144 
1145  if(it->sign == -1) return 0; // delete the (-) command
1146 
1147  sys = asString(it->sat.systemChar()); // find the system
1148 
1149  // find the OT in the header map, and get index into vector
1150  jt = find(Rhead.mapObsTypes[sys].begin(),
1151  Rhead.mapObsTypes[sys].end(), it->obs);
1152  if (jt == Rhead.mapObsTypes[sys].end()) { // ObsID not found
1153  // TD message? user error: ask to delete one that's not there
1154  LOG(DEBUG) << " Execute: obstype " << it->obs << " not found in header";
1155  return 0; // delete the cmd
1156  }
1157 
1158  i = (jt - Rhead.mapObsTypes[sys].begin()); // index into vector
1159 
1160  // find the sat
1161  if(it->sat.id > 0)
1162  {
1163  if(Rdata.obs.find(it->sat)==Rdata.obs.end())
1164  { // sat not found
1165  LOG(DEBUG) << " Execute: sat " << it->sat << " not found in data";
1166  }
1167  else
1168  sats.push_back(it->sat);
1169  }
1170  else
1171  {
1172  for(kt=Rdata.obs.begin(); kt!=Rdata.obs.end(); ++kt)
1173  {
1174  if(kt->first.system == it->sat.system)
1175  sats.push_back(kt->first);
1176  }
1177  }
1178 
1179  for(j=0; j<sats.size(); j++)
1180  {
1181  switch(it->type)
1182  {
1183  // DD delete data -----------------------------------------------------
1184  case EditCmd::ddCT:
1185  Rdata.obs[sats[j]][i].data = 0.0;
1186  Rdata.obs[sats[j]][i].ssi = 0;
1187  Rdata.obs[sats[j]][i].lli = 0;
1188  break;
1189  // SD set data --------------------------------------------------------
1190  case EditCmd::sdCT:
1191  Rdata.obs[sats[j]][i].data = it->data;
1192  break;
1193  // SS set SSI ---------------------------------------------------------
1194  case EditCmd::ssCT:
1195  Rdata.obs[sats[j]][i].ssi = it->idata;
1196  break;
1197  // SL set LLI ---------------------------------------------------------
1198  case EditCmd::slCT:
1199  Rdata.obs[sats[j]][i].lli = it->idata;
1200  break;
1201  // BD bias data -------------------------------------------------------
1202  case EditCmd::bdCT: // do not bias
1203  if(Rdata.obs[sats[j]][i].data != 0.0 || C.messBZ)
1204  Rdata.obs[sats[j]][i].data += it->data;
1205  break;
1206  // BS bias SSI --------------------------------------------------------
1207  case EditCmd::bsCT:
1208  Rdata.obs[sats[j]][i].ssi += it->idata;
1209  break;
1210  // BL bias LLI --------------------------------------------------------
1211  case EditCmd::blCT:
1212  Rdata.obs[sats[j]][i].lli += it->idata;
1213  break;
1214  // never reached ------------------------------------------------------
1215  default:
1216  // message?
1217  break;
1218  }
1219  }
1220 
1221  if(it->sign == 0)
1222  return 0; // delete the one-time command
1223  }
1224 
1225  return 1;
1226  }
1227  catch(Exception& e) { GNSSTK_RETHROW(e); }
1228 } // end executeEditCmd()
1229 
1230 
1231 //------------------------------------------------------------------------------
1232 int Configuration::processUserInput(int argc, char **argv) throw()
1233 {
1234  string PrgmDesc,cmdlineUsage, cmdlineErrors, cmdlineExtras;
1235  vector<string> cmdlineUnrecognized;
1236 
1237  // build the command line
1238  opts.DefineUsageString(prgmName + " [options]");
1239  PrgmDesc = buildCommandLine();
1240 
1241  // let CommandLine parse options; write all errors, etc to the passed strings
1242  int iret = opts.ProcessCommandLine(argc, argv, PrgmDesc,
1243  cmdlineUsage, cmdlineErrors, cmdlineUnrecognized);
1244 
1245  // handle return values
1246  if(iret == -2) return iret; // bad alloc
1247  if(iret == -3) return iret; // invalid command line
1248 
1249  // help: print syntax page and quit
1250  if(opts.hasHelp()) {
1251  LOG(INFO) << cmdlineUsage;
1252  return 1;
1253  }
1254 
1255  // extra parsing (perhaps add to cmdlineErrors, cmdlineExtras)
1256  iret = extraProcessing(cmdlineErrors, cmdlineExtras);
1257  if(iret == -4) return iret; // log file could not be opened
1258 
1259  // output warning / error messages
1260  if(cmdlineUnrecognized.size() > 0) {
1261  LOG(WARNING) << "Warning - unrecognized arguments:";
1262  for(size_t i=0; i<cmdlineUnrecognized.size(); i++)
1263  LOG(WARNING) << " " << cmdlineUnrecognized[i];
1264  LOG(WARNING) << "End of unrecognized arguments";
1265  }
1266 
1267  if(!cmdlineExtras.empty()) {
1268  stripTrailing(cmdlineExtras,'\n');
1269  LOG(INFO) << cmdlineExtras;
1270  }
1271 
1272  // fatal errors
1273  if(!cmdlineErrors.empty()) {
1274  stripTrailing(cmdlineErrors,'\n');
1275  replaceAll(cmdlineErrors,"\n","\n ");
1276  LOG(ERROR) << "Errors found on command line:\n " << cmdlineErrors
1277  << "\nEnd of command line errors.";
1278  return 1;
1279  }
1280 
1281  // success: dump configuration summary
1282  if(debug > -1) {
1283  ostringstream oss;
1284  oss << "------ Summary of " << prgmName
1285  << " command line configuration ------\n";
1286  opts.DumpConfiguration(oss);
1287  if(!cmdlineExtras.empty()) oss << "# Extra Processing:\n" << cmdlineExtras;
1288  oss << "\n------ End configuration summary ------";
1289  LOG(DEBUG) << oss.str();
1290  }
1291 
1292  return 0;
1293 
1294 } // end Configuration::CommandLine()
1295 
1296 //------------------------------------------------------------------------------
1298 {
1299  // Program description will appear at the top of the syntax page
1300  string PrgmDesc = " Program " + prgmName +
1301  " will open and read RINEX observation files(s), apply editing\n"
1302  " commands, and write out the modified RINEX data to RINEX file(s).\n"
1303  " Input is on the command line, or of the same form in a file (--file).\n"
1304  " NB. Minimum required input is one input file (--IF) and one output file (--OF).\n"
1305  " Usage: " + prgmName + " [options] [editing commands]\n"
1306  " Options:";
1307 
1308  // options to appear on the syntax page, and to be accepted on command line
1309  //opts.Add(char, opt, arg, repeat?, required?, &target, pre-desc, desc);
1310  // NB cfgfile is a dummy, but it must exist when cmdline is processed.
1311  opts.Add(0, "IF", "fn", true, false, &messIF,
1312  "# RINEX input and output files",
1313  "Input RINEX observation file name");
1314  opts.Add(0, "ID", "p", false, false, &InObspath, "",
1315  "Path of input RINEX observation file(s)");
1316  opts.Add(0, "OF", "fn", true, false, &messOF, "",
1317  "Output RINEX obs files [also see --OF <f,t> below]");
1318  opts.Add(0, "OD", "p", false, false, &OutObspath, "",
1319  "Path of output RINEX observation file(s)");
1320 
1321  opts.Add('f', "file", "fn", true, false, &cfgfile, "# Other file I/O",
1322  "Name of file containing more options [#->EOL = comment]");
1323  opts.Add('l', "log", "fn", false, false, &logfile, "",
1324  "Output log file name");
1325  opts.Add(0, "ver2", "", false, false, &outver2, "",
1326  "Write out RINEX version 2");
1327 
1328  opts.Add(0, "verbose", "", false, false, &verbose, "# Help",
1329  "Print extra output information");
1330  opts.Add(0, "debug", "", false, false, &debug, "",
1331  "Print debug output at level 0 [debug<n> for level n=1-7]");
1332  opts.Add(0, "help", "", false, false, &help, "",
1333  "Print this syntax page, and quit");
1334 
1335  opts.Add(0, "HDp", "p", false, false, &messHDp, "# ------ Editing commands ------\n"
1336  "# RINEX header modifications (arguments with whitespace must be quoted)",
1337  "Set header 'PROGRAM' field to <p>");
1338  opts.Add(0, "HDr", "rb", false, false, &messHDr, "",
1339  "Set header 'RUN BY' field to <rb>");
1340  opts.Add(0, "HDo", "obs", false, false, &messHDo, "",
1341  "Set header 'OBSERVER' field to <obs>");
1342  opts.Add(0, "HDa", "a", false, false, &messHDa, "",
1343  "Set header 'AGENCY' field to <a>");
1344  opts.Add(0, "HDx", "x,y,z", false, false, &messHDx, "",
1345  "Set header 'POSITION' field to <x,y,z> (ECEF, m)");
1346  opts.Add(0, "HDm", "m", false, false, &messHDm, "",
1347  "Set header 'MARKER NAME' field to <m>");
1348  opts.Add(0, "HDn", "n", false, false, &messHDn, "",
1349  "Set header 'MARKER NUMBER' field to <n>");
1350  opts.Add(0, "HDj", "n", false, false, &messHDj, "",
1351  "Set header 'REC #' field to <n>");
1352  opts.Add(0, "HDk", "t", false, false, &messHDk, "",
1353  "Set header 'REC TYPE' field to <t>");
1354  opts.Add(0, "HDl", "v", false, false, &messHDl, "",
1355  "Set header 'REC VERS' field to <v>");
1356  opts.Add(0, "HDs", "n", false, false, &messHDs, "",
1357  "Set header 'ANT #' field to <n>");
1358  opts.Add(0, "HDt", "t", false, false, &messHDt, "",
1359  "Set header 'ANT TYPE' field to <t>");
1360  opts.Add(0, "HDh", "h,e,n", false, false, &messHDh, "",
1361  "Set header 'ANTENNA OFFSET' field to <h,e,n> (Ht,East,North)");
1362  opts.Add(0, "HDc", "c", true, false, &messHDc, "",
1363  "Add 'COMMENT' <c> to the output header");
1364  opts.Add(0, "HDdc", "", false, false, &messHDdc, "",
1365  "Delete all comments [not --HDc] from input header");
1366  opts.Add(0, "HDda", "", false, false, &messHDda, "",
1367  "Delete all auxiliary header data");
1368 
1369  startStr = defaultstartStr;
1370  stopStr = defaultstopStr;
1371  opts.Add(0, "TB", "t[:f]", false, false, &startStr,
1372  "# Time related [t,f are strings, time t conforms to format f;"
1373  " cf. gnsstk::Epoch.]\n# Default t(f) is 'week,sec-of-week'(%F,%g)"
1374  " OR 'y,m,d,h,m,s'(%Y,%m,%d,%H,%M,%S)\n"
1375  " --OF <f,t> At RINEX time <t>, close output file and open "
1376  "another named <f> ()",
1377  "Start time: Reject data before this time");
1378  opts.Add(0, "TE", "t[:f]", false, false, &stopStr, "",
1379  "Stop time: Reject data after this time");
1380  opts.Add(0, "TT", "dt", false, false, &timetol, "",
1381  "Tolerance in comparing times, in seconds");
1382  opts.Add(0, "TN", "dt", false, false, &decimate, "",
1383  "If dt>0, decimate data to times = TB + N*dt [sec, w/in tol]");
1384 
1385  opts.Add(0, "DA", "t", true, false, &messDA,
1386  "# In the following <SV> is a RINEX satellite identifier, "
1387  "e.g. G17 R7 E22 R etc.\n"
1388  "# and <OT> is a 3- or 4-char RINEX observation code "
1389  "e.g. C1C GL2X S2N\n"
1390  "# Delete cmds; for start(stop) cmds. stop(start) time defaults "
1391  "to end(begin) of data\n"
1392  "# and 'deleting' data for a single OT means it is set to zero "
1393  "- as RINEX requires.",
1394  "Delete all data at a single time <t>");
1395  opts.Add(0, "DA+", "t", true, false, &messDAp, "",
1396  "Delete all data beginning at time <t>");
1397  opts.Add(0, "DA-", "t", true, false, &messDAm, "",
1398  "Stop deleting at time <t>");
1399 
1400  opts.Add(0, "DO", "OT", true, false, &messDO, "",
1401  "Delete RINEX obs type <OT> entirely (incl. header)");
1402 
1403  opts.Add(0, "DS", "SV,t", true, false, &messDS,
1404  " --DS <SV> Delete all data for satellite <SV> [SV may be char]",
1405  "Delete all data for satellite <SV> at single time <t>");
1406  opts.Add(0, "DS+", "SV,t", true, false, &messDSp, "",
1407  "Delete data for satellite <SV> beginning at time <t>");
1408  opts.Add(0, "DS-", "SV,t", true, false, &messDSm, "",
1409  "Stop deleting data for sat <SV> beginning at time <t>");
1410 
1411  opts.Add(0, "DD", "SV,OT,t", true, false, &messDD, "",
1412  "Delete a single RINEX datum(SV,OT) at time <t>");
1413  opts.Add(0, "DD+", "SV,OT,t", true, false, &messDDp, "",
1414  "Delete all RINEX data(SV,OT) starting at time <t>");
1415  opts.Add(0, "DD-", "SV,OT,t", true, false, &messDDm, "",
1416  "Stop deleting RINEX data(SV,OT) at time <t>");
1417 
1418  opts.Add(0, "SD", "SV,OT,t,d", true, false, &messSD, "",
1419  "Set data(SV,OT) to value <d> at single time <t>");
1420  opts.Add(0, "SS", "SV,OT,t,s", true, false, &messSS, "",
1421  "Set SSI(SV,OT) to value <s> at single time <t>");
1422  opts.Add(0, "SL", "SV,OT,t,l", true, false, &messSL, "",
1423  "Set LLI(SV,OT) to value <l> at single time <t>");
1424  opts.Add(0, "SL+", "SV,OT,t,l", true, false, &messSLp, "",
1425  "Set all LLI(SV,OT) to value <l> starting at time <t>");
1426  opts.Add(0, "SL-", "SV,OT,t,l", true, false, &messSLm, "",
1427  "Stop setting LLI(SV,OT) to value <l> at time <t>");
1428 
1429  opts.Add(0, "BZ", "", false, false, &messBZ,
1430  "# Bias cmds: (BD cmds apply only when data is non-zero, unless --BZ)",
1431  "Apply BD command even when data is zero (i.e. 'missing')");
1432  opts.Add(0, "BS", "SV,OT,t,s", true, false, &messBS, "",
1433  "Add the value <s> to SSI(SV,OT) at single time <t>");
1434  opts.Add(0, "BL", "SV,OT,t,l", true, false, &messBL, "",
1435  "Add the value <l> to LLI(SV,OT) at single time <t>");
1436  opts.Add(0, "BD", "SV,OT,t,d", true, false, &messBD, "",
1437  "Add the value <d> to data(SV,OT) at single time <t>");
1438  opts.Add(0, "BD+", "SV,OT,t,d", true, false, &messBDp, "",
1439  "Add the value <d> to data(SV,OT) beginning at time <t>");
1440  opts.Add(0, "BD-", "SV,OT,t,d", true, false, &messBDm, "",
1441  "Stop adding the value <d> to data(SV,OT) at time <t>");
1442 
1443  // turn off argument expansion for the editing commands
1444  opts.noExpansion("HDc");
1445  opts.noExpansion("OF");
1446  opts.noExpansion("DA");
1447  opts.noExpansion("DA-");
1448  opts.noExpansion("DA+");
1449  opts.noExpansion("DO");
1450  opts.noExpansion("DS");
1451  opts.noExpansion("DS+");
1452  opts.noExpansion("DS-");
1453  opts.noExpansion("DD");
1454  opts.noExpansion("DD+");
1455  opts.noExpansion("DD-");
1456  opts.noExpansion("SD");
1457  opts.noExpansion("SS");
1458  opts.noExpansion("SL");
1459  opts.noExpansion("SL+");
1460  opts.noExpansion("SL-");
1461  opts.noExpansion("BD");
1462  opts.noExpansion("BD+");
1463  opts.noExpansion("BD-");
1464  opts.noExpansion("BS");
1465  opts.noExpansion("BL");
1466 
1467  // deprecated (old,new)
1468  //opts.Add_deprecated("--SP3","--eph");
1469 
1470  return PrgmDesc;
1471 
1472 } // end Configuration::buildCommandLine()
1473 
1474 //------------------------------------------------------------------------------
1475 int Configuration::extraProcessing(string& errors, string& extras) throw()
1476 {
1477  int n;
1478  size_t i;
1479  vector<string> fld;
1480  ostringstream oss,ossx; // oss for Errors, ossx for Warnings and info
1481 
1482  // start and stop times
1483  for(i=0; i<2; i++) {
1484  static const string fmtGPS("%F,%g"),fmtCAL("%Y,%m,%d,%H,%M,%S");
1485  msg = (i==0 ? startStr : stopStr);
1486  if(msg == (i==0 ? defaultstartStr : defaultstopStr)) continue;
1487 
1488  bool ok(true);
1489  bool hasfmt(msg.find('%') != string::npos);
1490  n = numWords(msg,',');
1491  if(hasfmt) {
1492  fld = split(msg,':');
1493  if(fld.size() != 2) { ok = false; }
1494  else try {
1495  Epoch ep;
1496  stripLeading(fld[0]," \t");
1497  stripLeading(fld[1]," \t");
1498  ep.scanf(fld[0],fld[1]);
1499  (i==0 ? beginTime : endTime) = static_cast<CommonTime>(ep);
1500  }
1501  catch(Exception& e) { ok = false; LOG(INFO) << "excep " << e.what(); }
1502  }
1503  else if(n == 2 || n == 6) { // try the defaults
1504  try {
1505  Epoch ep;
1506  ep.scanf(msg,(n==2 ? fmtGPS : fmtCAL));
1507  (i==0 ? beginTime : endTime) = static_cast<CommonTime>(ep);
1508  }
1509  catch(Exception& e) { ok = false; LOG(INFO) << "excep " << e.what(); }
1510  }
1511 
1512  if(ok) {
1513  msg = printTime((i==0 ? beginTime : endTime),fmtGPS+" = "+fmtCAL);
1514  if(msg.find("Error") != string::npos) ok = false;
1515  }
1516 
1517  if(!ok)
1518  oss << "Error : invalid time or format in --" << (i==0 ? "start" : "stop")
1519  << " " << (i==0 ? startStr : stopStr) << endl;
1520  else
1521  ossx << (i==0 ? " Begin time --begin" : " End time --end") << " is "
1522  << printTime((i==0 ? beginTime : endTime), fmtGPS+" = "+fmtCAL+"\n");
1523  }
1524 
1525  // parse the editing commands
1526  parseEditCmds(messOF, "OF", oss);
1527  parseEditCmds(messDA, "DA", oss);
1528  parseEditCmds(messDAp, "DA+", oss);
1529  parseEditCmds(messDAm, "DA-", oss);
1530  parseEditCmds(messDO, "DO", oss);
1531  parseEditCmds(messDS, "DS", oss);
1532  parseEditCmds(messDSp, "DS+", oss);
1533  parseEditCmds(messDSm, "DS-", oss);
1534  parseEditCmds(messDD, "DD", oss);
1535  parseEditCmds(messDDp, "DD+", oss);
1536  parseEditCmds(messDDm, "DD-", oss);
1537  parseEditCmds(messSD, "SD", oss);
1538  parseEditCmds(messSS, "SS", oss);
1539  parseEditCmds(messSL, "SL", oss);
1540  parseEditCmds(messSLp, "SL+", oss);
1541  parseEditCmds(messSLm, "SL-", oss);
1542  parseEditCmds(messBD, "BD", oss);
1543  parseEditCmds(messBDp, "BD+", oss);
1544  parseEditCmds(messBDm, "BD-", oss);
1545  parseEditCmds(messBS, "BS", oss);
1546  parseEditCmds(messBL, "BL", oss);
1547 
1548  // dump commands for debug
1549  //TEMP if(debug > -1)
1550  //for(i=0; i<vecCmds.size(); i++)
1551  //LOG(INFO) << vecCmds[i].asString(" Input Edit cmd:");
1552 
1553  // 'fix up' list of edit cmds: sort, add -(+) for unmatched +(-), find + > -
1554  fixEditCmdList();
1555 
1556  // dump final list of commands
1557  if(verbose)
1558  for(i=0; i<vecCmds.size(); i++)
1559  ossx << vecCmds[i].asString(" Edit cmd:") << endl;
1560 
1561  // open the log file (so warnings, configuration summary, etc can go there) -----
1562  if(!logfile.empty()) {
1563  logstrm.open(logfile.c_str(), ios::out);
1564  if(!logstrm.is_open()) {
1565  LOG(ERROR) << "Error : Failed to open log file " << logfile;
1566  return -4;
1567  }
1568  LOG(INFO) << "Output redirected to log file " << logfile;
1569  pLOGstrm = &logstrm;
1570  }
1571  LOG(INFO) << Title;
1572 
1573  // add new errors to the list
1574  msg = oss.str();
1575  if(!msg.empty()) errors += msg;
1576  msg = ossx.str();
1577  if(!msg.empty()) extras += msg;
1578 
1579  return 0;
1580 
1581 } // end Configuration::extraProcessing(string& errors) throw()
1582 
1583 //------------------------------------------------------------------------------
1584 // little helper routine for extraProcessing
1585 void Configuration::parseEditCmds(vector<string>& vec, const string lab,
1586  ostringstream& os) throw()
1587 {
1588  for(size_t i=0; i<vec.size(); i++) {
1589  EditCmd ec(lab,vec[i]);
1590  if(ec.isValid()) vecCmds.push_back(ec);
1591  else os << "Error: invalid argument in " << lab << " cmd: >" << vec[i] << "<\n";
1592  }
1593 }
1594 
1595 //------------------------------------------------------------------------------
1596 //------------------------------------------------------------------------------
1597 // constructor from strings, i.e. parser e.g. "DA+","t" or "BDp","SV,OT,t,s"
1598 EditCmd::EditCmd(const string intypestr, const string inarg)
1599 {
1600  try {
1601  string tag(upperCase(intypestr)), arg(inarg);
1602  vector<string> flds;
1603 
1604  type = invalidCT; // defaults
1606  sign = idata = 0;
1607  data = 0.0;
1608 
1609  if(tag.size() == 2) sign = 0; // pull off sign
1610  else if(tag[2] == '+') sign = 1;
1611  else if(tag[2] == '-') sign = -1;
1612  else return;
1613  tag = tag.substr(0,2);
1614 
1615  flds = split(arg,','); // split arg
1616  const size_t n(flds.size()); // number of args
1617 
1618  if(tag == "OF") {
1619  if(n != 1 && n != 3 && n != 7) return;
1620  field = flds[0];
1621  if(n != 1) {
1622  stripLeading(arg,field+",");
1623  if(!parseTime(arg,ttag)) return;
1624  }
1625  type = ofCT;
1626  }
1627  else if(tag == "DA") {
1628  if(!parseTime(arg,ttag)) return;
1629  type = daCT;
1630  }
1631  else if(tag == "DO") {
1632  if(sign != 0) return; // no DO+ or DO-
1633 
1634  if(arg.size() == 4) // get sys
1635  sat.fromString(string(1,arg[0]));
1636  // else sat sys is unknown
1637  if(isValidRinexObsID(arg))
1638  {
1642  obs = RinexObsID(arg, Rinex3ObsBase::currentVersion);
1643  }
1644  else
1645  return;
1646  type = doCT;
1647  }
1648  else if(tag == "DS") {
1649  if(n != 1 && n != 3 && n != 7) return; // DS DS,w,sow and DS,y,m,d,h,m,s
1650  try { sat.fromString(flds[0]); } catch(Exception) { return; }
1651  if(n != 1) { // time for DS is BeginTime
1652  stripLeading(arg,flds[0]+",");
1653  if(!parseTime(arg,ttag)) return;
1654  }
1655  if(sign == 0 && n == 1) sign = 1;
1656  type = dsCT;
1657  }
1658  else {
1659  // args are SV,OT,t[,d or s or l]
1660  if(n < 4) return; // at minimum SV,OT,week,sow
1661 
1662  stripLeading(arg,flds[0]+","+flds[1]+","); // remove 'SV,OT,' from arg
1663 
1664  string dat;
1665  if(tag != "DD") { // strip and save last arg (dsl)
1666  dat = flds[flds.size()-1];
1667  stripTrailing(arg,string(",")+dat);
1668  }
1669  if(!parseTime(arg,ttag)) return; // get the time
1670 
1671  // parse satellite
1672  try { sat.fromString(flds[0]); } catch(Exception) { return; }
1673 
1674  // add system char to obs string
1675  if(flds[1].size() == 3 && sat.systemChar() != '?')
1676  flds[1] = string(1,sat.systemChar()) + flds[1];
1677  // parse obs type
1678  if(isValidRinexObsID(flds[1]))
1679  {
1683  obs = RinexObsID(flds[1], Rinex3ObsBase::currentVersion);
1684  }
1685  else
1686  return;
1687 
1688  if(tag == "DD") { type = ddCT; return; } // DD is done
1689 
1690  if(n != 5 && n != 9) return; // rest have SV,OT,t,d = 5 or 9 args
1691 
1692  if(tag == "SD" || tag == "BD") { // double data
1693  if(isScientificString(dat)) data = asDouble(dat); else return;
1694  }
1695  else { // rest have int data
1696  if(isDigitString(dat)) idata = asInt(dat); else return;
1697  }
1698 
1699  // now just set type
1700  if(tag == "SD") type = sdCT;
1701  else if(tag == "SS") type = ssCT;
1702  else if(tag == "SL") type = slCT;
1703  else if(tag == "BS") type = bsCT;
1704  else if(tag == "BL") type = blCT;
1705  else if(tag == "BD") type = bdCT;
1706  }
1707  }
1708  catch(Exception& e) { GNSSTK_RETHROW(e); }
1709 }
1710 
1711 //------------------------------------------------------------------------------
1712 bool EditCmd::parseTime(const string arg, CommonTime& ttag) throw()
1713 {
1714  static const string fmtGPS("%F,%g"),fmtCAL("%Y,%m,%d,%H,%M,%S");
1715  stripLeading(arg," \t");
1716  int n(numWords(arg,','));
1717  if(n == 2 || n == 6) {
1718  Epoch ep;
1719  try { ep.scanf(arg, (n==2 ? fmtGPS : fmtCAL)); }
1720  catch(StringException) { return false; }
1721  ttag = static_cast<CommonTime>(ep);
1722  }
1723  else return false;
1724 
1725  return true;
1726 }
1727 
1728 //------------------------------------------------------------------------------
1729 // dump, with optional message
1730 string EditCmd::asString(string msg)
1731 {
1732  try {
1734  static map<CmdType,string> typeLabel;
1735  if(typeLabel.size() == 0) {
1736  typeLabel[invalidCT] = string("--invalidCT-- ");
1737  typeLabel[ofCT] = string("OF_Output_File");
1738  typeLabel[daCT] = string("DA_Delete_All ");
1739  typeLabel[doCT] = string("DO_Delete_Obs ");
1740  typeLabel[dsCT] = string("DS_Delete_Sat ");
1741  typeLabel[ddCT] = string("DD_Delete_Data");
1742  typeLabel[sdCT] = string("SD_Set_Data ");
1743  typeLabel[ssCT] = string("SS_Set_SSI ");
1744  typeLabel[slCT] = string("SL_Set_LLI ");
1745  typeLabel[bdCT] = string("BD_Bias_Data ");
1746  typeLabel[bsCT] = string("BS_Bias_SSI ");
1747  typeLabel[blCT] = string("BL_Bias_LLI ");
1748  }
1749 
1750  ostringstream os;
1751 
1752  if(msg.size()) os << msg;
1753  os << " " << typeLabel[type]
1754  << " " << (sign==0 ? "0" : (sign<0 ? "-":"+"))
1755  << " SV:" << sat.toString()
1756  << " OT:" << obs.asString()
1757  << " d:" << fixed << setprecision(4) << data
1758  << " i:" << idata
1759  << " t:" << (ttag == CommonTime::BEGINNING_OF_TIME
1760  ? "BeginTime" : printTime(ttag,C.longfmt))
1761  << " >" << field << "<";
1762 
1763  return os.str();
1764  }
1765  catch(Exception& e) { GNSSTK_RETHROW(e); }
1766  catch(std::exception& e) {
1767  Exception E(string("std::except: ") + e.what());
1768  GNSSTK_THROW(E);
1769  }
1770 }
1771 
1772 //------------------------------------------------------------------------------
1773 void fixEditCmdList(void) throw()
1774 {
1776  vector<EditCmd>::iterator it, jt;
1777  vector<EditCmd> newCmds;
1778 
1779  // sort on time
1780  sort(C.vecCmds.begin(), C.vecCmds.end(), EditCmdLessThan());
1781 
1782  // ensure each - command has a corresponding + command
1783  // (note that + cmds do not need a - cmd: they will just never be turned off)
1784  for(it = C.vecCmds.begin(); it != C.vecCmds.end(); ++it ) {
1785  if(it->sign == -1 && it->type != EditCmd::invalidCT) {
1786  bool havePair(false);
1787  if(it != C.vecCmds.begin()) {
1788  jt = it; --jt; // --(jt = it);
1789  while(1) { // search backwards for match
1790  if(jt->type == it->type &&
1791  jt->sat == it->sat &&
1792  jt->obs == it->obs)
1793  {
1794  if(jt->sign == 1) havePair=true; // its a match
1795  else if(jt->sign == -1) { // this is an error
1796  LOG(ERROR) << it->asString("Error: repeat '-'");
1797  //LOG(ERROR) << jt->asString("Error: ref here ");
1798  it->type = EditCmd::invalidCT;
1799  }
1800  break;
1801  }
1802  if(jt == C.vecCmds.begin()) break;
1803  --jt;
1804  }
1805  }
1806  if(!havePair && it->type != EditCmd::invalidCT) {
1807  EditCmd ec(*it);
1808  ec.sign = 1;
1810  newCmds.push_back(ec);
1811  LOG(VERBOSE) << ec.asString(" Add cmd:");
1812  }
1813  }
1814  }
1815 
1816  if(newCmds.size() > 0) {
1817  for(it = newCmds.begin(); it != newCmds.end(); ++it )
1818  C.vecCmds.push_back(*it);
1819  newCmds.clear();
1820  sort(C.vecCmds.begin(), C.vecCmds.end(), EditCmdLessThan());
1821  }
1822 
1823  // remove invalidCT commands
1824  it = C.vecCmds.begin();
1825  while(it != C.vecCmds.end()) {
1826  if(it->type == EditCmd::invalidCT)
1827  it = C.vecCmds.erase(it); // erase vector element
1828  else
1829  ++it;
1830  }
1831 }
1832 
1833 //------------------------------------------------------------------------------
1834 //------------------------------------------------------------------------------
1835 //------------------------------------------------------------------------------
gnsstk::StringUtils::replaceAll
std::string & replaceAll(std::string &s, const std::string &oldString, const std::string &newString)
Definition: StringUtils.hpp:1849
Configuration::messHDh
string messHDh
Definition: RinEdit.cpp:408
gnsstk::Rinex3ObsHeader::commentList
StringVec commentList
comments in header
Definition: Rinex3ObsHeader.hpp:498
EditCmd::idata
int idata
Definition: RinEdit.cpp:306
EditCmd::CmdType
CmdType
Definition: RinEdit.cpp:284
Configuration::messHDm
string messHDm
Definition: RinEdit.cpp:408
gnsstk::StringUtils::upperCase
std::string & upperCase(std::string &s)
Definition: StringUtils.hpp:2117
gnsstk::StringUtils::asInt
long asInt(const std::string &s)
Definition: StringUtils.hpp:713
Configuration::messSS
vector< string > messSS
Definition: RinEdit.cpp:410
Configuration::logfile
string logfile
Definition: RinEdit.cpp:400
Configuration::OutObspath
string OutObspath
Definition: RinEdit.cpp:392
EditCmd::blCT
@ blCT
Definition: RinEdit.cpp:297
Configuration::prgmName
static const string prgmName
Definition: RinEdit.cpp:383
gnsstk::RinexObsID::asString
std::string asString() const
Definition: RinexObsID.hpp:190
Configuration::messHDa
string messHDa
Definition: RinEdit.cpp:408
gnsstk::Rinex3ObsHeader::fileAgency
std::string fileAgency
who ran program
Definition: Rinex3ObsHeader.hpp:492
logstrm
ofstream logstrm
Definition: testSSEph.cpp:87
gnsstk::Singleton< Configuration >::Instance
static Configuration & Instance()
Definition: singleton.hpp:48
gnsstk::Rinex3ObsData::dump
virtual void dump(std::ostream &s) const
Definition: Rinex3ObsData.cpp:828
EditCmd::doCT
@ doCT
Definition: RinEdit.cpp:289
gnsstk::Rinex3ObsStream::open
virtual void open(const char *fn, std::ios::openmode mode)
Definition: Rinex3ObsStream.cpp:80
gnsstk::RinexSatID::fromString
void fromString(const std::string &s)
Definition: RinexSatID.cpp:122
Configuration::ostrm
Rinex3ObsStream ostrm
Definition: RinEdit.cpp:420
pLOGstrm
#define pLOGstrm
Definition: logstream.hpp:321
Configuration::currCmds
vector< EditCmd > currCmds
Definition: RinEdit.cpp:419
gnsstk::BEGINNING_OF_TIME
const Epoch BEGINNING_OF_TIME(CommonTime::BEGINNING_OF_TIME)
Earliest representable Epoch.
gnsstk::isValidRinexObsID
bool isValidRinexObsID(const std::string &strID)
Definition: RinexObsID.cpp:223
gnsstk::Singleton
Definition: singleton.hpp:46
Configuration::calfmt
static const string calfmt
Definition: RinEdit.cpp:416
EditCmd::ttag
CommonTime ttag
Definition: RinEdit.cpp:304
EditCmd::field
string field
Definition: RinEdit.cpp:308
gnsstk::RinexSatID::systemString3
std::string systemString3() const noexcept
Definition: RinexSatID.cpp:102
gnsstk::Rinex3ObsHeader::valid
Fields valid
bits set when header rec.s present & valid
Definition: Rinex3ObsHeader.hpp:544
gnsstk::Rinex3ObsHeader
Definition: Rinex3ObsHeader.hpp:155
EditCmd::data
double data
Definition: RinEdit.cpp:307
Configuration::messHDc
vector< string > messHDc
Definition: RinEdit.cpp:409
Configuration::startStr
string startStr
Definition: RinEdit.cpp:395
gnsstk::Rinex3ObsData::obs
DataMap obs
the map of observations
Definition: Rinex3ObsData.hpp:114
Configuration::processUserInput
int processUserInput(int argc, char **argv)
Definition: RinEdit.cpp:1232
Configuration::longfmt
static const string longfmt
Definition: RinEdit.cpp:416
Configuration::verbose
bool verbose
Definition: RinEdit.cpp:387
gnsstk::Rinex3ObsHeader::glonassFreqNo
GLOFreqNumMap glonassFreqNo
GLONASS SLOT / FRQ #.
Definition: Rinex3ObsHeader.hpp:531
EditCmd::dsCT
@ dsCT
Definition: RinEdit.cpp:290
gnsstk::Exception::what
std::string what() const
Dump to a string.
Definition: Exception.cpp:193
EditCmd::bsCT
@ bsCT
Definition: RinEdit.cpp:296
Configuration::decimate
double decimate
Definition: RinEdit.cpp:399
gnsstk::Rinex3ObsHeader::Fields::clear
Fields & clear(Field f)
Clear a specific field.
Definition: Rinex3ObsHeader.hpp:390
Configuration::messHDdc
bool messHDdc
Definition: RinEdit.cpp:407
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::Rinex3ObsData::numSVs
short numSVs
Definition: Rinex3ObsData.hpp:109
EditCmd::bzCT
@ bzCT
Definition: RinEdit.cpp:298
gnsstk::CommonTime::setTimeSystem
CommonTime & setTimeSystem(TimeSystem timeSystem)
Definition: CommonTime.hpp:195
EditCmdLessThan
Definition: RinEdit.cpp:332
executeEditCmd
int executeEditCmd(const vector< EditCmd >::iterator &it, Rinex3ObsHeader &Rhead, Rinex3ObsData &Rdata)
Definition: RinEdit.cpp:987
Configuration::messHDk
string messHDk
Definition: RinEdit.cpp:408
Configuration::messIF
vector< string > messIF
Definition: RinEdit.cpp:391
Configuration::messHDn
string messHDn
Definition: RinEdit.cpp:408
gnsstk::Rinex3ObsHeader::dump
virtual void dump(std::ostream &s) const
Definition: Rinex3ObsHeader.hpp:568
EditCmd::~EditCmd
~EditCmd(void)
Definition: RinEdit.cpp:311
Configuration::help
bool help
Definition: RinEdit.cpp:387
Configuration::Configuration
Configuration()
Definition: RinEdit.cpp:347
gnsstk::WARNING
@ WARNING
Definition: logstream.hpp:57
gnsstk::Rinex3ObsHeader::numObsForSat
PRNNumObsMap numObsForSat
PRN / # OF OBS.
Definition: Rinex3ObsHeader.hpp:535
LOGstrm
#define LOGstrm
Definition: logstream.hpp:322
gnsstk::Rinex3ObsHeader::prepareVer2Write
void prepareVer2Write(void)
Definition: Rinex3ObsHeader.cpp:2141
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
fixEditCmdList
void fixEditCmdList(void)
Definition: RinEdit.cpp:1773
gnsstk::StringUtils::stripLeading
std::string & stripLeading(std::string &s, const std::string &aString, std::string::size_type num=std::string::npos)
Definition: StringUtils.hpp:1426
EditCmd::invalidCT
@ invalidCT
Definition: RinEdit.cpp:286
Configuration::messOF
vector< string > messOF
Definition: RinEdit.cpp:391
gnsstk::StringUtils::split
std::vector< std::string > split(const std::string &str, const char delimiter=' ')
Definition: StringUtils.hpp:2275
EditCmd::daCT
@ daCT
Definition: RinEdit.cpp:288
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::Rinex3ObsData::epochFlag
short epochFlag
Definition: Rinex3ObsData.hpp:104
gnsstk::Rinex3ObsHeader::antNo
std::string antNo
antenna number
Definition: Rinex3ObsHeader.hpp:507
gnsstk::Rinex3ObsHeader::interval
double interval
INTERVAL.
Definition: Rinex3ObsHeader.hpp:523
gnsstk::Rinex3ObsHeader::mapObsTypes
RinexObsMap mapObsTypes
SYS / # / OBS TYPES.
Definition: Rinex3ObsHeader.hpp:519
Configuration::setDefaults
void setDefaults(void)
Definition: RinEdit.cpp:365
gnsstk::Exception
Definition: Exception.hpp:151
Configuration::stopStr
string stopStr
Definition: RinEdit.cpp:396
gnsstk::StringUtils::stripTrailing
std::string & stripTrailing(std::string &s, const std::string &aString, std::string::size_type num=std::string::npos)
Definition: StringUtils.hpp:1453
EditCmd::bdCT
@ bdCT
Definition: RinEdit.cpp:295
gnsstk::Epoch::setLocalTime
Epoch & setLocalTime()
Definition: Epoch.cpp:404
Title
string Title
Definition: testSSEph.cpp:86
gnsstk::Exception::getText
std::string getText(const size_t &index=0) const
Definition: Exception.cpp:139
EditCmd::type
CmdType type
Definition: RinEdit.cpp:301
Configuration::outver2
bool outver2
Definition: RinEdit.cpp:387
initialize
int initialize(string &errors)
Definition: RinEdit.cpp:513
gnsstk::StringUtils::numWords
int numWords(const std::string &s, const char delimiter=' ')
Definition: StringUtils.hpp:2171
gnsstk::Epoch::scanf
Epoch & scanf(const std::string &str, const std::string &fmt)
Definition: Epoch.cpp:418
Configuration::beginTime
CommonTime beginTime
Definition: RinEdit.cpp:397
Configuration::parseEditCmds
void parseEditCmds(vector< string > &v, const string l, ostringstream &os)
Definition: RinEdit.cpp:1585
gnsstk::Rinex3ObsHeader::recNo
std::string recNo
receiver number
Definition: Rinex3ObsHeader.hpp:504
gnsstk::Rinex3ObsData::time
CommonTime time
Time corresponding to the observations.
Definition: Rinex3ObsData.hpp:91
gnsstk::CivilTime::convertToCommonTime
virtual CommonTime convertToCommonTime() const
Definition: CivilTime.cpp:75
gnsstk::include_path
void include_path(string path, string &file)
Definition: expandtilde.cpp:75
Configuration::timetol
double timetol
Definition: RinEdit.cpp:399
Configuration::messHDr
string messHDr
Definition: RinEdit.cpp:408
Configuration::messBZ
bool messBZ
Definition: RinEdit.cpp:407
debug
#define debug
Definition: Rinex3ClockHeader.cpp:51
gnsstk::Rinex3ObsHeader::version
double version
RINEX 3 version/type.
Definition: Rinex3ObsHeader.hpp:481
EditCmd::parseTime
bool parseTime(const string arg, CommonTime &ttag)
parse time from string
Definition: RinEdit.cpp:1712
Configuration::decTime
CommonTime decTime
Definition: RinEdit.cpp:397
Configuration::messHDs
string messHDs
Definition: RinEdit.cpp:408
Configuration::messHDp
string messHDp
Definition: RinEdit.cpp:408
processFiles
int processFiles(void)
Definition: RinEdit.cpp:580
EditCmd::sign
int sign
Definition: RinEdit.cpp:305
gnsstk::ERROR
@ ERROR
Definition: logstream.hpp:57
EditCmd::sdCT
@ sdCT
Definition: RinEdit.cpp:292
EditCmd::ofCT
@ ofCT
Definition: RinEdit.cpp:287
gnsstk::CommonTime
Definition: CommonTime.hpp:84
Configuration::messHDl
string messHDl
Definition: RinEdit.cpp:408
EditCmd::ddCT
@ ddCT
Definition: RinEdit.cpp:291
gnsstk::WeekSecond::sow
double sow
Definition: WeekSecond.hpp:155
gnsstk::Rinex3ObsData
Definition: Rinex3ObsData.hpp:75
Configuration::debug
int debug
Definition: RinEdit.cpp:388
gnsstk::Rinex3ObsHeader::markerName
std::string markerName
MARKER NAME.
Definition: Rinex3ObsHeader.hpp:499
Configuration::cfgfile
string cfgfile
Definition: RinEdit.cpp:389
arg
double arg
Definition: IERS1996UT1mUTCData.hpp:48
version
string version(string("2.4 9/23/15 rev"))
Configuration::messHDj
string messHDj
Definition: RinEdit.cpp:408
gnsstk::VERBOSE
@ VERBOSE
Definition: logstream.hpp:57
EditCmd
Definition: RinEdit.cpp:281
gnsstk::RinexObsID
Definition: RinexObsID.hpp:102
gnsstk::Week::week
int week
Full week number.
Definition: Week.hpp:267
Configuration::logstrm
ofstream logstrm
Definition: RinEdit.cpp:415
gnsstk::StringUtils::asDouble
double asDouble(const std::string &s)
Definition: StringUtils.hpp:705
gnsstk::END_OF_TIME
const Epoch END_OF_TIME(CommonTime::END_OF_TIME)
Latest Representable Epoch.
GNSSTK_RETHROW
#define GNSSTK_RETHROW(exc)
Definition: Exception.hpp:369
Configuration::endTime
CommonTime endTime
Definition: RinEdit.cpp:397
gnsstk::Rinex3ObsStream
Definition: Rinex3ObsStream.hpp:65
gnsstk::Rinex3ObsHeader::recType
std::string recType
receiver type
Definition: Rinex3ObsHeader.hpp:505
example3.data
data
Definition: example3.py:22
Configuration::msg
string msg
Definition: RinEdit.cpp:414
gnsstk::Rinex3ObsHeader::observer
std::string observer
who collected the data
Definition: Rinex3ObsHeader.hpp:502
Configuration::gpsfmt
static const string gpsfmt
Definition: RinEdit.cpp:416
Configuration::messHDda
bool messHDda
Definition: RinEdit.cpp:407
EditCmdLessThan::operator()
bool operator()(const EditCmd &ec1, const EditCmd &ec2)
Definition: RinEdit.cpp:335
gnsstk::CivilTime
Definition: CivilTime.hpp:55
processOneEpoch
int processOneEpoch(Rinex3ObsHeader &Rhead, Rinex3ObsHeader &RHout, Rinex3ObsData &Rdata, Rinex3ObsData &RDout)
Definition: RinEdit.cpp:899
LOG
#define LOG(level)
define the macro that is used to write to the log stream
Definition: logstream.hpp:315
Configuration
Definition: RinEdit.cpp:342
EditCmd::sat
RinexSatID sat
Definition: RinEdit.cpp:302
gnsstk::Rinex3ObsHeader::agency
std::string agency
observer's agency
Definition: Rinex3ObsHeader.hpp:503
Configuration::opts
CommandLine opts
Definition: RinEdit.cpp:382
gnsstk::Rinex3ObsHeader::fileProgram
std::string fileProgram
program used to generate file
Definition: Rinex3ObsHeader.hpp:491
gnsstk::RinexSatID::toString
std::string toString() const noexcept
Definition: RinexSatID.cpp:204
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
Configuration::messHDt
string messHDt
Definition: RinEdit.cpp:408
gnsstk::Rinex3ObsHeader::antType
std::string antType
antenna type
Definition: Rinex3ObsHeader.hpp:508
gnsstk::RinexSatID
Definition: RinexSatID.hpp:63
std
Definition: Angle.hpp:142
Configuration::InObspath
string InObspath
Definition: RinEdit.cpp:392
gnsstk::Rinex3ObsHeader::recVers
std::string recVers
receiver version
Definition: Rinex3ObsHeader.hpp:506
gnsstk::INFO
@ INFO
Definition: logstream.hpp:57
EditCmd::obs
RinexObsID obs
Definition: RinEdit.cpp:303
EditCmd::EditCmd
EditCmd(void)
Definition: RinEdit.cpp:310
Configuration::buildCommandLine
string buildCommandLine(void)
Definition: RinEdit.cpp:1297
gnsstk::Epoch
Definition: Epoch.hpp:123
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition: Exception.hpp:366
gnsstk::DEBUG
@ DEBUG
Definition: logstream.hpp:57
EditCmd::slCT
@ slCT
Definition: RinEdit.cpp:294
gnsstk::CommandLine
list of Options
Definition: CommandLine.hpp:63
gnsstk::Rinex3ObsHeader::antennaPosition
gnsstk::Triple antennaPosition
APPROX POSITION XYZ.
Definition: Rinex3ObsHeader.hpp:509
main
int main(int argc, char **argv)
Definition: RinEdit.cpp:451
Configuration::Title
string Title
Definition: RinEdit.cpp:384
gnsstk::Rinex3ObsHeader::markerNumber
std::string markerNumber
MARKER NUMBER.
Definition: Rinex3ObsHeader.hpp:500
EditCmd::isValid
bool isValid(void)
is it valid?
Definition: RinEdit.cpp:321
gnsstk::StringUtils::isScientificString
bool isScientificString(const std::string &s)
Definition: StringUtils.hpp:1908
gnsstk::Rinex3ObsHeader::antennaDeltaHEN
gnsstk::Triple antennaDeltaHEN
ANTENNA: DELTA H/E/N.
Definition: Rinex3ObsHeader.hpp:510
Configuration::vecCmds
vector< EditCmd > vecCmds
Definition: RinEdit.cpp:419
gnsstk::TimeTag::getTimeSystem
TimeSystem getTimeSystem() const
Obtain time system info (enum).
Definition: TimeTag.hpp:169
gnsstk::StringUtils::isDigitString
bool isDigitString(const std::string &s)
Definition: StringUtils.hpp:1871
Configuration::messHDx
string messHDx
Definition: RinEdit.cpp:408
EditCmd::ssCT
@ ssCT
Definition: RinEdit.cpp:293
EditCmd::asString
string asString(string msg=string())
Definition: RinEdit.cpp:1730
gnsstk::RinexSatID::systemChar
char systemChar() const noexcept
Definition: RinexSatID.cpp:62
Configuration::extraProcessing
int extraProcessing(string &errors, string &extras)
Definition: RinEdit.cpp:1475
gnsstk::Rinex3ObsHeader::firstObs
CivilTime firstObs
TIME OF FIRST OBS.
Definition: Rinex3ObsHeader.hpp:524
docstring_generator.help
help
Definition: docstring_generator.py:98
Configuration::messHDo
string messHDo
Definition: RinEdit.cpp:408


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