15#define NUM_AZ_X_PPI 400
48inline std::ostream& operator<<(std::ostream& oss,
EchoClass& ECl)
86 oss<<
"unknown echo type "<<ECl;
106 PROB(
double z,
double zdr,
double rhohv,
double lkdp,
double sdz,
double sdphidp,
double vrad);
112 double f_1(
double Z) {
return -0.05+2.5e-3*Z+7.5e-4*Z*Z;}
116 double f_2(
double Z) {
return 0.68-4.81e-2*Z+2.92e-3*Z*Z;}
120 double f_3(
double Z) {
return 1.42+6.67e-2*Z+4.85e-4*Z*Z;}
124 double g_1(
double Z) {
return -44.0+0.8*Z;}
128 double g_2(
double Z) {
return -22.0+0.5*Z;}
132 double trap(
double x1,
double x2,
double x3,
double x4,
double val);
136 Matrix2D<double> prob_class(
EchoClass classe,
double z,
double zdr,
double rhohv,
double lkdp,
double sdz,
double sdphidp,
double vrad);
156 MLpoints(
double minHeight,
double maxHeight,
unsigned az_count,
unsigned height_count)
158 Hmin(minHeight),
Hmax(maxHeight),
count(0) {}
160 double azimuth_deg(
unsigned az_idx){
return (
double)az_idx*360./(double)this->cols();}
161 double azimuth_rad(
unsigned az_idx){
return (
double)az_idx*2.*M_PI/(double)this->cols();}
162 unsigned rad2idx(
double rad){
return (
unsigned)(rad*(double)this->cols()/(2.*M_PI));}
163 unsigned deg2idx(
double deg){
return (
unsigned)(deg*(double)this->cols()/360.);}
165 double height(
unsigned h_idx){
return Hmin+(double)h_idx*(
Hmax-Hmin)/(double)this->rows();}
166 unsigned h_idx(
double height){
return (
unsigned)((height-Hmin)*(
double)this->rows()/(
Hmax-Hmin));}
168 void box_top_bottom(
double box_width_deg,
double bot_th,
double top_th, std::vector<double>& ML_b, std::vector<double>& ML_t);
187 *
this<<1.,1.,1.,1.,1.,1.;
190 CONF(
double phidp,
double rhohv,
double snr,
191 double gradphitheta,
double gradphiphi,
double gradZtheta,
double gradZphi,
double gradZdrtheta,
double gradZdrphi,
192 double omega=0.9,
double alpha=0.)
195 double phidpZdr=250.;
196 double delphidpt=10.;
197 double delrhohv1=0.2;
198 double delrhohv2=0.1;
199 double delZdrt=std::pow(10.,0.005);
202 double snrZdr=std::pow(10.,0.05);
203 double snrrhohv=std::pow(10.,0.05);
205 double delZdr,csi,chi;
214 chi=std::exp(-0.0000137*omega*omega*(gradphitheta*gradphitheta+gradphiphi*gradphiphi));
215 delZdr=0.02*omega*omega*(gradZtheta*gradZdrtheta+gradZphi*gradZdrphi);
216 chi=(1.-rhohv)/delrhohv1;
219 double delphi=0.02*omega*omega*(gradphitheta*gradZtheta + gradphiphi*gradZphi);
222 *
this<<std::exp(-0.69*( phidp*phidp/(phidpZ*phidpZ) + snrZ*snrZ/(snr*snr) + alpha*alpha/(50.*50.))),
223 std::exp(-0.69*(phidp*phidp/(phidpZdr*phidpZdr) + delZdr*delZdr/(delZdrt*delZdrt)
224 + (1.-rhohv)*(1.-rhohv)/(delrhohv1*delrhohv1) + snrZdr*snrZdr/(snr*snr) + alpha*alpha/(50.*50.))),
225 std::exp(-0.69*((1.-chi)*(1.-chi)/(delrhohv2*delrhohv2) + (1.-rhohv)*(1.-rhohv)/(delrhohv1*delrhohv1) + snrrhohv*snrrhohv/(snr*snr))),
226 std::exp(-0.69*(delphi*delphi/(delphidpt*delphidpt) + (1.-rhohv)*(1.-rhohv)/(delrhohv1*delrhohv1) + snrKdp*snrKdp/(snr*snr))),
227 std::exp(-0.69*snrZ*snrZ/(snr*snr)),
228 std::exp(-0.69*snrKdp*snrKdp/(snr*snr));
251 double z,zdr,rhohv,lkdp,sdz,sdphidp,vrad;
252 double phidp,snr,gradphitheta,gradphiphi,gradZtheta,gradZphi,gradZdrtheta,gradZdrphi;
266 HCA_Park(
double Z,
double ZDR,
double RHOHV,
double LKDP,
double SDZ,
double SDPHIDP,
double VRAD,
267 double PHIDP,
double SNR,
double GPHITH,
double GPHIPHI,
double GZTH,
double GZPHI,
double GZDRTH,
double GZDRPHI);
275 if(idx==0||idx==1)
return true;
285 if(idx==0||idx==1)
return false;
319 std::vector<double> top;
320 std::vector<double> bot;
327 std::vector< std::vector< std::vector< HCA_Park> > >& HCA);
329 void seek4mlfile(time_t now,
MLpoints&);
330 void fill_empty_azimuths();
360 std::vector< std::vector< std::vector<HCA_Park> > >
vol_Ai;
Homogeneous volume with a common beam count for all PolarScans.
compute confidence vector of radar variables
EchoClass echo(double minimum=0.)
MLpoints(double minHeight, double maxHeight, unsigned az_count, unsigned height_count)
counter
unsigned count
height max [km]
double Hmax
height min [km]
MLpoints Melting Layer Points matrix AzH.
MeltingLayer Melting Layer Detection Algorithm MLDA Giangrande et al. 2008.
PROB(double z, double zdr, double rhohv, double lkdp, double sdz, double sdphidp, double vrad)
Given radar variables compute matrix of probability.
void compute_derived_volumes()
Initialize derived input data.
Volume< double > vol_rhohv
void class_designation(unsigned win_rg=1, unsigned win_az=1)
Designate class echo Find the maximum of aggregation values.
Volume< double > vol_lkdp_6km
Volume< double > vol_vrad
Volume< double > vol_zdr_2km
Volume< double > vol_grad_z_phi
Volume< double > vol_phidp_6km
void compute_lkdp()
Initialize vol_lkdp 10log10 of the moving average slope of phidp along beam path.
Volume< double > vol_grad_z_theta
std::vector< std::vector< std::vector< HCA_Park > > > vol_Ai
Volume< double > vol_grad_zdr_phi
Volume< double > vol_lkdp_2km
Volume< double > vol_grad_phi_phi
Volume< EchoClass > vol_hca
Volume< double > vol_rhohv_2km
void HCA_Park_2009(float Ht, float Hb)
Compute Echo Classes Park et al. (2009) HCA algorithm.
Volume< double > vol_grad_zdr_theta
void correct_for_attenuation()
correct Z and Zdr for path attenuation
Volume< double > vol_z_1km
Volume< double > vol_phidp
classifier(const std::string &file)
Constructor from odim file.
Volume< double > vol_sdphidp
void correct_for_snr()
correct rhohv and zdr for noise (Schuur et al. 2003)
Volume< double > vol_grad_phi_theta
void print_ppi_class(int elev=-1)
print PPI of EchoClass
Volume< double > vol_phidp_2km
void melting_layer_classification(MeltingLayer &ML, float Ht, float Hb)
Check consistency respect to Melting Layer height.
compute hydrometeor classification
EchoClass
List classes of radar echoes Classes defined in Park et al. (2009) Overload << operator to print clas...
Base for all matrices we use, since we rely on row-major data.
Definisce le principali strutture che contengono i dati.