Elaboradar  0.1
 Tutto Classi Namespace File Funzioni Variabili Tipi enumerati (enum) Gruppi
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 169 del file cleaner.cpp.

Referenzia radarelab::PolarScan< T >::gain, e radarelab::PolarScan< T >::offset.

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