radarx.grid.multi.grid_radars#

radarx.grid.multi.grid_radars(radars, x=None, y=None, z=None, origin=None, data_vars=None, *, names=None, time=None, motion=None, merge=None, calibrate=None, reference=0, rhohv='RHOHV', min_rhohv=None, max_range=None, beamwidth=1.0, range_scale=50000.0, time_scale=300.0, fill_below=False, fill_depth=None, fill_velocity=False, k_e=1.3333333333333333, coverage=True, advect_sweeps=False, max_gap=2.0, min_weight=0.5, n_threads=None, engine='auto')[source]#

Grid several radars onto one shared Cartesian grid.

Every radar volume is cone-gridded (radarx.grid.grid_cones()) onto the same grid: an azimuthal equidistant projection centred on origin with heights above sea level. For each radar the columns of the shared grid are located by their geodesic ground distance and azimuth from that radar (WGS84), so radars far from the origin are placed as accurately as the radar at it. All fields of all radars are gridded in one call of the compiled kernel.

The result keeps every radar separately along a radar dimension, together with the beam geometry from each radar to each cell (4/3 Earth radius model, as in xradar.georeference; Doviak and Zrnić 1993 [4], Eqs. 2.28b-d, pp. 21-22):

  • azimuth: direction of the beam at the cell, in degrees clockwise from the grid’s +y axis (grid north). This is the direction of the great circle from the radar where it crosses the cell, so it already contains the convergence of meridians and of the projection.

  • elevation: angle of the beam above the local horizontal at the cell, in degrees. It exceeds the antenna elevation by the central angle between radar and cell (earth curvature).

  • range: slant range from the radar to the cell, in metres.

so that a radial velocity is u sin(az) cos(el) + v cos(az) cos(el) + w sin(el) with (u, v, w) in the grid’s x, y, z axes.

Optionally

  • the fields of each radar are advected to a common analysis time along motion (Gal-Chen 1982 [1]; radarx.retrieve.advect()),

  • the fields in calibrate are corrected for their relative bias against the reference radar (network_bias()),

  • the fields in merge are merged into one weighted field (merge_radars()), stored as <field>_merged.

Parameters:
  • radars (list of xarray.DataTree) – Radar volumes with sweep_* groups and the radar site latitude, longitude and altitude, e.g. from xradar. A mobile radar’s site is its position during the volume.

  • x, y (array-like) – Grid coordinates (m) east and north of origin in its azimuthal equidistant projection.

  • z (array-like) – Grid heights above sea level, in metres.

  • origin (tuple of float, optional) – (latitude, longitude) of the grid origin. Default: the site of the first radar.

  • data_vars (str or list of str, optional) – Fields to grid. Default: every field on (azimuth, range) found in the lowest sweep of any radar. A radar without a field (or without any sweep containing it) gets NaN for it.

  • names (list of str, optional) – Radar names for the radar coordinate. Default: each volume’s instrument_name.

  • time (datetime-like, optional) – Analysis time. Default: the volume time of the first radar.

  • motion (xarray.Dataset or tuple of float, optional) – Storm motion, the output of radarx.retrieve.estimate_motion() or (u, v) in m/s. When given, every radar’s fields are advected from its volume time to time; the geometry is not moved.

  • merge (str or list of str, optional) – Fields to merge over all radars into <field>_merged.

  • calibrate (str or list of str, optional) – Fields (e.g. ["DBZH", "ZDR"]) whose relative biases are estimated with network_bias() and subtracted from every radar; the biases are stored as <field>_bias on the radar dimension.

  • reference (int or str, optional) – Reference radar (index or name) of the calibration. Default: the first radar.

  • rhohv (str, optional) – Co-polar correlation field used for min_rhohv. Default "RHOHV".

  • min_rhohv (float, optional) – Mask gates with a co-polar correlation below this (non-meteorological echoes) in every field before gridding, in sweeps that have rhohv. Default: no masking.

  • max_range (float, optional) – Discard cells farther than this slant range (m) from a radar.

  • beamwidth (float or list of float, optional) – Half-power beamwidth (degrees) of each radar, for the merge weights. Default 1.

  • range_scale, time_scale (float, optional) – Merge weight scales, see merge_radars(). Defaults 50 km (the value of Fig. 15 of Zhang et al. 2005 [3]) and 300 s (a radarx choice).

  • fill_below, fill_depth, fill_velocity, max_gap, min_weight (optional) – Cone gridding options, see radarx.grid.grid_cones().

  • k_e (float, optional) – Effective Earth radius factor of the beam geometry (Doviak and Zrnic 1993, Eq. 2.28). Default 4/3. It is stored in the k_e attribute so that merge_radars() uses the same value. See radarx.fundamentals.geometry.k_e_from_refractivity().

  • advect_sweeps (bool, optional) – With motion as a pair (u, v): move every sweep from its own mean time to the analysis time before the vertical interpolation, as in radarx.grid.grid_cones(), instead of moving the finished grid of each radar from its volume time. The tilts of a volume are minutes apart, so the latter leaves echoes at different positions in the lowest and highest tilt. Default False: the volume is moved as a whole.

  • coverage (bool, optional) – Add the coverage mask (default True), which tells a cell a radar looks at but sees no echo in from a cell it does not look at. merge_radars() needs it to treat the two differently.

  • n_threads (int, optional) – Threads for the compiled kernels. Default: all cores.

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation to use. "auto" (default) prefers the compiled kernels and falls back to NumPy.

