radarx.grid.cone.grid_cones#
- radarx.grid.cone.grid_cones(obj, data_vars=None, x=None, y=None, z=None, *, fill_below=False, fill_depth=None, fill_velocity=False, k_e=1.3333333333333333, motion=None, time=None, repeats='farthest', max_gap=2.0, min_weight=0.5, n_threads=None, engine='auto')[source]#
Grid a radar volume onto a Cartesian grid with cone interpolation.
- Parameters:
obj (
xarray.DataTree) – Radar volume withsweep_*groups and the radar sitelatitude,longitudeandaltitude, e.g. from xradar.data_vars (
strorlistofstr, optional) – Fields to grid. By default every field present in the lowest sweep on(azimuth, range).x, y (array-like) – Target coordinates east and north of the radar, in metres.
z (array-like) – Target heights above sea level, in metres.
fill_below (
bool, optional) – Fill levels below the lowest sweep with the lowest sweep’s value (pseudo-CAPPI). DefaultFalseleaves them empty.fill_depth (
float, optional) – Fill at most this many metres below the lowest sweep, and never below the radar altitude. DefaultNone(ornumpy.inf) fills every level below the lowest sweep, as before; at long range that spreads the lowest beam (2.5 km up at 150 km) down to the ground. Only used withfill_below=True.fill_velocity (
bool, optional) – Also fill radial velocity fields. DefaultFalse: a velocity is a projection on the beam direction, which differs from level to level, so it is never copied downward.Truerestores the old behaviour.k_e (
float, optional) – Effective Earth radius factor of the beam height,a_e = k_e a(Doviak and Zrnić 1993, Eq. 2.28). Default 4/3, the standard atmosphere.radarx.fundamentals.geometry.k_e_from_refractivity()derives it from a sounding or reanalysis profile.motion (
tupleoffloat, optional) – Storm motion(u, v)in m/s. When given, every sweep is moved from its own mean time to the analysis timetimebefore the vertical interpolation (Gal-Chen 1982 [4], equations not checked against the paper): low and high tilts of a volume are minutes apart, and a storm moving at 15 m/s travels 4.5 km in five minutes, so an echo seen by the lowest and the highest tilt would otherwise appear at positions that differ by that distance. The motion is steady and the same everywhere; the displacement is applied per sweep, not per ray. DefaultNone: no advection, as before.time (
datetime-like, optional) – Analysis time formotion. Default: the mean time of the volume. Also thetimeof the result when given.repeats (
{"farthest", "mean", "latest", "nearest"}, optional) – What to do with several sweeps of the same elevation (within 0.1 degrees)."farthest"(default, as before) takes the one that reaches farthest, which sorts out the split cuts of NEXRAD. The other choices use all of them, for volumes that repeat the lowest tilt (SAILS and MESO-SAILS of NEXRAD, or any other repeated sweep):"mean"averages the repeats that have a value at the column,"latest"takes the latest repeat that has a value and"nearest"the one closest in time totime(default: the mean time of the volume). Withmotionevery repeat is moved to the analysis time before they are combined, so"mean"averages the echo at one position instead of smearing it. Merging is by elevation, not by time: repeated sweeps of the highest tilts are merged as well.max_gap (
float, optional) – Do not interpolate between rays more than this many median ray spacings apart (sector edges, missing rays). Default 2.min_weight (
float, optional) – Minimum share of the bilinear weight that must come from valid gates for a sweep value to be defined. Default 0.5, so values do not spread more than half a gate into missing data.n_threads (
int, optional) – Threads for the compiled kernel. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use."auto"(default) prefers the compiled kernel and falls back to NumPy.
- Returns:
xarray.Dataset– Gridded fields on(z, y, x)as float32, georeferenced as in CF: the azimuthal equidistant CRS centred on the radar as the scalarcrs_wkt(grid_mappingof every field), 2-Dlat(y, x)andlon(y, x)computed from it,standard_name,units,axisandpositiveonx,y,z, the radar site and the mean time of the volume as a scalartimecoordinate, so grids of several volumes stack along time withxr.concat(grids, "time"). Before radarx 0.5latwas 1-D alongyandlonalongx, which is wrong away from the radar (633 m in the corner of a 120 km wide grid).- Raises:
ValueError – If no sweep contains a requested variable, or the grid is missing.
ImportError – If
engine="compiled"and the compiled kernel is not available.
Notes
Beam height. The height of a gate above sea level is computed with the effective Earth radius model, h = [r^2 + (k_e a)^2 + 2 r k_e a sin(theta_e)]^(1/2) - k_e a with k_e = 4/3 by default (Doviak and Zrnić 1993 [2], Eq. 2.28b, p. 21; the same model is Eqs. 3-4, p. 32, of Zhang et al. 2005 [3]). Other values of
k_edescribe sub- or super-refractive conditions. The Earth radiusa(6371 km) is a radarx choice.What is taken from the literature, and what is not. Bilinear interpolation within a sweep and linear interpolation in height between the two sweeps around a cell are standard operations, here combined as described in the module docstring; the vertical step is analogous to the VI scheme of Zhang et al. (2005) [3] (Eqs. 5-7) but interpolates in beam height instead of elevation angle.
max_gap(2 median ray spacings),min_weight(0.5), the 0.1 degree tolerance with which sweeps of equal elevation are identified, and the rule that cells outside the bracketing cones stay empty are radarx choices, not values from a paper.Repeated sweeps.
repeats="mean","latest"and"nearest"are radarx’s own constructions; no publication was used for them. The repeats of one elevation (within 0.1 degrees) become one cone before the vertical interpolation, so a repeat adds no extra layer and no zero-thickness interval. Merging by the mean after moving each repeat to the analysis time assumes the steady motion ofmotion.Velocity gridding. Interpolating radial velocity from the polar grid (here and in the multi-Doppler input) can leave periodic gridding artifacts that map into spurious vertical velocities in variational retrievals (Collis et al. 2010 [1]); their mixed-order linear interpolation is not implemented.
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
Examples
>>> import numpy as np >>> x = y = np.arange(-150e3, 150e3 + 1, 500.0) >>> z = np.arange(500.0, 15e3 + 1, 500.0) >>> grid = radarx.grid.grid_cones(dtree, "DBZH", x, y, z)