radarx.retrieve.calibration.phidp_offset#

radarx.retrieve.calibration.phidp_offset(obj, *, phidp=None, rhohv=None, snr=None, mask=None, min_range=1.0, n_gates=20, min_gates=5, min_rhohv=0.9, min_snr=None, n_threads=None, engine='auto')[source]#

System differential phase of a sweep from the first valid gates of each ray.

Close to the radar the propagation phase is still zero, so the measured PHIDP there is the system offset. For each ray the circular mean of the first n_gates valid gates beyond min_range is taken (the angles are averaged on the circle, so a phase that wraps at 0/360 degrees is no problem); the offset of the sweep is the circular median of the rays, which is not affected by rays that start in precipitation or clutter that changes the phase. The system offset is the quantity that has to be subtracted from PHIDP before attenuation correction or KDP (Gourley et al. 2006). The thresholds are radarx choices.

Parameters:
  • obj (xarray.DataArray, xarray.Dataset or xarray.DataTree) – PHIDP (DataArray), a sweep or a volume.

  • phidp, rhohv, snr (str or xarray.DataArray, optional) – Fields. Defaults PHIDP (also UPHIDP) and RHOHV; the SNR only with min_snr.

  • mask (xarray.DataArray, optional) – Boolean array of the gates that may be used.

  • min_range (float, optional) – Gates closer than this (km) are not used (near-field and the first gates of the receiver recovery). Default 1.

  • n_gates (int, optional) – Number of valid gates averaged in a ray. Default 20.

  • min_gates (int, optional) – Fewest valid gates in a ray; the ray is NaN otherwise. Default 5.

  • min_rhohv (float, optional) – Smallest correlation coefficient. Default 0.9.

  • min_snr (float, optional) – Smallest SNR in dB.

  • 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 – SYSTEM_PHIDP (degrees, in (-180, 180]), the offset of the sweep; SYSTEM_PHIDP_SPREAD, the scatter of the rays (1.4826 times the median absolute deviation, degrees); SYSTEM_PHIDP_RAYS, the number of rays used; SYSTEM_PHIDP_RAY, the offset of each ray; SYSTEM_PHIDP_GATES, the gates used in each ray and SYSTEM_PHIDP_CONCENTRATION, the mean resultant length of each ray (1: all gates agree). For a volume a DataTree with one node per sweep.

Raises:
  • KeyError – If a field is not found.

  • ValueError – For unknown options or an input without range.

  • ImportError – If engine="compiled" and the compiled kernel is not available.

Notes

Dask and extra dimensions. The fields may have extra leading dimensions (for example time or volume): each sweep is processed on its own and the result has the same extra dimensions. Dask arrays stay lazy: the result is a dask array and nothing is computed until it is (the sweep dimensions are rechunked into one chunk).

References

Gourley, J. J., P. Tabary, and J. Parent du Chatelet, 2006: Data quality of the Meteo-France C-band polarimetric radar. J. Atmos. Oceanic Technol., 23 (10), 1340-1356, https://doi.org/10.1175/JTECH1912.1 (a correction of the system offset in the differential propagation phase is part of the paper; its procedure is not reproduced).

Examples

>>> off = radarx.retrieve.phidp_offset(sweep)
>>> phidp = sweep.PHIDP - float(off.SYSTEM_PHIDP)