5#include <radarlib/radar.hpp>
11#include <tclap/CmdLine.h>
16using namespace volume;
17namespace odim = OdimH5v21;
19int 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::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");
30 cmd.add(cmd_fuzzy_path);
32 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);
33 cmd.add(cmd_use_undetect);
37 const char* fuzzy_path = cmd_fuzzy_path.getValue().c_str();
38 cout<<
"fuzzypath="<<fuzzy_path<<
" "<<endl;
51 full_volume_cleanID.
quantity=
"ClassID";
52 full_volume_diffprob.
quantity=
"Diffprob";
56 bool init_sqi =
false;
69 loader_all.
load(cmd_vol_input.getValue());
70 string radar_name = full_volume_z.
load_info->source_name;
71 radar_name = radar_name.substr(2);
72 transform(radar_name.begin(), radar_name.end(), radar_name.begin(),::toupper);
75 if( !full_volume_wrad.empty() && !full_volume_vrad.empty()){
77 unsigned last = full_volume_z.size() -1;
78 cout<<
"last="<<last<<endl;
80 if (full_volume_zdr.empty()){
83 if(full_volume_sqi.empty()){
86 cout<<
"full volume zdr size = "<<full_volume_zdr.size()<<
" and z size "<<full_volume_z.size()<<endl;
87 cout<<
"is zdr="<<is_zdr<<endl;
88 for (
unsigned i=0; i<full_volume_z.size();++i){
90 cout<<
"elev="<<full_volume_z.at(i).elevation<<endl;
91 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);
92 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);
94 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);
95 full_volume_sqi.at(i).setZero();
104 Input.push_back(full_volume_z.at(i));
105 Input2.push_back(full_volume_z.at(i+1));
106 radarelab::volume::textureVD(Input, Input2, Texture,
true);
107 Texture.at(0).nodata=65535.;
108 Texture.at(0).undetect=0.;
109 Texture.at(0).gain=200./65535.;
110 Texture.at(0).
offset=-100.;
112 cout<<
"it="<<i<<
", Texture size = "<<Texture.size()<<
" "<<Texture.at(0).size()<<endl;
119 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);
120 Texture.at(0).setZero();
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.;
125 cout<<
"it="<<i<<
", Texture size = "<<Texture.size()<<
" "<<Texture.at(0).size()<<endl;
130 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);
135 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);
139 double new_value=full_volume_z.at(last).nodata;
140 if (cmd_use_undetect.getValue()) new_value=full_volume_z.at(last).undetect;
141 cout<<
"novalue"<<new_value<<endl;
142 for (
unsigned ii = 0; ii < full_volume_z.at(i).beam_count; ++ii)
143 for (
unsigned ib = 0; ib < full_volume_z.at(i).beam_size; ++ib) {
145 if(full_volume_cleanID.at(i)(ii,ib) )
146 full_volume_z.at(i)(ii,ib)= new_value;
151 z_cur.push_back(full_volume_z.at(i));
152 textureSD(z_cur,sdz6,6000.,
false);
153 sdz6.at(0).nodata=65535.;
154 sdz6.at(0).undetect=0.;
155 SDZ6.push_back(sdz6.at(0));
162 std::cout<<
"Finito Cleaner, salvo risultati"<<std::endl;
163 volume::ODIMStorer storer;
165 cout<<
"replaced quantity"<<endl;
167 cout<<
"stored quantity"<<endl;
169 cout<<
"stored_quantity_uchar"<<endl;
170 storer.store_quantity_fp((
Volume<double>*)(&full_volume_diffprob));
171 cout<<
"stored quantity"<<endl;
172 storer.store(cmd_vol_output.getValue());
173 cout<<endl<<
"Fine"<<endl;
Homogeneous volume with a common beam count for all PolarScans.
std::string quantity
Odim quantity name.
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::shared_ptr< LoadInfo > load_info
Polar volume information.
Sequence of PolarScans which can have a different beam count for each elevation.
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.