radarx.level1.clutter.regression_filter#

radarx.level1.clutter.regression_filter(obj, iq=None, *, dim='pulse', order=2, where=None, n_threads=None, engine='auto')[source]#

Remove ground clutter from IQ time series with a polynomial regression filter.

A polynomial of degree order is fitted to the samples of every gate and subtracted; see radarx.level1.clutter.

Parameters:
  • obj (xarray.DataArray, xarray.Dataset or xarray.DataTree) – The complex IQ samples with a pulse dimension, a sweep that holds them, or a volume (sweeps without IQ are skipped).

  • iq (str, optional) – Name of the IQ variable of a sweep. Default: IQ, iq, IQH or IQV.

  • dim (str, optional) – The pulse dimension. Default "pulse".

  • order (int, optional) – Degree of the polynomial, 0 (the mean) up to the number of pulses minus 2. The notch widens with the degree, and so does the loss of weather signal near zero velocity. Default 2 (radarx choice).

  • where (xarray.DataArray of bool, optional) – Filter only the gates where this is True (a clutter map or flag, with the dimensions of the gates). The other gates are returned unchanged. Default: all gates.

  • n_threads (int, optional) – Threads for the compiled kernel. Default: all cores.

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation to use. "auto" prefers the compiled kernel and falls back to NumPy.

Returns:

xarray.Dataset or xarray.DataTree – IQ, the filtered complex samples with the dimensions of the input, and CLUTTER_POWER (dB), the mean power that was removed, in the squared units of the samples (NaN where nothing was removed).

Raises:
  • KeyError – If no IQ variable is found.

  • ValueError – If the samples are not complex, order is negative or leaves fewer than 2 degrees of freedom, or the pulse dimension is missing.

  • ImportError – If engine="compiled" and the compiled kernels are not available.

Notes

The filter removes weather signal too: the weather echo with a velocity within about (order + 1) spectral bins of zero is partly removed. The degree needed grows with the number of pulses and with the width of the clutter, because the polynomial has to follow the variation of the clutter over the dwell. In simulated gates with clutter 30 dB stronger than the weather and a width of 0.2 m/s, degree 3 suffices for 64 pulses and degree 6 for 128. Spectra of the filtered series have a hole near zero velocity; use notch_filter() on the spectra to fill it.

References

Torres, S. M., and D. S. Zrnić, 1999: Ground clutter canceling with a regression filter. J. Atmos. Oceanic Technol., 16 (10), 1364-1372, https://doi.org/10.1175/1520-0426(1999)016<1364:GCCWAR>2.0.CO;2

Doviak, R. J., and D. S. Zrnic, 1993: Doppler Radar and Weather Observations, 2nd ed. Academic Press (Section 7.10).

Examples

>>> clean = radarx.level1.regression_filter(iq, order=1)
>>> clean_iq = clean["IQ"]