10 #define aMP_SNOW 400.0
12 #define aMP_class 200.
22 DBZ::DBZ(
const Volume<double>& volume)
25 time_t Time = volume.load_info->acq_date;
26 struct tm* tempo = gmtime(&Time);
27 init(tempo->tm_mon+1, volume[0].cell_size);
30 DBZ::DBZ(
int month,
double base_cell_size)
32 init(month, base_cell_size);
35 void DBZ::init(
int month,
double base_cell_size)
37 this->base_cell_size = base_cell_size;
39 if (month > 4 && month < 10)
53 double Zhh,att_rate,R;
60 Zhh= (BYTEtoZ(DBZbyte));
61 if (10*log10(Zhh) > THRES_ATT )
63 Zhh=pow(10., (log10(Zhh)+ 0.1*att_tot));
64 R=pow((Zhh/aMP),(1.0/bMP));
65 att_rate=0.0018*pow(R,1.05);
67 att_tot=att_tot+2.*att_rate*0.001 * base_cell_size;
68 if (att_tot>BYTEtoDB(254)) att_tot=BYTEtoDB(254);
74 double Zhh,att_rate,R;
81 Zhh=(DBZtoZ(DBZvalue));
82 if (DBZvalue > THRES_ATT )
85 Zhh=DBZtoZ(DBZvalue+ att_tot);
86 R=pow((Zhh/aMP),(1.0/bMP));
87 att_rate=0.0018*pow(R,1.05);
89 att_tot=att_tot+2.*att_rate*0.001 * base_cell_size;
90 if (att_tot>BYTEtoDB(254)) att_tot=BYTEtoDB(254);
95 double DBZ::RtoDBZ(
double rain)
const
97 return RtoDBZ(rain, aMP, bMP);
100 double DBZ::DBZtoR(
double dbz)
const
102 return DBZtoR(dbz, aMP, bMP);
105 double DBZ::DBZ_snow(
double dbz)
const
107 return RtoDBZ(DBZtoR(dbz, aMP_SNOW, bMP_SNOW), aMP_class, bMP_class);
110 double DBZ::DBZ_conv(
double dbz)
const
112 return RtoDBZ(DBZtoR(dbz, aMP_conv, bMP_conv), aMP_class, bMP_class);
115 double DBZ::RtoDBZ_class(
double R)
const
117 return RtoDBZ(R, aMP_class, bMP_class);
120 double DBZ::DBZ_to_mp_func(
double sample)
const
122 return DBZtoR(sample, aMP, bMP);
127 const double gain = 80. / 255.;
128 const double offset = -20.;
129 static bool precomputed =
false;
130 static double Z[256];
134 for (
unsigned i=0; i < 256; ++i)
135 Z[i] = pow(10., (i * gain + offset) * 0.1);
Definisce le principali strutture che contengono i dati.
double attenuation(unsigned char DBZbyte, double PIA)
funzione che calcola l'attenuazione totale
static double BYTEtoZ(unsigned char byte)
funzione che converte byte in Z