Elaboradar  0.1

◆ clean_beam() [1/3]

std::vector< bool > radarelab::algo::Cleaner::clean_beam ( const Eigen::VectorXd &  beam_z,
const Eigen::VectorXd &  beam_w,
const Eigen::VectorXd &  beam_v,
const Eigen::VectorXd &  beam_sd,
const Eigen::VectorXd &  beam_sdzdr,
PolarScan< double > &  scan_z,
PolarScan< double > &  scan_w,
PolarScan< double > &  scan_v,
PolarScan< double > &  SD,
int  iray 
) const

Funzione per ripulire raggio.

Utilizza (sigmaV, V, dev.std Z, dev.std. ZDR)

Parametri
[in]beam_z- raggio DBZH
[in]beam_w- raggio WRAD
[in]beam_v- raggio VRAD
[in]beam_sd- raggio deviazione standard DBZH
[in]beam_sdzdr-raggio deviazione standard ZDR
[in]scan_z- per debug
[in]scan_w- per debug
[in]scan_v- per debug
[in]SD- per debug
[in]iray- index of the ray per debug
Restituisce
raggio di flag per correzione

Definizione alla linea 175 del file cleaner.cpp.

176 {
177  const unsigned beam_size = beam_z.rows();
178  vector<bool> res(beam_size, false);
179  bool in_a_segment = false;
180  unsigned start = 0, end;
181  unsigned segment_length;
182  bool before, after;
183  unsigned counter = 0;
184  unsigned counter_trash = 0;
185  unsigned counter_clutter =0;
186  for (unsigned ibin = 0; ibin < beam_size; ++ibin)
187  {
188  bool is_clutter = false;
189  bool is_trash = false;
190  unsigned flag = 0 ;
191 // In our systems (ARPA ER) interferences and other non meteo echo are characterised by the following steps
192 //
193 // 1) Wind is not defined ad spectrumWidth is 0. with Z defined.
194  if ( beam_w(ibin) == W_threshold && beam_v(ibin) == bin_wind_magic_number && beam_z (ibin) != Z_missing ) {
195 // 2) Std<Dev of ZDR coulb be close to 0
196  if( beam_sdzdr(ibin) <= 0.01 ){
197  is_trash = true;
198  flag=2;
199  } else {
200  if (beam_z (ibin) >= 45. ){
201 // 2) inside thunderstorms (Z > 45) StdDev of Zdr and StdDev of Z are quite high)
202  if ((ibin >100 && double(counter_trash)/double(ibin) >=0.5 && ( beam_sdzdr(ibin) >1 || beam_sd (ibin) > 5. )) ||
203  (beam_sdzdr(ibin) >4.0 && beam_sd (ibin) > 20.) ) {
204  is_trash = true;
205  flag=2;
206  } else {
207  is_trash = false;
208  flag=0;
209  }
210  } else if ( (ibin >100 && double(counter_trash)/double(ibin) >=0.5 && ( beam_sdzdr(ibin) >1 || beam_sd (ibin) > 5. )) ||
211  (beam_sd (ibin) >2. && (beam_sdzdr(ibin) >2.0 || beam_sd (ibin) > 10. )) ) {
212 // 2) outside thunderstorms (Z > 45) StdDev of Zdr and StdDev of Z are lower
213  is_trash = true;
214  flag=2;
215  }
216  }
217  } else {
218 // 3) Clutter is characterised by low value of VRAD and WRAD
219  if ((beam_w(ibin) * fabs(beam_v(ibin))) <= 0.25 && beam_z (ibin) != Z_missing ) {
220  is_clutter = true;
221  flag = 1;
222  }
223  }
224  if( is_clutter) counter_clutter ++;
225  if( is_trash ) counter_trash ++;
226  //if(ibin <40 && false){
227  //printf(" %4d %4d %6.2f %6.2f %10.6f %6.2f %6.2f ",iray,ibin , beam_z(ibin),beam_v(ibin),beam_w(ibin), beam_sd(ibin),beam_sdzdr(ibin));
228  //printf(" ----- %2x %2x %2x %2x ",(unsigned char)((beam_z(ibin)-scan_z.offset)/scan_z.gain/256),
229  //(unsigned char)((beam_v(ibin)-scan_v.offset)/scan_v.gain/256),
230  //(unsigned char)((beam_w(ibin)-scan_w.offset)/scan_w.gain/256),
231  //(unsigned char)((beam_sd(ibin)-SD.offset)/SD.gain/256));
232  //}
233  if (!in_a_segment)
234  {
235  /* cerco la prima cella segmento da pulire*/
236  if ( is_clutter || is_trash )
237  {
238 // if(ibin <40)printf(" %1d ----- START SEGMENT ------",flag);
239  in_a_segment = true;
240  start = ibin;
241  after = false;
242  before = false;
243  }
244 // else if(ibin <40)printf(" %1d ",flag);
245  } else {
246  /* cerco la fine segmento da pulire*/
247  if ( ! (is_clutter || is_trash ) || ibin == (beam_size - 1))
248  {
249  in_a_segment = false;
250  end = ibin - 1;
251  if (ibin == (beam_size - 1)) end = ibin; // caso particolare per fine raggio
252  /* Fine trovata ora procedo alla pulizia eventuale */
253  segment_length = end - start+1;
254  counter = counter + (unsigned)(segment_length);
255 
256 /* il segmento è corto allora cerco nei dintorni dei dati validi, se li trovo non pulisco */
257  if (segment_length <= 2*min_segment_length ){
258  /* Cerco dati validi in Z prima del segmento */
259  int count=0;
260  for (int ib = ibin - 2*min_segment_length; ib < (signed)ibin; ++ib)
261  if (ib >= 0 && (beam_z(ib) > Z_missing && beam_w(ib) != W_threshold && ( beam_w(ib) > 0.5 || fabs(beam_v(ib)) > 0.5) ) )
262  count++;
263  if (double(count)/double(min(int(ibin),int(2*min_segment_length))) >=0.25) before = true;
264 
265  /* Cerco dati validi in Z dopo il segmento */
266  count = 0;
267  for (unsigned ia = ibin + 1; ia <= ibin + 2*min_segment_length; ++ia)
268  if (ia < beam_size && (beam_z(ia) > Z_missing && (beam_w(ia) != W_threshold && ( beam_w(ia) > 0.5 || fabs(beam_v(ia)) > 0.5)) ))
269  count ++;
270  if (double(count)/double(min(int(beam_size - ibin),int(2*min_segment_length))) >=0.25) after = true;
271  }
272 // if(ibin <40)printf(" %1d ----- STOP SEGMENT ------ %4d -- %4d before %d after %d ",flag, segment_length,counter, before,after);
273  if ((segment_length >= min_segment_length && (!before || !after) ) || segment_length >= max_segment_length)
274  // if ((segment_length >= min_segment_length ) || segment_length >= max_segment_length)
275  {
276  /* qui pulisco */
277 // if(ibin <40)printf (" pulisco %d %d %d \n",segment_length, min_segment_length, max_segment_length);
278  for (unsigned ib = start; ib <= end; ++ib)
279  res[ib] = true;
280  }
281  }
282 // else if(ibin <40)printf(" %1d ",flag);
283 
284  }
285 // if(ibin <40)printf(" %4d %4d \n",counter_clutter,counter_trash);
286  }
287  return res;
288 }
const double Z_missing
Valore dato mancante DBZH.
Definition: cleaner.h:26
const double bin_wind_magic_number
valore magico per dati in formato SP20
Definition: cleaner.h:29
const unsigned max_segment_length
lunghezza massima segmento in celle se più lungo pulisce in ogni caso
Definition: cleaner.h:24
const double W_threshold
Soglia per WRAD.
Definition: cleaner.h:27
const unsigned min_segment_length
lunghezza minima segmento in celle
Definition: cleaner.h:23