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 onoriginwith 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
radardimension, together with the beam geometry from each radar to each cell (4/3 Earth radius model, as inxradar.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+yaxis (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’sx,y,zaxes.Optionally
the fields of each radar are advected to a common analysis
timealongmotion(Gal-Chen 1982 [1];radarx.retrieve.advect()),the fields in
calibrateare corrected for their relative bias against thereferenceradar (network_bias()),the fields in
mergeare merged into one weighted field (merge_radars()), stored as<field>_merged.
- Parameters:
radars (
listofxarray.DataTree) – Radar volumes withsweep_*groups and the radar sitelatitude,longitudeandaltitude, 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
originin its azimuthal equidistant projection.z (array-like) – Grid heights above sea level, in metres.
origin (
tupleoffloat, optional) –(latitude, longitude)of the grid origin. Default: the site of the first radar.data_vars (
strorlistofstr, 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 (
listofstr, optional) – Radar names for theradarcoordinate. Default: each volume’sinstrument_name.time (
datetime-like, optional) – Analysis time. Default: the volume time of the first radar.motion (
xarray.Datasetortupleoffloat, optional) – Storm motion, the output ofradarx.retrieve.estimate_motion()or(u, v)in m/s. When given, every radar’s fields are advected from its volume time totime; the geometry is not moved.merge (
strorlistofstr, optional) – Fields to merge over all radars into<field>_merged.calibrate (
strorlistofstr, optional) – Fields (e.g.["DBZH", "ZDR"]) whose relative biases are estimated withnetwork_bias()and subtracted from every radar; the biases are stored as<field>_biason theradardimension.reference (
intorstr, optional) – Reference radar (index or name) of the calibration. Default: the first radar.rhohv (
str, optional) – Co-polar correlation field used formin_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 haverhohv. Default: no masking.max_range (
float, optional) – Discard cells farther than this slant range (m) from a radar.beamwidth (
floatorlistoffloat, optional) – Half-power beamwidth (degrees) of each radar, for the merge weights. Default 1.range_scale, time_scale (
float, optional) – Merge weight scales, seemerge_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 thek_eattribute so thatmerge_radars()uses the same value. Seeradarx.fundamentals.geometry.k_e_from_refractivity().advect_sweeps (
bool, optional) – Withmotionas a pair(u, v): move every sweep from its own mean time to the analysis time before the vertical interpolation, as inradarx.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. DefaultFalse: the volume is moved as a whole.coverage (
bool, optional) – Add thecoveragemask (defaultTrue), 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 dimensionsradar,z,y,x:every gridded field on
(radar, z, y, x), float32;coverageon(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;azimuthon(radar, y, x),elevationandrangeon(radar, z, y, x), float32;coordinates
radar(names),radar_x,radar_y,radar_z(radar position in the grid frame, m;radar_zabove sea level),radar_latitude,radar_longitude,radar_altitude,time(volume time of each radar),sweep_elevationon(radar, sweep);x,y,z, 2-Dlatandlonon(y, x)and the grid’scrs_wkt, withgrid_mappingon every field that hasxandyandstandard_name,unitsandaxison the coordinates (CF);optionally
<field>_mergedon(z, y, x)and<field>_biasonradar.
- 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.advectNotes
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()andnetwork_bias(). The Earth radius (6371 km),beamwidth(1 degree) andtime_scaledefaults 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"], ... )