towerpy.attc.attc_zhzdr#

Towerpy: an open-source toolbox for processing polarimetric radar data.

Classes#

AttenuationCorrection

A class to calculate the attenuation of the radar signal power.

Module Contents#

class towerpy.attc.attc_zhzdr.AttenuationCorrection(radobj=None)[source]#

A class to calculate the attenuation of the radar signal power.

Attributes#

elev_anglefloat

Elevation angle at which the scan was taken, in deg.

file_namestr

Name of the file containing radar data.

scandatetimedatetime

Date and time of scan.

site_namestr

Name of the radar site.

res_zdrcorrectiondict, opt

Descriptor of the \(Z_{DR}\) attenuation correction process.

varsdict

Output of the \(Z_{H}\) and/or \(Z_{DR}\) attenuation correction process.

elev_angle = None[source]#
file_name = None[source]#
scandatetime = None[source]#
site_name = None[source]#
attc_phidp_prepro(rad_georef, rad_params, attvars, mov_avrgf_len=(1, 3), t_spdp=10, minthr_pdp0=-5, rhohv_min=0.9, phidp0_correction=False, mlyr=None)[source]#

Prepare \(\Phi_{DP}\) for attenuation correction.

Parameters#

rad_georefdict

Georeferenced data containing descriptors of the azimuth, gates and beam height, amongst others.

rad_paramsdict

Radar technical details.

attvarsdict

Polarimetric variables used for the attenuation correction.

mov_avrgf_len2-element tuple or list, optional

Window size used to smooth \(\Phi_{DP}\) by applying a moving average window. The default is (1, 3). It is recommended to average \(\Phi_{DP}\) along the range, i.e. keep the window size in a (1, n) size.

t_spdp: int or float, optional

Discard bins with standard deviations of \(\Phi_{DP}\) greater than the selected value. The default is 10 deg.

minthr_pdp0: int or float, optional

Tolerance for the true value of \(\Phi_{DP}(r0)\). Values below this threshold are removed. The default is -5 deg.

rhohv_min: float, optional

Threshold in \(\rho_{HV}\) used to discard bins related to nonmeteorological signals. The default is 0.90

phidp0_correctionBool, optional

If True, adjust \(\Phi_{DP}(r0)\) for each individual ray.

mlyrMeltingLayer Class, optional

Filter and interpolate PhiDP within the melting layer. The ml_top (float, int, list or np.array) and ml_bottom (float, int, list or np.array) must be explicitly defined. The default is None.

Notes#

1. This function smooths the total \(\Phi_{DP}\) using the given window size, remove spurious values within the signal phase, etc.

2. \(\Phi_{DP}\) must have been previously unfolded and offset (\(\Phi_{DP}(r0)\)) corrected.

zh_correction(rad_georef, attvars, cclass, mlyr=None, attc_method='ABRI', pdp_pxavr_rng=7, pdp_pxavr_azm=1, pdp_dmin=20, coeff_alpha=[0.02, 0.1, 0.073], coeff_a=[1e-05, 9e-05, 3e-05], coeff_b=[0.65, 0.85, 0.78], phidp0=0, niter=500, plot_method=False)[source]#

Calculate the attenuation of \(Z_{H}\).

Parameters#

rad_georefdict

Georeferenced data containing descriptors of the azimuth, gates and beam height, amongst others.

attvarsdict

Polarimetric variables used for the attenuation correction.

cclassarray

Clutter, noise and meteorological echoes classification: ‘pcpn’ = 0, ‘noise’ = 3, ‘clutter’ = 5

mlyrMeltingLayer Class, optional

Melting layer class containing the top of the melting layer, (i.e., the melting level) and its thickness, in km. Only gates below the melting layer bottom (i.e. the rain region below the melting layer) are included in the computation; ml_top and ml_thickness can be either a single value (float, int), or an array (or list) of values corresponding to each azimuth angle of the scan. If None, the function is applied assuming ml_top=5km and ml_thickness=0.5 km.

attc_methodstr

Attenuation correction algorithm to be used. The default is ‘ABRI’:

[ABRI] = Bringi (optimised).

[AFV] = Final value (optimised).

[AHB] = Hitschfeld and Bordan (optimised).

[ZPHI] = Testud (constant parameters).

[BRI] = Bringi (constant parameters).

[FV] = Final value (constant parameters).

[HB] = Hitschfeld and Bordan (constant parameters).

pdp_pxavr_rngint

Pixels to average in \(\Phi_{DP}\) along range: Odd number equivalent to about 4km, i.e. 4km/range_resolution. The default is 7.

pdp_pxavr_azmint

Pixels to average in \(\Phi_{DP}\) along azimuth. Must be an odd number. The default is 1.

pdp_dminfloat

Minimum total \(\Delta\Phi_{DP}\) expected in a ray to perform attenuation correction (at least 10-20 degrees). The default is 20.

coeff_alpha3-element tuple or list, optional

[Min, max, fixed value] of coeff \(\alpha\). These bounds are used to find the optimum value of \(\alpha\) from \(A_H = \alpha K_{DP}\). Default values are [0.020, 0.1, 0.073], derived for C-band.

coeff_a3-element tuple or list, optional

[Min, max, fixed value] of coeff \(a\). These bounds are used to find the optimum value of \(a\) from \(A_H = a Z_{H}^b\). Default values are [1e-5, 9e-5, 3e-5], derived for C-band.

coeff_b3-element tuple or list, optional

