xradar.util.resample_coord#

xradar.util.resample_coord(sweep, angle_res=None, range_res=None, keep_start=True)[source]#

Resample the angle and range coordinates of a reflectivity sweep onto a coarser grid.

Range is resampled first, then azimuth/elevation; both dimensions are averaged over an integer number of gates or samples and interpolated onto the target grid, the dB forms in linear space. The input sweep is left unchanged and the packing of the input is kept.

Parameters:
  • sweep (xarray.Dataset) – Radar sweep dataset following WMO conventions (nominal angles and gate spacing are expected), with at least two gates and two azimuth/elevation samples and reflectivity moments only.

  • angle_res (float, optional) – Target azimuth (PPI) or elevation (RHI) resolution in degrees, positive, rounded to the nearest multiple of the current resolution when averaging.

  • range_res (float, optional) – Target gate spacing in meters, positive, rounded to the nearest multiple of the current gate spacing when averaging.

  • keep_start (bool) – Target grid from the first block centre of the sweep, otherwise from the origin.

Returns:

sweep_out (xarray.Dataset) – Resampled sweep with the metadata variables of sweep unchanged.

Raises:

ValueError – If a resolution is not positive or if the sweep holds a moment other than reflectivity.

Notes

Incomplete last blocks are dropped (boundary="trim") and the extrapolated ends are clipped to the measured values. Coordinates which already match the target grid are kept as they are.