12extern bool check_undetect;
23inline bool good(
const PolarScan<T>& scan,
unsigned row,
unsigned col)
26 if(scan(row,col)!=scan.nodata&&scan(row,col)!=scan.undetect)
30 if(scan(row,col)!=scan.nodata)
46 unsigned half_win=0.5*(win-1);
50 for(
unsigned i=0;i<raw.rows();i++)
53 for(
unsigned j=0;j<half_win+1;j++)
55 fit.feed(0*raw.cell_size,raw(i,j));
56 scan.set(i,0,fit.compute_slope());
57 if(scan(i,0)!=scan(i,0)) scan.set(i,0,raw.nodata);
59 for(
unsigned j=1;j<raw.beam_size;j++)
65 fit.slim(pre*raw.cell_size,raw(i,pre));
66 if(post<raw.beam_size)
68 fit.feed(post*raw.cell_size,raw(i,post));
69 scan.set(i,j,fit.compute_slope());
70 if(scan(i,j)!=scan(i,j)) scan.set(i,j,raw.nodata);
86 unsigned half_len=0.5*(len-1);
87 unsigned half_wid=0.5*(wid-1);
92 for(
unsigned i=0;i<raw.rows();i++)
95 for(
unsigned j=0;j<half_len+1;j++)
97 if(good(raw,i,j)) rms.feed(raw(i,j));
98 for(
unsigned k=1;k<=half_wid;k++)
103 pre_w=raw.beam_count+pre_w;
104 if(post_w>=raw.beam_count)
105 post_w=post_w-raw.beam_count;
106 if(good(raw,pre_w,j))
107 rms.feed(raw(pre_w,j));
108 if(good(raw,post_w,j))
109 rms.feed(raw(post_w,j));
112 scan.set(i,0,rms.compute_dev_std());
113 if(scan(i,0)!=scan(i,0)) scan.set(i,0,raw.nodata);
114 for(
unsigned j=1;j<raw.beam_size;j++)
120 if(good(raw,i,pre_l))
121 rms.slim(raw(i,pre_l));
122 for(
unsigned k=1;k<=half_wid;k++)
127 pre_w=raw.beam_count+pre_w;
128 if(post_w>=raw.beam_count)
129 post_w=post_w-raw.beam_count;
130 if(good(raw,pre_w,pre_l))
131 rms.slim(raw(pre_w,pre_l));
132 if(good(raw,post_w,pre_l))
133 rms.slim(raw(post_w,pre_l));
136 if(post_l<raw.beam_size)
138 if(good(raw,i,post_l))
139 rms.feed(raw(i,post_l));
140 for(
unsigned k=1;k<=half_wid;k++)
145 pre_w=raw.beam_count+pre_w;
146 if(post_w>=raw.beam_count)
147 post_w=post_w-raw.beam_count;
148 if(good(raw,pre_w,post_l))
149 rms.feed(raw(pre_w,post_l));
150 if(good(raw,post_w,post_l))
151 rms.feed(raw(post_w,post_l));
154 scan.set(i,j,rms.compute_dev_std());
155 if(scan(i,j)!=scan(i,j)) scan.set(i,j,raw.nodata);
171 unsigned half_len=0.5*(len-1);
172 unsigned half_wid=0.5*(wid-1);
177 for(
unsigned i=0;i<raw.rows();i++)
180 for(
unsigned j=0;j<half_len+1;j++)
182 if(good(raw,i,j)) filter.feed(raw(i,j));
183 for(
unsigned k=1;k<=half_wid;k++)
188 pre_w=raw.beam_count+pre_w;
189 if(post_w>=raw.beam_count)
190 post_w=post_w-raw.beam_count;
191 if(good(raw,pre_w,j))
192 filter.feed(raw(pre_w,j));
193 if(good(raw,post_w,j))
194 filter.feed(raw(post_w,j));
197 scan.set(i,0,filter.compute_mean());
198 if(scan(i,0)!=scan(i,0)) scan.set(i,0,raw.nodata);
199 for(
unsigned j=1;j<raw.beam_size;j++)
205 if(good(raw,i,pre_l))
206 filter.slim(raw(i,pre_l));
207 for(
unsigned k=1;k<=half_wid;k++)
212 pre_w=raw.beam_count+pre_w;
213 if(post_w>=raw.beam_count)
214 post_w=post_w-raw.beam_count;
215 if(good(raw,pre_w,pre_l))
216 filter.slim(raw(pre_w,pre_l));
217 if(good(raw,post_w,pre_l))
218 filter.slim(raw(post_w,pre_l));
221 if(post_l<raw.beam_size)
223 if(good(raw,i,post_l))
224 filter.feed(raw(i,post_l));
225 for(
unsigned k=1;k<=half_wid;k++)
230 pre_w=raw.beam_count+pre_w;
231 if(post_w>=raw.beam_count)
232 post_w=post_w-raw.beam_count;
233 if(good(raw,pre_w,post_l))
234 filter.feed(raw(pre_w,post_l));
235 if(good(raw,post_w,post_l))
236 filter.feed(raw(post_w,post_l));
239 scan.set(i,j,filter.compute_mean());
240 if(scan(i,j)!=scan(i,j)) scan.set(i,j,raw.nodata);
257 for(
unsigned rg=0;rg<raw.beam_size;rg++)
260 if(good(raw,raw.beam_count-1,rg) && good(raw,0,rg))
261 scan(0,rg) = raw(raw.beam_count-1,rg)-raw(0,rg);
262 else scan(0,rg) = 0.;
264 for(
unsigned az=1;az<raw.beam_count;az++)
265 for(
unsigned rg=0;rg<raw.beam_size;rg++)
268 if(good(raw,az-1,rg) && good(raw,az,rg) )
269 scan(az,rg) = raw(az-1,rg)-raw(az,rg);
270 else scan(az,rg) = 0.;
272 scan*=(0.5*raw.beam_count/M_PI);
287 for(
unsigned az=0;az<up.beam_count;az++)
288 for(
unsigned rg=0;rg<up.beam_size;rg++)
290 if(good(up,az,rg) && good(low,az,rg))
291 scan(az,rg) = up(az,rg)-low(az,rg);
292 else scan(az,rg) = 0.;
294 scan*=abs(up.elevation-low.elevation)*M_PI/180.;
310void moving_average_slope(
const Volume<T>& raw, Volume<T>& vol,
double slope_range,
bool force_check_undetect=
false)
312 unsigned window_size;
314 check_undetect=force_check_undetect;
316 for(
unsigned i=0;i<raw.size();i++)
318 window_size=1+2*std::floor(0.5*slope_range/raw[i].cell_size);
319 vol.push_back(make_slope_scan(raw[i],window_size));
331void textureSD(
const Scans<T>& raw,
Scans<T>& vol,
double filter_range,
bool force_check_undetect=
false)
333 textureSD(raw,vol,filter_range,0.,force_check_undetect);
345void textureSD(
const Scans<T>& raw,
Scans<T>& vol,
double filter_range,
double filter_azimuth=0. ,
bool force_check_undetect=
false)
347 unsigned window_length;
348 unsigned window_width;
350 check_undetect=force_check_undetect;
351 vol.quantity=raw.quantity;
353 for(
unsigned i=0;i<raw.size();i++)
355 window_length=1+2*std::floor(0.5*filter_range/raw[i].cell_size);
356 window_width=1+2*std::floor(0.5*filter_azimuth/(360./raw[i].beam_count));
357 vol.push_back(make_rms_scan(raw[i], window_length, window_width));
365 check_undetect=force_check_undetect;
366 vol.quantity=raw1.quantity;
367 vol.units=raw1.units;
372 for(
unsigned i=0;i<raw1.size();i++)
374 PolarScan<T> scan(raw1[i]);
375 for(
unsigned j=0;j<raw1[i].rows();++j){
376 for(
unsigned k=0;k<raw1[i].cols();++k){
377 if((k<raw2[i].beam_size)&&(good(raw2[i],j,k))&&(good(raw1[i],j,k))){
378 scan.set(j,k,raw2[i](j,k)-raw1[i](j,k));
380 if(scan(j,k)!=scan(j,k)) scan.set(j,k,raw2[i].nodata);
395void filter(
const Volume<T>& raw, Volume<T>& vol,
double filter_range,
bool force_check_undetect=
false)
397 filter(raw,vol,filter_range,0.,force_check_undetect);
409void filter(
const Volume<T>& raw, Volume<T>& vol,
double filter_range,
double filter_azimuth=0.,
bool force_check_undetect=
false)
411 unsigned window_length;
412 unsigned window_width;
414 check_undetect=force_check_undetect;
415 vol.quantity=raw.quantity;
417 for(
unsigned i=0;i<raw.size();i++)
419 window_length=1+2*std::floor(0.5*filter_range/raw[i].cell_size);
420 window_width=1+2*std::floor(0.5*filter_azimuth/(360./raw[i].beam_count));
421 vol.push_back(make_filter_scan(raw[i], window_length, window_width));
431void gradient_azimuth(
const Volume<T>& raw, Volume<T>& vol,
bool force_check_undetect=
false)
434 check_undetect=force_check_undetect;
435 vol.quantity=raw.quantity;
437 for(
unsigned el=0;el<raw.size();el++)
438 vol.push_back(make_gradient_azimuth_scan(raw[el]));
447void gradient_elevation(
const Volume<T>& raw, Volume<T>& vol,
bool force_check_undetect=
false)
450 check_undetect=force_check_undetect;
451 vol.quantity=raw.quantity;
453 vol.push_back(make_gradient_elevation_scan(raw[1],raw[0]));
454 for(
unsigned el=1;el<raw.size();el++)
455 vol.push_back(make_gradient_elevation_scan(raw[el-1],raw[el]));
464void lin2dB(Volume<T>& lin, Volume<T>& dB)
468 for(
unsigned i=0;i<lin.size();i++)
470 dB.push_back(PolarScan<T>(lin[i].beam_count,lin[i].beam_size,0.));
471 dB[i].cell_size = lin[i].cell_size;
472 dB[i].elevation = lin[i].elevation;
473 dB[i].block(0,0,lin[i].beam_count,lin[i].beam_size)=lin[i].log10();
484void dB2lin(Volume<T>& dB, Volume<T>& lin)
488 for(
unsigned i=0;i<dB.size();i++)
490 lin.push_back(PolarScan<T>(dB[i].beam_count,dB[i].beam_size,0.));
491 lin[i].cell_size = dB[i].cell_size;
492 lin[i].elevation = dB[i].elevation;
493 lin[i].block(0,0,dB[i].beam_count,dB[i].beam_size) = dB[i]*0.1;
494 lin[i].block(0,0,dB[i].beam_count,dB[i].beam_size) = lin[i].exp10();
503void lin2dB(Volume<T>& lin)
506 for(
unsigned i=0;i<lin.size();i++)
507 lin[i].block(0,0,lin[i].beam_count,lin[i].beam_size)=lin[i].log10();
516void dB2lin(Volume<T>& dB)
520 for(
unsigned i=0;i<dB.size();i++)
521 dB[i].block(0,0,dB[i].beam_count,dB[i].beam_size) = dB.scan(i).exp10();
PolarScan - structure to describe a polarScan containing a matrix of data and conversion factors.
Generic Class to perform statistical analysis Statistic object could be used as accumulator of data a...
Sequence of PolarScans which can have a different beam count for each elevation.
Namespace per volume dati.
Class to manage statistical information about streamed data.
Definisce le principali strutture che contengono i dati.