Returns:

xarray.Dataset – On dimensions radar, z, y, x:

  • every gridded field on (radar, z, y, x), float32;

  • coverage on (radar, z, y, x), 1 where the radar’s cones bracket the cell (the cell is inside the volume the radar scans, whether or not it measured an echo there) and 0 outside; the sweeps of the field with the most sweeps define it;

  • azimuth on (radar, y, x), elevation and range on (radar, z, y, x), float32;

  • coordinates radar (names), radar_x, radar_y, radar_z (radar position in the grid frame, m; radar_z above sea level), radar_latitude, radar_longitude, radar_altitude, time (volume time of each radar), sweep_elevation on (radar, sweep);

  • x, y, z, 2-D lat and lon on (y, x) and the grid’s crs_wkt, with grid_mapping on every field that has x and y and standard_name, units and axis on the coordinates (CF);

  • optionally <field>_merged on (z, y, x) and <field>_bias on radar.

Raises:
  • ValueError – If no radar or no grid is given, or a volume has no sweeps or site.

  • ImportError – If engine="compiled" and the compiled kernels are not available.

See also

merge_radars, network_bias, radarx.grid.grid_cones, radarx.retrieve.advect

Notes

Source of each ingredient. The geodesic geometry of the columns is Vincenty (1975) [2] (equation numbers not checked against the paper). Moving the fields to a common time along the storm motion is the frame-of-reference correction of Gal-Chen (1982) [1] (equations not checked against the paper). It assumes steady translation. The beam geometry is the 4/3 Earth model [4]. Gridding, the merge weights and the calibration are described in grid_cones(), merge_radars() and network_bias(). The Earth radius (6371 km), beamwidth (1 degree) and time_scale defaults are radarx choices, not values from the references.

Dask. This function computes the dask array: it grids and combines several radars. The input is loaded into memory and the result is held in memory.

References

Examples

>>> x = y = np.arange(-150e3, 150e3 + 1, 1000.0)
>>> z = np.arange(500.0, 12e3 + 1, 500.0)
>>> grid = radarx.grid.grid_radars(
...     [kgwx, knqa], x, y, z, data_vars=["DBZH", "ZDR", "VRADH"],
...     merge="DBZH", calibrate=["DBZH", "ZDR"],
... )