5 #include <radarlib/radar.hpp>
11 #include <tclap/CmdLine.h>
16 using namespace volume;
17 namespace odim = OdimH5v21;
19 int main(
int argc,
char* argv[])
21 TCLAP::CmdLine cmd(
"stat_CleanID ",
' ',
"0.1" );
23 TCLAP::UnlabeledValueArg<std::string> cmd_vol_input(
"h5_volume_input",
"hdf5 volume input",
true,
"NULL",
"h5-volume-output");
24 cmd.add(cmd_vol_input);
26 TCLAP::UnlabeledValueArg<std::string> cmd_vol_output(
"h5_volume_output",
"hdf5 volume output",
true,
"NULL",
"h5-volume-output");
27 cmd.add(cmd_vol_output);
29 TCLAP::UnlabeledValueArg<std::string> cmd_radar(
"radar_name",
"radar name",
true,
"NULL",
"radar-name");
32 TCLAP::ValueArg<std::string> cmd_fuzzy_path(
"F",
"fuzzy-path",
"Set path of fuzzy logic files",
false, FUZZY_PATH,
"path");
33 cmd.add(cmd_fuzzy_path);
35 TCLAP::SwitchArg cmd_use_undetect(
"U",
"use-undetect",
"Use undetect TODO",
false);
36 cmd.add(cmd_use_undetect);
40 const char* fuzzy_path = cmd_fuzzy_path.getValue().c_str();
41 cout<<
"fuzzypath="<<fuzzy_path<<
" "<<endl;
54 full_volume_cleanID.
quantity=
"ClassID";
55 full_volume_diffprob.
quantity=
"Diffprob";
60 string radar_name = cmd_radar.getValue();
61 bool init_sqi =
false;
84 loader_all.
load(cmd_vol_input.getValue());
86 if( !full_volume_wrad.empty() && !full_volume_vrad.empty()){
88 unsigned last = full_volume_z.size() -1;
89 cout<<
"last="<<last<<endl;
91 if (full_volume_zdr.empty()){
100 cout<<
"full volume zdr size = "<<full_volume_zdr.size()<<
" and z size "<<full_volume_z.size()<<endl;
101 cout<<
"is zdr="<<is_zdr<<endl;
102 for (
unsigned i=0; i<full_volume_z.size();++i){
104 cout<<
"elev="<<full_volume_z.at(i).elevation<<endl;
105 full_volume_cleanID.
append_scan(full_volume_z.at(i).beam_count,full_volume_z.at(i).beam_size,full_volume_z.at(i).elevation, full_volume_z.at(i).cell_size, 0);
106 full_volume_diffprob.
append_scan(full_volume_z.at(i).beam_count,full_volume_z.at(i).beam_size,full_volume_z.at(i).elevation, full_volume_z.at(i).cell_size);
108 full_volume_sqi.
append_scan(full_volume_z.at(i).beam_count,full_volume_z.at(i).beam_size,full_volume_z.at(i).elevation, full_volume_z.at(i).cell_size);
109 full_volume_sqi.at(i).setZero();
118 Input.push_back(full_volume_z.at(i));
119 Input2.push_back(full_volume_z.at(i+1));
120 radarelab::volume::textureVD(Input, Input2, Texture,
true);
121 Texture.at(0).nodata=65535.;
122 Texture.at(0).undetect=0.;
123 Texture.at(0).gain=200./65535.;
124 Texture.at(0).
offset=-100.;
126 cout<<
"it="<<i<<
", Texture size = "<<Texture.size()<<
" "<<Texture.at(0).size()<<endl;
133 Texture.
append_scan(full_volume_z.at(i).beam_count,full_volume_z.at(i).beam_size,full_volume_z.at(i).elevation, full_volume_z.at(i).cell_size);
134 Texture.at(0).setZero();
135 Texture.at(0).nodata=65535.;
136 Texture.at(0).undetect=0.;
137 Texture.at(0).gain=200./65535.;
138 Texture.at(0).
offset=-100.;
139 cout<<
"it="<<i<<
", Texture size = "<<Texture.size()<<
" "<<Texture.at(0).size()<<endl;
144 radarelab::algo::Cleaner::evaluateClassID(full_volume_z.at(i), full_volume_wrad.at(i), full_volume_vrad.at(i), full_volume_zdr.at(i), full_volume_rohv.at(i), full_volume_sqi.at(i), full_volume_snr.at(i), Texture.at(0), full_volume_cleanID.at(i), full_volume_diffprob.at(i), full_volume_vrad.at(i).undetect , radar_name, fuzzy_path, i,
true);
149 radarelab::algo::Cleaner::evaluateClassID(full_volume_z.at(i), full_volume_wrad.at(i), full_volume_vrad.at(i), full_volume_cleanID.at(i), full_volume_vrad.at(i).undetect, radar_name, fuzzy_path, i);
153 double new_value=full_volume_z.at(last).nodata;
154 if (cmd_use_undetect.getValue()) new_value=full_volume_z.at(last).undetect;
155 cout<<
"novalue"<<new_value<<endl;
156 for (
unsigned ii = 0; ii < full_volume_z.at(i).beam_count; ++ii)
157 for (
unsigned ib = 0; ib < full_volume_z.at(i).beam_size; ++ib) {
159 if(full_volume_cleanID.at(i)(ii,ib) )
160 full_volume_z.at(i)(ii,ib)= new_value;
165 z_cur.push_back(full_volume_z.at(i));
166 textureSD(z_cur,sdz6,6000.,
false);
167 sdz6.at(0).nodata=65535.;
168 sdz6.at(0).undetect=0.;
169 SDZ6.push_back(sdz6.at(0));
176 std::cout<<
"Finito Cleaner, salvo risultati"<<std::endl;
177 volume::ODIMStorer storer;
179 cout<<
"replaced quantity"<<endl;
181 cout<<
"stored quantity"<<endl;
183 cout<<
"stored_quantity_uchar"<<endl;
184 storer.store_quantity_fp((
Volume<double>*)(&full_volume_diffprob));
185 cout<<
"stored quantity"<<endl;
186 storer.store(cmd_vol_output.getValue());
187 cout<<endl<<
"Fine"<<endl;
PolarScan< T > & append_scan(unsigned beam_count, unsigned beam_size, double elevation, double cell_size, const T &default_value=algo::DBZ::BYTEtoDB(1))
Append a scan to this volume.
std::string quantity
Odim quantity name.
Codice per il caricamento di volumi ODIM in radarelab.
void request_quantity(const std::string &name, Scans< double > *volume)
Define a request - Fill to_load attribute
void load(const std::string &pathname)
Load method.
Struttura che eredita da Loader e definisce i metodi per accedere ai dati ODIM.
Definisce le principali strutture che contengono i dati.