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(
"RunCleanID ",
' ',
"0.1" );
23 TCLAP::UnlabeledValueArg<std::string> cmd_vol_input(
"h5_volume_input",
"input hdf5 volume",
true,
"NULL",
"h5-volume-output");
24 cmd.add(cmd_vol_input);
26 TCLAP::UnlabeledValueArg<std::string> cmd_vol_output(
"h5_volume_output",
"post-processed overwritten input hdf5 volume",
true,
"NULL",
"h5-volume-output");
27 cmd.add(cmd_vol_output);
29 TCLAP::UnlabeledValueArg<std::string> cmd_radar(
"radar_name",
"radar name (SPC or GAT)",
true,
"NULL",
"radar-name");
32 TCLAP::ValueArg<std::string> cmd_fuzzy_path(
"F",
"fuzzy-path",
"Optional: Set path of fuzzy logic files and clutter maps. \n Default: /usr/share/elaboradar ",
false, FUZZY_PATH,
"path");
33 cmd.add(cmd_fuzzy_path);
35 TCLAP::SwitchArg cmd_use_undetect(
"U",
"use-undetect",
"Optional: Use undetect value (-31.15 dBZ) as DBZH replacing value for pixels classified as non meteorological echo. \nIf not passed, nodata value is used instead (99.95 dBZ)",
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;
74 loader_all.
load(cmd_vol_input.getValue());
76 if( !full_volume_wrad.empty() && !full_volume_vrad.empty()){
78 unsigned last = full_volume_z.size() -1;
79 cout<<
"last="<<last<<endl;
81 if (full_volume_zdr.empty()){
84 if(full_volume_sqi.empty()){
87 cout<<
"full volume zdr size = "<<full_volume_zdr.size()<<
" and z size "<<full_volume_z.size()<<endl;
88 cout<<
"is zdr="<<is_zdr<<endl;
89 for (
unsigned i=0; i<full_volume_z.size();++i){
91 cout<<
"elev="<<full_volume_z.at(i).elevation<<endl;
92 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);
93 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);
95 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);
96 full_volume_sqi.at(i).setZero();
105 Input.push_back(full_volume_z.at(i));
106 Input2.push_back(full_volume_z.at(i+1));
107 radarelab::volume::textureVD(Input, Input2, Texture,
true);
108 Texture.at(0).nodata=65535.;
109 Texture.at(0).undetect=0.;
110 Texture.at(0).gain=200./65535.;
111 Texture.at(0).
offset=-100.;
113 cout<<
"it="<<i<<
", Texture size = "<<Texture.size()<<
" "<<Texture.at(0).size()<<endl;
120 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);
121 Texture.at(0).setZero();
122 Texture.at(0).nodata=65535.;
123 Texture.at(0).undetect=0.;
124 Texture.at(0).gain=200./65535.;
125 Texture.at(0).
offset=-100.;
126 cout<<
"it="<<i<<
", Texture size = "<<Texture.size()<<
" "<<Texture.at(0).size()<<endl;
131 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);
136 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);
140 double new_value=full_volume_z.at(last).nodata;
141 if (cmd_use_undetect.getValue()) new_value=full_volume_z.at(last).undetect;
142 cout<<
"novalue"<<new_value<<endl;
143 for (
unsigned ii = 0; ii < full_volume_z.at(i).beam_count; ++ii)
144 for (
unsigned ib = 0; ib < full_volume_z.at(i).beam_size; ++ib) {
146 if(full_volume_cleanID.at(i)(ii,ib) )
147 full_volume_z.at(i)(ii,ib)= new_value;
152 z_cur.push_back(full_volume_z.at(i));
153 textureSD(z_cur,sdz6,6000.,
false);
154 sdz6.at(0).nodata=65535.;
155 sdz6.at(0).undetect=0.;
156 SDZ6.push_back(sdz6.at(0));
163 std::cout<<
"Finito Cleaner, salvo risultati"<<std::endl;
164 volume::ODIMStorer storer;
166 cout<<
"replaced quantity"<<endl;
168 cout<<
"stored quantity"<<endl;
170 cout<<
"stored_quantity_uchar"<<endl;
171 storer.store_quantity_fp((
Volume<double>*)(&full_volume_diffprob));
172 cout<<
"stored quantity"<<endl;
173 storer.store(cmd_vol_output.getValue());
174 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.