radarx.grid.multi.merge_radars#
- radarx.grid.multi.merge_radars(obj, data_vars='DBZH', *, bias=None, time=None, range_scale=50000.0, time_scale=300.0, beamwidth=None, no_echo='min', average='dbz', time_weight=None, k_e=None, blockage=None, max_blockage=0.5, n_threads=None, engine='auto')[source]#
Weighted merge of the radars of a multi-radar grid.
At every cell the defined values of all radars are averaged with weights
\[w = \exp(-r^2 / L^2) \; \delta_e \; \exp(-\Delta t^2 / \tau^2)\]ris the slant range from the radar andL = range_scale: the nearer radar, with the smaller, lower beam, dominates. This is the Gaussian distance weightw = exp(-d^2 / R^2)withR = 50 kmof Zhang et al. (2005) [1], shown in their Fig. 15 (p. 41), wheredis the distance between the grid cell and the radar. The paper gives the function only as the legend of that figure; its text (p. 39-40) says the weight decreases monotonically with range and that the steep function (this one) is preferred over a flat alternative. radarx uses the slant range fordand keeps 50 km as the default;delta_eis the elevation weight of Lakshmanan et al. (2006) [2], Eq. (6), p. 808,exp(|a|^3 ln 0.005), whereais the angular distance of the cell from the nearest beam axis as a fraction of the larger of the beamwidth and the spacing to the next sweep: 1 on a beam axis, 0.52 half way between sweeps and 0.005 one spacing away (the paper quotes 0.5 and below 0.01). Cone gridding fills the gaps between sweeps; this weight lets a radar whose beam passes through the cell override one that interpolates across a gap. This factor reproduces the paper’s formula;dtis the time between the radar’s volume and the analysis time andtau = time_scale, so the most recent radar dominates. This time factor is a radarx choice (a Gaussian withtau= 300 s) and is not taken from either paper. If the grid was advected to the analysis time (grid_radars(motion=...)) the radars’ echoes already stand at that time, so the factor is switched off unlesstime_weight=True.
Difference from Lakshmanan et al. (2006). That paper weights an observation (an “agent”, including repeated scans of the same radar) by
delta = delta_e exp[-(t^2 r^2 / beta)](their Eq. 7, p. 809), withtthe time between the observation and the grid time in seconds,rthe range of the gate in km andbeta = 17.36 s^2 km^2, “chosen through experimentation”. There the range matters only through the productt r: att = 0every range has weight 1 and the time weight is tighter at long range. radarx instead multiplies a range Gaussian and a time Gaussian that act independently, so the range weight also separates two radars observed at the same time. radarx therefore does not reproduce the merger of Lakshmanan et al. (2006); only the elevation weight is theirs and only the range weight is Zhang et al.’s. (With the paper’s units a 60 s old scan at 50 km would have weightexp(-5.2e5), sobetais meaningful only for time offsets of a few seconds; the paper does not resolve this.) The paper’s text before Eq. 7 also describes the agent weight simply as an exponentially declining function of the distance from the radar.A scale of
Noneor 0 switches its factor off.Beam blockage. With
blockage(a gridded fraction of the beam blocked by terrain, e.g. theCBBofradarx.retrieve.beam_blockage()gridded with the data) the weight is multiplied by1 - b, and a radar is dropped from the cells whereb >= max_blockage. A blocked radar then gives way to the unblocked ones, and the merge does not depend on the blocked radar where less than half of its beam gets through. The factor1 - band the default limit of 0.5 are radarx choices, not taken from a publication. Cells where the blockage is NaN (no terrain data) are not penalised.Coverage and echo. Where one radar has an echo and another looks at the cell (
coveragein the grid) but reports nothing, the second radar is below its sensitivity there, not absent. Skipping it, as an average over defined values does, lets the nearer and more sensitive radar decide alone and biases the merge high at the edges of storms. Withno_echoa covered cell without an echo takes a low value instead and takes part in the average; a cell outside a radar’s coverage never does."min"(default) uses the lowest value that radar reports in the field, only for reflectivity (units dBZ); a number is used as it is, for any field;Noneskips undefined values, as before. A covered undefined cell can also be a gate removed by quality control, which this cannot tell from a sub-threshold gate. Grids withoutcoveragebehave asNone.Averaging.
average="dbz"(default) averages in the units of the field.average="linear"averages the linear value10**(x / 10)(for reflectivity the linear reflectivity factor Z) and converts back to dB, which is what a mean over a sample volume of several radars measures when the radars see the same scatterers. Which of the two Zhang et al. (2005) use was not checked against the paper.- Parameters:
obj (
xarray.Dataset) – Output ofgrid_radars().data_vars (
strorlistofstr, optional) – Fields to merge. Default"DBZH".bias (
xarray.Datasetordict, optional) – Biases to subtract first: the output ofnetwork_bias()(for a single field) or{field: DataArray on radar}.time (
datetime-like, optional) – Analysis time for the time weights. Default: the grid’sanalysis_timeattribute or the first radar’s time.range_scale (
float, optional) –Lin metres. Default 50 km.time_scale (
float, optional) –tauin seconds. Default 300 s.beamwidth (
floatorlistoffloat, optional) – Beamwidth (degrees) per radar. Default: the grid’sbeamwidth.no_echo (
{"min", None}orfloat, optional) – Value of cells a radar covers but has no echo in, see above. Default"min";Nonerestores skipping them.average (
{"dbz", "linear"}, optional) – Average in the units of the field (default) or in linear units.time_weight (
bool, optional) – Apply the time factor. Default: off for a grid advected to the analysis time, on otherwise.k_e (
float, optional) – Effective Earth radius factor of the beam geometry. Default: the grid’sk_eattribute, else 4/3.blockage (
strorxarray.DataArray, optional) – Fraction of the beam blocked by terrain (0 to 1) on(radar, z, y, x), or on some of these dimensions: the name of a field ofobjor a DataArray. See above. DefaultNone: no blockage weight.max_blockage (
float, optional) – Blockage at and above which a radar does not take part. Default 0.5.n_threads (
int, optional) – Threads for the compiled kernel. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use.
- Returns:
xarray.Dataset– Merged fields on(z, y, x)with<field>_weight, the sum of the weights, and the grid’s coordinates without theradardimension.- Raises:
ValueError – If a field is not in
obj,averageorno_echois not valid, abiasDataset belongs to another field,blockageis not a field ofobjormax_blockageis not in (0, 1].
Notes
Dask. This function computes the dask array: it combines the grids of several radars. The input is loaded into memory and the result is held in memory.
References
Examples
>>> merged = radarx.grid.merge_radars(grid, "DBZH") >>> merged = radarx.grid.merge_radars( ... grid, "DBZH", blockage="CBB" ... )