radarx.retrieve.azimuth_qc.azimuth_flags#

radarx.retrieve.azimuth_qc.azimuth_flags(obj, *, tolerance=4.0, window=5, duplicate_fraction=0.1, gap_factor=2.5, n_threads=None, engine='auto')[source]#

Flag jumps in the ray angles of a sweep or volume.

Parameters:
  • obj (xarray.Dataset or xarray.DataTree) – A sweep (a Dataset with an azimuth dimension or coordinate, or an elevation one for an RHI), a single sweep node of a volume, or a volume whose sweep_* nodes are checked one by one.

  • tolerance (float, optional) – Deviation, in ray spacings, from the positions that the neighbours predict beyond which a ray is an outlier. Default 4.

  • window (int, optional) – Number of rays on each side that predict the position of a ray. Default 5; at least 2.

  • duplicate_fraction (float, optional) – A step to the next good ray of less than this share of a ray spacing marks a duplicate. Default 0.1.

  • gap_factor (float, optional) – A forward step of more than this many ray spacings marks a gap (rays are missing). Default 2.5.

  • n_threads (int, optional) – Threads of the compiled kernel (one sweep per thread). Default: all.

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation. Default "auto": the compiled kernel when built.

Returns:

xarray.Dataset or xarray.DataTree – On the ray dimension: azimuth_flag (uint8 bits outlier 1, duplicate 2, gap 4, reversal 8, missing 16; see AZIMUTH_FLAGS), azimuth_fixed (the angle with the bad rays repaired, degrees in [0, 360) for the repaired rays) and azimuth_missing_rays (rays missing after a ray with the gap flag); azimuth_step (scalar) is the typical step in degrees. A DataTree gives one such node per sweep.

Notes

See the module description for the method and its limits. The check needs at least five rays with finite angles; a sweep with fewer is returned without flags other than missing.

Dask. This function computes the dask array: The ray angles are read into memory; the fields are not touched. The input is loaded into memory and the result is held in memory.

Examples

>>> flags = radarx.retrieve.azimuth_flags(sweep)
>>> flags.azimuth_flag.where(flags.azimuth_flag > 0, drop=True)