wradlib.atten.correct_attenuation_constrained

wradlib.atten.correct_attenuation_constrained(gateset, a_max=0.000167, a_min=2.33e-05, n_a=4, b_max=0.7, b_min=0.65, n_b=6, gate_length=1.0, constraints=None, constraint_args=None, sector_thr=10)

Gate-by-Gate attenuation correction based on the iterative approach of [Kraemer et al., 2008] and [Jacobi et al., 2016] with a generalized and scalable number of constraints.

Differing from the original approach, the method for addressing small sectors which conflict with the constraints is based on a bisection forward calculating method, and not on backwards attenuation calculation.

Parameters:
  • gateset (numpy.ndarray) – Multidimensional array, where the range gates (over which iteration has to be performed) are supposed to vary along the last array-dimension and the azimuths are supposed to vary along the next to last array-dimension.

    Data has to be provided in decibel representation of reflectivity [dBZ].

  • a_max (float) – Initial value for linear coefficient of the k-Z relation ( \(k=a \cdot Z^{b}\) ).

    Per default set to 1.67e-4.

  • a_min (float) – Minimal allowed linear coefficient of the k-Z relation ( \(k=a \cdot Z^{b}\) ) in the downwards iteration of ‘a’ in case of breaching one of thresholds constr_args of the optional conditions constraints.

    Per default set to 2.33e-5.

  • n_a (int) – Number of iterations from a_max to a_min.

    Per default set to 4.

  • b_max (float) – Initial value for exponential coefficient of the k-Z relation ( \(k=a \cdot Z^{b}\) ).

    Per default set to 0.7.

  • b_min (float) – Minimal allowed exponential coefficient of the k-Z relation ( \(k=a \cdot Z^{b}\) ) in the downwards iteration of ‘b’ in case of breaching one of thresholds constr_args of the optional conditions constraints and the linear coefficient ‘a’ has already reached the lower limit a_min.

    Per default set to 0.65.

  • n_b (int) – Number of iterations from b_max to b_min.

    Per default set to 6.

  • gate_length (float) – Radial length of a range gate [km].

    Per default set to 1.0.

  • constraints (list) – List of constraint functions. The signature of these functions has to be constraint_function(gateset, k, *constr_args). Their return value must be a boolean array of shape gateset.shape[:-1] set to True for beams, which do not fulfill the constraint.

  • constraint_args (list) – List of lists, which are to be passed to the individual constraint functions using the *args mechanism (len(constr_args) == len(constraints)).

  • sector_thr (int) – Number of adjacent beams, for which in case of breaching the constraints the attenuation with downward iterated a and b - parameters is recalculated. For more narrow sectors the integrated attenuation of the last gate is interpolated and used as reference for the recalculation.

Returns:

pia (numpy.ndarray) – Array with the same shape as gateset containing the calculated path integrated attenuation [dB] for each range gate.

Examples

Implementing the original Hitschfeld & Bordan (1954) algorithm with otherwise default parameters:

from wradlib.atten import *
pia = correct_attenuation_constrained(gateset, a_max=8.e-5,
                                      b_max=0.731, n_a=1, n_b=1,
                                      gate_length=1.0)

Implementing the basic Kraemer algorithm:

pia = atten.correct_attenuation_constrained(gateset, a_max=1.67e-4,
                                            a_min=2.33e-5, n_a=100,
                                            b_max=0.7, b_min=0.65,
                                            n_b=6, gate_length=1.,
                                            constraints=
                                            [wrl.atten.constraint_dbz],
                                            constraint_args=[[59.0]])

Implementing the PIA algorithm by Jacobi et al.:

pia = atten.correct_attenuation_constrained(gateset, a_max=1.67e-4,
                                            a_min=2.33e-5, n_a=100,
                                            b_max=0.7, b_min=0.65,
                                            n_b=6, gate_length=1.,
                                            constraints=
                                            [wrl.atten.constraint_dbz,
                                            wrl.atten.constraint_pia],
                                            constraint_args=
                                            [[59.0],[20.0]])