radarx.grid.grid.grid_radar#
- radarx.grid.grid.grid_radar(obj, data_vars=None, pseudo_cappi=True, x_lim=(-100000.0, 100000.0), y_lim=(-100000.0, 100000.0), z_lim=(0, 10000.0), x_step=1000, y_step=1000, z_step=250, x_smth=0.2, y_smth=0.2, z_smth=1, method='cone', *, fill_depth=500.0, fill_velocity=False, k_e=1.3333333333333333, n_threads=None)[source]#
Interpolate radar data to a 3D grid and optionally create a pseudo-CAPPI.
Two methods are available.
"cone"(default) interpolates within each sweep and then between sweeps (seeradarx.grid.grid_cones()): it needs no smoothing parameters, keeps the native resolution and is much faster."barnes"uses Barnes (1964) [1] objective analysis via the optional fast-barnes-py package (Python < 3.13 only), which implements the fast approximate Barnes interpolation of Zürcher (2023) [2].- Parameters:
obj (
xradar.DataTree) – Input radar DataTree containing radar sweeps.data_vars (
listofstr, optional) – List of variables to interpolate. If None, all variables in the dataset are used. Defaults to None.pseudo_cappi (
bool, optional) – If True, extrapolates data to lower altitudes to create a pseudo-CAPPI. Defaults to True.x_lim (
tupleoffloat, optional) – Range of x-coordinates (meters) for the Cartesian grid. Defaults to (-100e3, 100e3).y_lim (
tupleoffloat, optional) – Range of y-coordinates (meters) for the Cartesian grid. Defaults to (-100e3, 100e3).z_lim (
tupleoffloat, optional) – Range of z-coordinates (meters) for the Cartesian grid. Defaults to (0, 10e3).x_step (
int, optional) – Grid resolution in the x-direction (meters). Defaults to 1000.y_step (
int, optional) – Grid resolution in the y-direction (meters). Defaults to 1000.z_step (
int, optional) – Grid resolution in the z-direction (meters). Defaults to 250.x_smth (
float, optional) – Smoothing factor for the x-dimension: the Gaussian width of the Barnes kernel as a fraction ofx_step. Defaults to 0.2.y_smth (
float, optional) – Smoothing factor for the y-dimension (fraction ofy_step). Defaults to 0.2.z_smth (
float, optional) – Smoothing factor for the z-dimension (fraction ofz_step). Defaults to 1.x_smth,y_smthandz_smthapply tomethod="barnes"only. The grid defaults and the three smoothing factors are radarx choices, not taken from Barnes (1964) or Zürcher (2023). The settings passed to fast-barnes-py (max_dist=4andnum_iter=4) are radarx choices too; they are not taken from Zürcher (2023).method (
{"cone", "barnes"}, optional) – Interpolation method. Default"cone".fill_depth (
float, optional) – Withmethod="cone"andpseudo_cappi=True, the lowest sweep fills at most this many metres below itself and never below the radar altitude. Default 500 m, a radarx choice. At 150 km the lowest beam is about 2.5 km up, and the earlier unlimited fill copied it to the ground;fill_depth=numpy.infrestores that.fill_velocity (
bool, optional) – Withmethod="cone", also fill radial velocity below the lowest sweep. DefaultFalse, because a radial velocity is a projection on the beam direction, which changes with height.Truerestores the earlier behaviour.k_e (
float, optional) – Effective Earth radius factor of the beam height (Doviak and Zrnic 1993, Eq. 2.28). Default 4/3. Seeradarx.fundamentals.geometry.k_e_from_refractivity(). Used bymethod="cone"; the Barnes path georeferences with xradar’s 4/3.n_threads (
int, optional) – Threads formethod="cone". Default: all cores.
- Returns:
xarray.Dataset– Interpolated dataset with the specified variables and 3D grid. Includes longitude and latitude coordinates for the grid and the mean time of the volume as a scalartimecoordinate, so grids of several volumes stack withxr.concat(grids, "time"). Withmethod="barnes"latandlonare 2-D on(y, x), the position of every cell of the metric grid.
Notes
With
method="barnes"the pseudo-CAPPI is created by copying the value of the level above into every missing (NaN) cell of a level, working downward from the third-highest level to the lowest one (the two highest levels are not filled). This fills any NaN cell at any of these levels, including gaps inside a column, from the level above, not only the cells below the lowest echo; it is a radarx convention, not a published algorithm.With
method="cone",pseudo_cappifills levels below the lowest sweep with that sweep’s value; other cells not bracketed by two sweeps stay empty. The cone method is radarx’s own: its closest published relative is the vertical interpolation (VI) scheme of Zhang et al. (2005) [3] (their Eqs. 5-7, a linear interpolation in elevation angle between the two tilts around the grid cell, nearest neighbour in azimuth and range). It differs in interpolating bilinearly within each sweep and linearly in beam height (not in elevation angle) between sweeps.With
method="barnes", interpolation uses Barnes objective analysis on the metric azimuthal equidistant grid (gate positions and the grid are both in metres from the radar), so the labelledxandyare the true cell positions. Earlier versions ran it on a regular lon/lat lattice built from the axes, which displaced cells by up to about 1 km at 100 km from the radar.
Dask. This function computes the dask array: the result is interpolated from the gates of all sweeps. The input is loaded into memory and the result is held in memory.
References