wradlib.dp.kdp_from_phidp(phidp, winlen=7, dr=1.0, method=None)

Retrieves $$K_{DP}$$ from $$Phi_{DP}$$.

In normal operation the method uses convolution to estimate $$K_{DP}$$ (the derivative of $$Phi_{DP}$$ with Low-noise Lanczos differentiators. The results are very similar to the fallback moving window linear regression (method=slow), but the former is much faster, depending on the percentage of NaN values in the beam, though.

For further reading please see Differentiation by integration using orthogonal polynomials, a survey and Low-noise Lanczos differentiators.

The fast method provides fast $$K_{DP}$$ retrieval but will return NaNs in case at least one value in the moving window is NaN. The remaining gates are treated by using local linear regression where possible.

Please note that the moving window size winlen is specified as the number of range gates. Thus, this argument might need adjustment in case the range resolution changes. In the original publication ([Vulpiani2012]), the value winlen=7 was chosen for a range resolution of 1km.

Warning

The function is designed for speed by allowing to process multiple dimensions in one step. For this purpose, the RANGE dimension needs to be the LAST dimension of the input array.

Parameters: phidp (numpy.ndarray) – multi-dimensional array, note that the range dimension must be the last dimension of the input array. winlen (int) – Width of the window (as number of range gates) dr (float) – gate length in km method (str) – If None uses fast convolution based differentiation, if ‘slow’ uses linear regression.

Examples

>>> import wradlib
>>> import numpy as np
>>> import matplotlib.pyplot as pl
>>> pl.interactive(True)
>>> kdp_true = np.sin(3 * np.arange(0, 10, 0.1))
>>> phidp_true = np.cumsum(kdp_true)
>>> phidp_raw = phidp_true + np.random.uniform(-1, 1, len(phidp_true))
>>> gaps = np.concatenate([range(10, 20), range(30, 40), range(60, 80)])
>>> phidp_raw[gaps] = np.nan