radarx.retrieve.vertical_profiles.melting_layer#

radarx.retrieve.vertical_profiles.melting_layer(profiles, *, dbz='auto', rhohv='auto', zdr='auto', boundaries='onset', environment=None, height_range=(1000.0, 6000.0), freezing_level=None, freezing_level_window=(-1000.0, 500.0), rhohv_range=(0.8, 0.97), min_zdr=0.5, min_dbz=20.0, window=500.0, depth=1000.0, rhohv_onset=None, onset_fraction=0.1, edge_fraction=0.5, median_window=5, max_jump=500.0, max_fill=3, n_threads=None, engine='auto')[source]#

Melting-layer top and bottom from quasi-vertical profiles.

The melting layer shows up in polarimetric data as a ρhv minimum together with maxima of ZDR and Z, and the ρhv signature discriminates best (Giangrande et al. 2008 [1]). This function looks for that co-located signature in each profile, measures its depth, and checks the result for consistency along a time series. It is not an implementation of the algorithm of Giangrande et al. (2008) or of Ryzhkov and Krause (2022) [4]: the signature test is loosely modelled on the former, with different thresholds and window (see Notes), and every default below that is not attributed to a paper is radarx’s own choice:

  1. Signature. Within the search range (height_range, or freezing_level_window around the reference height, and always below the echo top), the anchor is the largest ZDR value >= zdr_min that has, within window metres, a ρhv minimum inside rhohv_range and a Z maximum >= dbz_min. ρhv dips without a ZDR and Z enhancement (e.g. near the echo top or in noisy data aloft) are not taken, nor is a ZDR peak that does not fall to half its prominence within depth on both sides.

  2. Top and bottom. boundaries selects the definition:

    • "onset" (default): where the signature begins and ends. The ρhv dip is the most objective marker of melting; Ryzhkov and Krause (2022) [4] (p. 533) state that its top corresponds to the freezing level or the height of the wet-bulb 0 °C level and its bottom, on average, to a temperature of about +3 °C, citing an earlier study. Going up and down from the ρhv minimum, as Griffin et al. (2020) [3] do, the edge is the first height where ρhv is back at its background: within onset_fraction (10 %) of the dip depth from the background, the largest ρhv within depth on that side. Griffin et al. (2020) use a fixed background, ρhv >= 0.97 in S-band QVPs (not checked against their paper); pass rhohv_onset=0.97 for their definition (the edge is then wherever either test is met first). Heights are interpolated linearly between gates. If ρhv does not rise on one side, the ZDR half-prominence edge is used.

    • "half_prominence": going up and down from the ZDR peak and from the ρhv minimum, each edge is the last gate before the anomaly has fallen by edge_fraction of its prominence over the background within depth metres; the layer spans the union of the ZDR and ρhv anomalies. This is the width at half height of the anomaly, so the layer is shallower than with "onset" and its top lies below the level where melting starts.

  3. Time consistency (profiles with a time dimension). Detections whose mid-height differs by more than max_jump from the running median over median_window profiles are rejected, and gaps of up to max_fill profiles between accepted detections are filled by linear interpolation in time. melting_layer_flag records what happened.

Steps 1 and 2 run in the compiled kernel, one profile per work item.

Parameters:
  • profiles (xarray.Dataset) – QVPs on an ascending height dimension (m above sea level), e.g. from qvp() or qvp_timeseries(), with Z, ZDR and ρhv.

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

  • boundaries ({"onset", "half_prominence"}, optional) – Definition of the top and bottom (step 2). Default "onset".

  • environment (xarray.Dataset or dict, optional) – The thermodynamic environment: a sounding or ERA5 profile from radarx.io.sounding (read_sounding(), era5_profile(), dtree.radarx.sounding(); several profiles concatenated on time are interpolated to the profile times), or a mapping or Dataset with freezing_level and/or wet_bulb_zero_height (m above sea level, scalars or DataArrays). Its 0 °C height (isotherm_height()) and wet-bulb 0 °C height (wet_bulb_zero_height(), if the profile has pressure and dewpoint) are returned with the offsets of the layer top from them, and, unless freezing_level is given, the search is constrained to freezing_level_window around the wet-bulb 0 °C height (the 0 °C height if there is none).

  • height_range (tuple of float, optional) – Heights (m above sea level) searched for the ZDR peak without a reference height (and where the reference height is missing). Default 1–6 km: the upper limit is the 6 km below which Giangrande et al. (2008) [1] (p. 1356, step 1) identify melting snow; the 1 km lower limit is radarx’s choice.

  • freezing_level (float or xarray.DataArray, optional) – Reference height for the search (m above sea level), e.g. the 0 °C level, a scalar or one value per profile (e.g. on time). If given, the ZDR peak is searched within freezing_level_window of it; it overrides the reference height from environment.

  • freezing_level_window (tuple of float, optional) – Search range for the ZDR peak relative to the reference height, default −1000 to +500 m (radarx choice: melting happens below the 0 °C level).

  • rhohv_range (tuple of float, optional) – Range for the ρhv minimum near the ZDR peak, default (0.80, 0.97). The upper bound is the 0.97 of Giangrande et al. (2008) [1] (p. 1356), but the lower bound deviates from their 0.90, which they chose to mitigate contamination by non-meteorological scatterers (Sect. 2d, p. 1357). radarx accepts lower values because the azimuthal mean of ρhv in a QVP (over gates with ρhv > 0.6) and gates that mix melting and non-melting echo can fall below 0.90; this is a radarx choice, not tested against the paper. Pass (0.90, 0.97) for the paper’s range.

  • min_zdr (float, optional) – Minimum ZDR peak, default 0.5 dB (radarx choice; Giangrande et al. 2008 [1] require a ZDR maximum between 0.8 and 2.5 dB, and there is no upper limit here).

  • min_dbz (float, optional) – Minimum Z maximum near the ZDR peak, default 20 dBZ (radarx choice; Giangrande et al. 2008 [1] require a Z maximum between 30 and 47 dBZ, and there is no upper limit here).

  • window (float, optional) – Co-location distance of the ρhv minimum and Z maximum from the ZDR peak, default 500 m, on both sides of the peak (the 500 m of Giangrande et al. 2008 [1] is a window above the gate of the ρhv signature).

  • depth (float, optional) – How far above and below the peak the background is sought, default 1000 m (radarx choice).

  • rhohv_onset (float, optional) – A fixed background ρhv for boundaries="onset", e.g. 0.97 as in Griffin et al. (2020). Default None: only onset_fraction.

  • onset_fraction (float, optional) – With boundaries="onset", the edge is where ρhv is within this fraction of the dip depth from the background, default 0.1 (radarx choice).

  • edge_fraction (float, optional) – Fraction of the prominence the anomaly must fall by at the edges with boundaries="half_prominence", default 0.5 (radarx choice).

  • median_window (int, optional) – Profiles in the running median, default 5 (radarx choice). 1 disables the check.

  • max_jump (float, optional) – Largest accepted distance from the running median, default 500 m (radarx choice).

  • max_fill (int, optional) – Longest gap (in profiles) filled by interpolation, default 3 (radarx choice); 0 disables filling.

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

  • engine ({"auto", "compiled", "numpy"}, optional) – Implementation of steps 1 and 2.

