radarx.retrieve.melting_layer_gradients.melting_layer_gradient#

radarx.retrieve.melting_layer_gradients.melting_layer_gradient(profiles, *, dbz='auto', rhohv='auto', zdr='auto', height_range=None, top_window=None, n_threads=None, engine='auto')[source]#

Melting-layer top and bottom from the gradients of a vertical profile.

This is the algorithm of Allabakash et al. (2019) [1] (Sect. 2.2, Fig. 2), who apply it to the profile of RHI scans of an X-band radar and refine the method of Wolfensberger et al. (2016) [2] that uses Z and ρhv only. For every profile (and every time):

  1. Z (dBZ), ZDR (dB) and ρhv are divided by their maximum in the profile and the absolute value is taken (AN(x)).

  2. The products AN(Z) (1 - AN(ρhv)), AN(ZDR) (1 - AN(ρhv)) and AN(Z) AN(ZDR) (1 - AN(ρhv)) are formed, and the gradients of these, of AN(Z) and of AN(ρhv) are computed along the height.

  3. The bottom is the height at which the gradient maximum of at least two of the three products fall together.

  4. The top starts from the height c at which the gradient minimum of at least two of the products fall together. If it is also the height of the minimum gradient of AN(Z) and of the maximum gradient of AN(ρhv) it is the top. Otherwise, if one of these two heights is above c, the higher one is the top (ZDR is low in the ice, so the ZDR peak lies below the Z and ρhv signature, and the top has to be corrected). Otherwise the top is the gate above c.

No layer is reported where the maxima or the minima of the products do not fall together.

Parameters:
  • profiles (xarray.Dataset) – Profiles on an ascending height dimension (m above sea level) with Z, ZDR and ρhv, e.g. from radarx.retrieve.qvp(), radarx.retrieve.qvp_timeseries() or radarx.retrieve.rhi_qvp(). Other dimensions (time, azimuth) are kept.

  • dbz, rhohv, zdr (str, optional) – Variable names; "auto" (default) looks for common names and the CF standard names.

  • height_range (tuple of float, optional) – Only the gates between these heights (m above sea level) are used, also for the normalisation. Default: the whole profile (as in the paper). Use it to keep the noise at the echo top and the clutter near the ground out of the gradients.

  • top_window (float, optional) – Radarx’s addition, not in the paper: the minimum gradient of Z and the maximum gradient of ρhv of step 4 are searched only within this distance (m) of the height c of step 4, instead of in the whole profile. In snow Z falls with height and its steepest decrease can lie km above the layer, which the whole-profile search takes for the top (see Notes). Default None: the whole profile, as in the paper.

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

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation to use.

Returns:

xarray.Dataset – melting_layer_top, melting_layer_bottom and melting_layer_thickness in m (the heights above sea level; NaN where there is no layer), melting_layer_flag (0 none, 1 detected, 2 inconsistent: the top is not above the bottom, heights are NaN) and melting_layer_top_step (the step of the paper that gave the top: 3, 4 or 5; 0 where there is no layer), on the dimensions of profiles except height. The bottom is the variable that radarx.retrieve.mask_above_melting_layer() takes.

See also

melting_layer_rhi, radarx.retrieve.melting_layer, radarx.retrieve.rhi_qvp

Notes

The paper states the algorithm in words and a flow chart; where it does not fix a detail, the choice is radarx’s:

  • The gradient is the derivative along the height in metres (second-order central differences, as numpy.gradient()). The paper does not say whether it is taken per gate or per metre; the heights of the extremes do not depend on it for regular heights.

  • The products use the normalised variables (the order of the flow chart: normalise, combine, take gradients). Normalising the products again does not move their extremes.

  • Gradient extremes “coincide” where they are at the same gate, and the top of step 3 is “consistent” where the same gate holds both gradient extremes. The first gate is taken where several gates have the same value.

  • Z is in dBZ and ZDR in dB, as in Fig. 3 of the paper, where the normalised Z lies between 0.7 and 1. Negative values enter through their absolute values, as the paper defines (AN); a profile whose maximum of Z, ZDR or ρhv is not positive has no layer.

  • A layer whose top is not above its bottom is flagged (2) and has no heights; the paper does not discuss this.

  • Without coinciding minima there is no top, so no layer, although the flow chart of the paper only shows the absence for the bottom.

  • The time consistency of radarx.retrieve.melting_layer() is not applied and neither are the quality limits on the heights that the paper does not give.

  • top_window is radarx’s addition (default off, the paper’s search of the whole profile).

The paper validates the layer of an X-band RHI QVP against the height of the 0 °C wet-bulb temperature of MERRA reanalysis (correlation 0.96, Sect. 4). radarx has no RHI with the three variables and cannot repeat that. On QVPs (profiles of 100 m bins, height_range=(500, 8000), top_window=500) the layer of this function was compared with radarx.retrieve.melting_layer() ("onset"). Behind the KGWX squall line of 31 March 2022 (S band, stratiform rain, 4 volumes between 00:12 and 01:05 UTC) the top is on average 113 m below the onset top (standard deviation 107 m), 60 m below the ERA5 wet-bulb 0 °C height of the radar (3.51 km, median top 3.45 km) and the bottom 212 m above the onset bottom. On ARMOR (C band, convective rain, 11 April 2008, 15 of 25 profiles have a layer) the median top is 268 m below the onset top (correlation 0.04, the standard deviation is 355 m), 62 m above the BMX wet-bulb 0 °C height and 209 m below its 0 °C height, and the bottom is 411 m above the onset bottom. Without top_window the tops lie 1 to 3 km too high in all four KGWX profiles and in about a third of the ARMOR profiles: the minimum gradient of Z of step 4 is searched in the whole profile, and in snow Z decreases with height, so its steepest decrease is usually far above the layer. Without height_range and without averaging a native 26 m QVP into 100 m bins the gradients are dominated by noise at the echo top and at the ground. The method is made for averaged profiles of stratiform precipitation; use it with the window on QVPs.

Dask. This function computes the dask array: the layer is found from the whole profile. The input is loaded into memory and the result is held in memory.

References

Examples

>>> profile = radarx.retrieve.rhi_qvp(rhi)
>>> layer = radarx.retrieve.melting_layer_gradient(profile)