radarx.level1.clutter.notch_filter#

radarx.level1.clutter.notch_filter(obj, spectrum=None, *, dim='velocity', half_width=1, fill='interpolate', noise=None, where=None, n_sigma=1.0, n_average=None, min_bins=None, n_threads=None, engine='auto')[source]#

Remove ground clutter from Doppler spectra with a notch at zero velocity.

The bins within half_width of the zero velocity bin are replaced; see radarx.level1.clutter.

Parameters:
  • obj (xarray.DataArray, xarray.Dataset or xarray.DataTree) – The spectra (a DataArray with a velocity dimension), a Dataset with SPECTRUM from doppler_spectra(), or a volume (sweeps without spectra are skipped).

  • spectrum (str, optional) – Name of the spectrum variable. Default: SPECTRUM.

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

  • half_width (int, optional) – Bins on each side of zero velocity that are replaced, so the notch has 2 half_width + 1 bins. Default 1 (the DC line and one adjacent bin on each side).

  • fill ({"interpolate", "gaussian", "noise"}, optional) – What replaces the notch bins. Default "interpolate".

  • noise (float, xarray.DataArray or xarray.Dataset, optional) – Total noise power of the series (linear; a DataArray with units="dB" or a Dataset with NOISE_POWER is read in dB), as for spectral_moments(). Default: estimated for every spectrum.

  • where (xarray.DataArray of bool, optional) – Filter only the gates where this is True. The others are returned unchanged. Default: all gates.

  • n_sigma (float, optional) – Threshold above the noise level, in standard deviations of the noise estimate, for the bins that the Gaussian fit uses. Default 1.

  • n_average (float, optional) – Periodograms averaged in a spectrum. By default the attribute of the spectra, or 1.

  • min_bins (int, optional) – Fewest bins of the noise estimate. Default max(3, bins // 8).

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

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation to use.

Returns:

xarray.Dataset or xarray.DataTree – SPECTRUM, the filtered spectra with the attributes of the input, and CLUTTER_POWER (dB), the power that was removed from the notch bins (NaN where it is not positive).

Raises:
  • KeyError – If no spectrum is found.

  • ValueError – For an unknown fill, a negative half_width or n_sigma, or a velocity axis that is not uniform with a zero bin.

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

References

Guo, H., 2011: A simple algorithm for fitting a Gaussian function [DSP tips and tricks]. IEEE Signal Process. Mag., 28 (5), 134-137, https://doi.org/10.1109/MSP.2011.941846

Hildebrand, P. H., and R. S. Sekhon, 1974: Objective determination of the noise level in Doppler spectra. J. Appl. Meteor., 13 (7), 808-811, https://doi.org/10.1175/1520-0450(1974)013<0808:ODOTNL>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

>>> spectra = radarx.level1.doppler_spectra(iq, window="blackman")
>>> clean = radarx.level1.notch_filter(spectra, half_width=2)