Returns:

xarray.Dataset – melting_layer_top, melting_layer_bottom and melting_layer_peak (height of the ZDR peak), in m above sea level, and melting_layer_flag (0 none, 1 detected, 2 rejected as inconsistent in time, 3 filled in time), on the non-height dimensions of profiles. With a reference height (environment or freezing_level) also freezing_level (0 °C height, or the given freezing_level), wet_bulb_zero_height (if the environment has it) and melting_layer_top_offset_freezing_level / melting_layer_top_offset_wet_bulb_zero, the height of the layer top above those levels.

Notes

Giangrande et al. (2008) [1] (Sect. 2b, p. 1356, steps 1 to 3 of their algorithm) flag individual radar gates with 0.90 < ρhv < 0.97 (below 6 km), search for the maxima of Z and ZDR in a 500 m window above each such gate and call the gate a melting-layer point if the maximum of Z lies between 30 and 47 dBZ and the maximum of ZDR between 0.8 and 2.5 dB. They then take the heights below which 80 % (top) and 20 % (bottom) of the points of an azimuth sector lie (p. 1357); this is not done here. The differences of this function are:

  • the search is anchored on the largest ZDR value (not on the ρhv gates) and looks for the ρhv minimum and the Z maximum within window metres on both sides of it;

  • rhohv_range is (0.80, 0.97), not (0.90, 0.97) (see that parameter);

  • min_zdr=0.5 dB and min_dbz=20 dBZ replace 0.8 dB and 30 dBZ, and there is no upper limit of 2.5 dB and 47 dBZ. The lower defaults are radarx’s choice, made because azimuthal averaging in a QVP smooths and weakens the extremes (Z is averaged over the whole circle, including weaker echo); they were not derived from the paper. Tune them for other radars and elevations.

Griffin et al. (2020) [3] define the top and bottom of the melting layer in S-band QVPs by searching upward and downward from the ρhv minimum for the first ρhv >= 0.97; they report that the reflectivity-curvature method of Fabry and Zawadzki (1995) [5] gave tops about 200 m higher and bottoms within about 50 m (not checked against the paper). Where the background is close to 1, as at S band, a fixed 0.97 is reached well inside the dip; the default relative test finds where ρhv first departs from its background, wherever that background lies (it is lower at C and X band and in noisy data). On the KGWX QVPs of 30–31 March 2022 the default top is about 190 m above the 0.97 top; this is a radarx result and is not the same comparison as that of Griffin et al.

Ryzhkov and Krause (2022) [4] state (p. 533, citing an earlier study for the second part) that the top of the ρhv (CC) dip of the melting layer corresponds to the freezing level or the height of the wet-bulb 0 °C level, and that its bottom, the end of snow melting, occurs on average at about +3 °C; they add that the dip can be detected at temperatures as high as 7 °C and that other authors report different bottoms. The "onset" top is therefore expected near the freezing level or the wet-bulb 0 °C height of the environment; the returned offsets quantify the difference. Their statement that the top and bottom of the dip can be estimated from QVPs with an accuracy of about 0.1 km (p. 540) is attributed by them to earlier QVP studies (among them Griffin et al. 2020 [3]); it is not a result of their paper, and it is not a validation of this function. Their own algorithm (radial profiles of ρhv at elevations below about 5–6 degrees matched to model profiles, Sect. 3; average bias against their RD-QVP products of −128 m for the top and −107 m for the bottom in four events, p. 541) is not QVP-based and is not implemented here.

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

>>> tqvp = radarx.retrieve.qvp_timeseries(volumes)
>>> ml = radarx.retrieve.melting_layer(tqvp)