Elaboradar  0.1
cum_bac_clparser.cpp
1 /*
2  * =====================================================================================
3  *
4  * Filename: cum_bac_clparser.cpp
5  *
6  * Description:
7  *
8  * Version: 1.0
9  * Created: 26/02/2014 09:12:25
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: YOUR NAME (),
14  * Organization:
15  *
16  * =====================================================================================
17  */
18 #include "cum_bac_clparser.h"
19 #include <iostream>
20 void parseOptions(int argc, char** argv , CUM_BAC_CLOPT *opt)
21 {
22  // CUM_BAC_CLOPT opt;
23  try {
24 
25 
26  TCLAP::CmdLine cmd("CUM_BAC ", ' ', "0.1" );
27  //
28  // Define required arguments
29  //
30 //Filename
31  TCLAP::UnlabeledValueArg<std::string> filename( "FileName", "Name of data file", true, "NULL", "std::string");
32  cmd.add(filename);
33 
34 //file type
35  TCLAP::UnlabeledValueArg<int> filetype("Filetype", "Type of data file", true,9999, "int");
36  cmd.add(filetype);
37 
38 //sito
39  TCLAP::UnlabeledValueArg<std::string> sito("Sito", "Name of radar site", true,"NULL", "std::string");
40  cmd.add(sito);
41 
42  //
43  // Define optional arguments
44  //
45 // TCLAP::SwitchArg Short("S", "ShortPulse", "Use parameters for short pulse", false);
46 // std::vector<TCLAP::Arg*> xorpulse;
47 // xorpulse.push_back(&Short);
48 // xorpulse.push_back(&Medium);
49 // cmd.xorAdd( xorpulse );
50 
51  TCLAP::SwitchArg Stampe("s", "StampeExtra", "Stampe Extra per devel", false);
52  cmd.add(Stampe);
53  TCLAP::SwitchArg VPR("V", "VPR", "Performe VPR correction", false);
54  cmd.add(VPR);
55  TCLAP::SwitchArg Quality("Q", "Quality", "Calculate quality", false);
56  cmd.add(Quality);
57  TCLAP::SwitchArg OdimFormat("O", "Odim", "Data used in ODIM format", false);
58  cmd.add(OdimFormat);
59  TCLAP::SwitchArg Medium("M", "MediumPulse", "Use parameters for medium pulse", false);
60  cmd.add(Medium);
61  TCLAP::SwitchArg StaticMap("m", "UseStaticMap", "Use Static Map", false);
62  cmd.add(StaticMap);
63  TCLAP::SwitchArg Declut("D", "Declut", "Performe only static declutter correction", false);
64  cmd.add(Declut);
65  TCLAP::SwitchArg Class("C", "Class", "Evaluate stratiform-convective classification", false);
66  cmd.add(Class);
67  TCLAP::SwitchArg Clean("c", "Clean", "Performe Interference and second-trip cleaning", false);
68  cmd.add(Clean);
69  TCLAP::SwitchArg BeamBlocking("B", "BeamBlocking", "Performe BeamBlocking correction", false);
70  cmd.add(BeamBlocking);
71  TCLAP::SwitchArg BlocNoCor("b", "BlocNoCor", "Questo non so cosa sia", false);
72  cmd.add(BlocNoCor);
73  TCLAP::SwitchArg Anaprop("A", "Anaprop", "Performe Anaprop identification algorithm", false);
74  cmd.add(Anaprop);
75 
76  TCLAP::SwitchArg IntermediateProd("I", "SaveIntermediateProduct", "Save additional product at intermediate processing level's", false);
77  cmd.add(IntermediateProd);
78  TCLAP::SwitchArg SaveBothRanges("S", "SaveBothRanges", "Save products at both processing ranges (128km ad 256 km)", false);
79  cmd.add(SaveBothRanges);
80  TCLAP::SwitchArg SaveFullResProd("F", "SaveFullResProd", "Save product at fullsize resolution", false);
81  cmd.add(SaveFullResProd);
82 
83  // Pass to the cmdline the set_undetect parameter for read_odim_volume(): if True pixels classified as non-meteo echoes are set to Z undetect value, otherwise are set to Z nodata value.
84  TCLAP::SwitchArg SetUndetect("U", "SetUndetect", "Set non-meteo classified pixel to undetect Z value", false);
85  cmd.add(SetUndetect);
86  TCLAP::UnlabeledValueArg<std::string> FuzzyPath( "FuzzyPath", "Set path of fuzzy logic files", false, FUZZY_PATH, "std:.string");
87  cmd.add(FuzzyPath);
88 
89 
90 
91  //
92  // Parse the command line.
93  //
94  cmd.parse(argc,argv);
95 
96 //
97 // check variables
98 //
99 
100  opt->filename=filename.getValue();
101  opt->filetype=filetype.getValue();
102  opt->sito=sito.getValue();
103 // if (Short.isSet()) opt->do_medium=false;
104  opt->do_medium=Medium.getValue();
105  opt->do_anaprop=Anaprop.getValue();
106  opt->do_quality=Quality.getValue();
107  opt->do_beamblocking=BeamBlocking.getValue();
108  opt->do_declut=Declut.getValue();
109  opt->do_bloccor=BlocNoCor.getValue();
110  opt->do_vpr=VPR.getValue();
111  opt->do_clean=Clean.getValue();
112  opt->do_class=Class.getValue();
113  opt->do_devel=Stampe.getValue();
114  opt->do_readStaticMap=StaticMap.getValue();
115  opt->data_in_odim=OdimFormat.getValue();
116  opt->do_intermediateProd=IntermediateProd.getValue();
117  opt->do_SaveBothRanges=SaveBothRanges.getValue();
118  opt->do_SaveFullRes=SaveFullResProd.getValue();
119  //add value of SetUndetect
120  opt->set_undetect=SetUndetect.getValue();
121  opt->fuzzy_path=FuzzyPath.getValue();
122 
123  } catch ( TCLAP::ArgException& e )
124  { std::cout << "ERROR: " << e.error() << " " << e.argId() << std::endl; }
125 
126  return;
127 }
128 
129 
130 void PrintOptions(struct CUM_BAC_CLOPT *opt){
131 
132  std::cout <<"Filename :"<<opt->filename.c_str()<<std::endl;
133  std::cout <<"Filetype :"<<opt->filetype<<std::endl;
134  std::cout <<"Sito :"<<opt->sito.c_str()<<std::endl;
135  std::cout <<"do_medium :"<<opt->do_medium<<std::endl;
136  std::cout <<"do_quality :"<<opt->do_quality<<std::endl;
137  std::cout <<"do_beamblocking :"<<opt->do_beamblocking<<std::endl;
138  std::cout <<"do_declutter :"<<opt->do_declut<<std::endl;
139  std::cout <<"do_bloccor"<<opt->do_bloccor<<std::endl;
140  std::cout <<"do_vpr"<<opt->do_vpr<<std::endl;
141  std::cout <<"do_clean"<<opt->do_clean<<std::endl;
142  std::cout <<"do_class :"<<opt->do_class<<std::endl;
143  std::cout <<"do_devel :"<<opt->do_devel<<std::endl;
144  std::cout <<"do_readStaticMap"<<opt->do_readStaticMap<<std::endl;
145  std::cout <<"do_intermediateProd"<<opt->do_intermediateProd<<std::endl;
146  std::cout <<"do_SaveBothRanges"<< opt->do_SaveBothRanges <<std::endl;
147  std::cout <<"do_SaveFullRes"<< opt->do_SaveFullRes <<std::endl;
148  std::cout <<"SetUndetect"<< opt->set_undetect <<std::endl;
149  std::cout <<"FuzzyPath"<< opt->fuzzy_path.c_str() <<std::endl;
150 
151  return ;
152 }
153 
154