[Min, max, fixed value] of coeff \(b\). These bounds are used to find the optimum value of \(b\) from \(A_H = a Z_{H}^b\). Default values are [0.65, 0.85, 0.78], derived for C-band.

niterint

Number of iterations to find the optimised values of the coeffs \(a, b, \alpha\). The default is 500.

phidp0int , float or None

Adjusts the value (in deg) of \(\Phi_{DP}(r0)\) for the whole scan. If None, the function computes the value of the offset by averaging the value of \(\Phi_{DP}\) in the first ten consecutive bins classified as rain, according to the cclass. The default is 0.

plot_methodBool, optional

Plot the ZH attenuation correction method. The default is False.

Returns#

varsdict
ZH [dBZ]:

Corrected horizontal reflectivity

AH [dB/km]:

Specific horizontal attenuation

PhiDP [deg]:

Processed and adjusted differential phase

PhiDP* [deg]:

Computed differential phase: Its availability depends on the selected method.

KDP [deg/km]:

Specific differential phase, calculated using the equation \(K_{DP}=A_H/\alpha\)

PIA [dB]:

Path-Integrated Attenuation, calculated using the equation \(PIA=\Phi_{DP}*\alpha\)

alpha:

parameter \(\alpha\) that represents the ratio \(A_H/K_{DP}\)

Notes#

1. The attenuation is computed up to a user-defined melting level height.

2. This function uses the shared object ‘lnxlibattenuationcorrection’ or the dynamic link library ‘w64libattenuationcorrection’ depending on the operating system (OS).

  1. Based on the method described in [1]_

References#

zdr_correction(rad_georef, attvars, attcorr_vars, cclass, mlyr=None, attc_method='BRI', coeff_beta=[0.008, 0.1, 0.04], beta_alpha_ratio=0.265, rhv_thld=0.985, mov_avrgf_len=9, minbins=10, p2avrf=5, zh_zdr_model='linear', rparams=None, descr=False, plot_method=False)[source]#

Calculate the attenuation of \(Z_{DR}\).

Parameters#

rad_georefdict

Georeferenced data containing descriptors of the azimuth, gates and beam height.

attvarsdict

Polarimetric variables to be corrected for attenuation.

attcorr_varsdict

Attenuation-corrected polarimetric variables used for calculations.

cclassarray

Clutter, noise and meteorological echoes classification: ‘pcpn’ = 0, ‘noise’ = 3, ‘clutter’ = 5

mlyrMeltingLayer Class, optional

Melting layer class containing the top of the melting layer, (i.e., the melting level) and its thickness, in km. Only gates below the melting layer bottom (i.e. the rain region below the melting layer) are included in the computation; ml_top and ml_thickness can be either a single value (float, int), or an array (or list) of values corresponding to each azimuth angle of the scan. If None, the function is applied assuming ml_top=5km and ml_thickness=0.5 km.

attc_methodstr

Attenuation correction algorithm to be used. The default is ‘BRI’:

[ABRI] = Bringi (optimised beta parameter).

[BRI] = Bringi (constant beta/alpha ratio).

coeff_beta3-element tuple or list, optional

[Min, max, fixed value] of coeff \(\beta\). These bounds are used to find the optimum value of \(\beta\). Default values are [0.002, 0.04, 0.02], derived for C-band.

beta_alpha_ratiofloat, opt

Quotient between \(\alpha\) and \(\beta\) parameters from \(A_{DP} = ( \beta / \alpha )A_{H}\). The default is 0.265 for C-band.

rhv_thldfloat

Minimum value of \(\rho_{HV}\) expected in the rain medium. The default is 0.98.

mov_avrgf_lenint

Odd number used to apply a moving average filter to each beam and smooth the signal. The default is 5.

minbinsint

Minimum number of bins related to the length of each rain cell along the beam. The default is 10.

p2avrfint

Number of bins to average on the far side of the rain cell. The default is 3.

zh_zdr_modelstr

Method used to compute the ZH-ZDR relationship. The “linear” model uses the relation provided in [2] and [4], whereas the “exp” model uses the relation proposed by [3].

rparams: dict
Additional parameters describing the ZH-ZDR relationship:

For the linear model: ZH_lower_lim: 20 dBZ, ZH_upper_lim: 45 dBZ, coeff_a: 0.048, coeff_b: 0.774, zdr_max: 1.4

\[\begin{split}\overline{Z}_{DR} = \Biggl\{ 0 \rightarrow \overline{Z_H}(r_m)<=Z_H(lowerlim) \\ a*Z_H-b \rightarrow Z_H(lowerlim)<Z_H(r_m)<=Z_H(upperlim) \\ Z_{DR}(max) \rightarrow Z_H(r_m)>Z_H(upperlim) \Biggl\}\end{split}\]

For the exp model: coeff_a: 0.00012, coeff_b: 2.5515

\[\overline{Z}_{DR} = \Biggl\{ a*Z_H^{b} \Biggl\}\]
descrbool

Controls if the statistics of the calculations are returned. The default is False.

plot_methodBool, optional

Plot the ZDR attenuation correction method. The default is False.

Returns#

varsdict
ZDR [dB]:

Attenuation-corrected differential reflectivity.

ADP [dB/km]’:

Specific differential attenuation.

beta:

parameter \(\beta\) optimised for each beam.

Notes#

1. The attenuation is computed up to a user-defined melting level height.

2. The ZDR attenuation correction method assumes that ZH has first been corrected for attenuation, e.g., using the methods described in [1]_

References#