5 #ifndef RADARELAB_ALGO_DBZ_H
6 #define RADARELAB_ALGO_DBZ_H
10 #define MISSING_DB (-20.)
11 #define MINVAL_DB (80./255.-20.)
12 #define MAXVAL_DB (60.)
15 template<
typename T>
class Volume;
38 DBZ(
int month,
double base_cell_size);
50 double attenuation(
unsigned char DBZbyte,
double PIA);
55 double RtoDBZ(
double rain)
const;
56 double DBZtoR(
double dbz)
const;
57 double DBZ_snow(
double dbz)
const;
58 double DBZ_conv(
double dbz)
const;
59 double RtoDBZ_class(
double R)
const;
60 double DBZ_to_mp_func(
double sample)
const;
72 return val_db - 10 * log10(1. - beamblocking / 100.);
82 static constexpr
inline double BYTEtoDB(
unsigned char DBZbyte,
double gain=80./255.,
double offset=-20.)
84 return (DBZbyte * gain + offset);
94 static inline unsigned char DBtoBYTE(
double DB,
double gain=80./255.,
double offset=-20.)
96 int byt = round((DB - offset) / gain);
100 return (
unsigned char)(byt);
112 static double BYTEtoZ(
unsigned char byte);
119 static constexpr
inline double DBZtoZ(
double DBZ) {
return pow(10., DBZ * 0.1); }
126 static constexpr
inline double ZtoDBZ(
double Z) {
return 10 * log10(Z); }
135 static constexpr
inline double DBZtoR(
double dbz,
double aMP,
double bMP) {
return pow(pow(10., dbz / 10.) / aMP,1. / bMP); }
144 static constexpr
inline double RtoDBZ(
double rain,
double aMP,
double bMP) {
return 10. * (log10(aMP * pow(rain, bMP))); }
153 static constexpr
inline double RtoZ(
double rain,
double aMP,
double bMP) {
return aMP * pow(rain, bMP); }
162 static constexpr
inline double ZtoR(
double z,
double aMP,
double bMP) {
return pow(z / aMP, 1. / bMP); }
173 static constexpr
inline double BYTE_to_mp_func(
unsigned char byte,
double aMP,
double bMP,
double gain=80./255.,
double offset=-20.)
175 return pow(pow(10., 0.1 * (byte * gain + offset)) / aMP, 1. / bMP);
static constexpr double DBZtoR(double dbz, double aMP, double bMP)
funzione che converte dbZ in R usando a e b variabili
static constexpr double BYTEtoDB(unsigned char DBZbyte, double gain=80./255., double offset=-20.)
funzione che converte Z unsigned char in DBZ
Class to manage reflectivity functions (simply attenuation correction, conversion between Z...
static constexpr double ZtoDBZ(double Z)
funzione che converte Z in dBZ
static constexpr double BYTE_to_mp_func(unsigned char byte, double aMP, double bMP, double gain=80./255., double offset=-20.)
funzione che converte byte in R usando a e b variabili
static constexpr double beam_blocking_correction(double val_db, double beamblocking)
Compute the corrected value (in dB) given the original value (in dB) and the beam blocking percentage...
static constexpr double RtoZ(double rain, double aMP, double bMP)
funzione che converte R in Z usando a e b variabili
static unsigned char DBtoBYTE(double DB, double gain=80./255., double offset=-20.)
funzione che converte dB in valore intero tra 0 e 255
double base_cell_size
cella size dimension
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
static constexpr double DBZtoZ(double DBZ)
funzione che converte dBZ in Z
static constexpr double RtoDBZ(double rain, double aMP, double bMP)
funzione che converte R in dbZ usando a e b variabili
static constexpr double ZtoR(double z, double aMP, double bMP)
funzione che converte Z in R usando a e b variabili