radarx.retrieve.dsd_bayes.dsd_bayesian#

radarx.retrieve.dsd_bayes.dsd_bayesian(obj, *, dbz=None, zdr=None, kdp=None, ah=None, mask=None, band=None, temperature=20.0, prior='generic', errors=None, quantiles=(0.025, 0.16, 0.5, 0.84, 0.975), prune=15.0, n_threads=None, engine='auto')[source]#

Bayesian retrieval of the raindrop size distribution with uncertainty.

Posterior of \((\log_{10} N_w, D_m, \mu)\) of a normalized gamma DSD at every gate from \(Z_H\), \(Z_{DR}\) and, if given, \(K_{DP}\) and \(A_H\), with T-matrix forward operators, a measurement-error model and a prior learned from disdrometers. See radarx.retrieve.dsd_bayes for the method.

Parameters:
  • obj (xarray.Dataset or xarray.DataTree) – A sweep, a grid, a QVP or any dataset holding reflectivity and differential reflectivity on the same coordinates, or a volume with sweep_* groups (sweeps without both fields are skipped).

  • dbz, zdr (str, optional) – Names of the reflectivity (dBZ) and differential reflectivity (dB), calibrated and corrected for attenuation. By default the first found of the names radarx.retrieve.dsd() looks for.

  • kdp (str, xarray.DataArray, xarray.DataTree or "estimate", optional) – Specific differential phase (degree km-1) as for radarx.retrieve.dsd(); used at every gate where it is finite, with its error model (no threshold is needed). Default: not used.

  • ah (str or xarray.DataArray, optional) – Specific attenuation at horizontal polarization (dB km-1), e.g. from an attenuation correction. Default: not used.

  • mask (str, xarray.DataArray or xarray.DataTree, optional) – Rain gates (True); the others are left empty. As for radarx.retrieve.dsd().

  • band ({"S", "C", "X"}, optional) – Radar band; by default from the metadata as for radarx.retrieve.dsd().

  • temperature (float, optional) – Rain temperature in degrees Celsius (0-30). Default 20.

  • prior ({"generic", "perils2022"} or xarray.Dataset, optional) – Prior of the DSD parameters (see dsd_prior()). Default "generic".

  • errors (dict, optional) – Standard deviations overriding ERRORS: zh and zh_bias (dB), zdr and zdr_bias (dB), kdp (degree km-1) and kdp_rel, ah (dB km-1) and ah_rel.

  • quantiles (sequence of float, optional) – Posterior quantiles to return, in (0, 1). Default: the medians and the bounds of the central 68 % and 95 % credible intervals.

  • prune (float, optional) – Grid nodes whose evidence from \(Z_H\), \(Z_{DR}\) and the prior is more than prune nats below the best node are skipped. Default 15 (a relative weight below \(10^{-6}\)).

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

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

Returns:

xarray.Dataset or xarray.DataTree – On the coordinates of the reflectivity: the posterior means LOG10_NW, DM (mm), MU, RAIN_RATE (mm/h) and LWC (g/m3), their standard deviations *_SD, their quantiles *_QUANTILES along quantile, NW = 10 ** LOG10_NW, the maximum a posteriori state LOG10_NW_MAP, DM_MAP, MU_MAP, its MISFIT (chi-squared over N_OBS inputs) and the LOG_EVIDENCE. NaN where an input is missing or the mask is False. For a volume, a DataTree with one node per sweep.

Raises:
  • KeyError – If a requested field is missing, or no sweep has the fields.

  • ValueError – For unknown options.

  • ImportError – If engine="compiled" and the compiled kernel is not available.

Notes

The method follows the Bayesian formulation of Cao et al. (2010, Eqs. 3-5) but with a different state, error model, prior and observations (see radarx.retrieve.dsd_bayes; Cao et al. 2013 is related work on attenuation, no equation of it is used). The forward model is for horizontal incidence: for data at elevations above about 5 degrees (QVPs at 10-20 degrees) \(Z_{DR}\) is biased low (about 12 % at 20 degrees), so \(D_m\) is biased low by 6-8 % and \(N_w\) high; see radarx.retrieve.dsd. errors and prune defaults are radarx choices. The state uses the normalized gamma DSD of Testud et al. (2001) and the posterior formalism of Rodgers (2000).

Dask. This function computes the dask array: the posterior is evaluated for all gates on a grid. The input is loaded into memory and the result is held in memory.

References

Testud, J., S. Oury, R. A. Black, P. Amayenc, and X. Dou, 2001: The concept of “normalized” distribution to describe raindrop spectra: A tool for cloud physics and cloud remote sensing. J. Appl. Meteor., 40 (6), 1118-1140, https://doi.org/10.1175/1520-0450(2001)040<1118:TCONDT>2.0.CO;2

Cao, Q., G. Zhang, E. Brandes, and T. Schuur, 2010: Polarimetric radar rain estimation through retrieval of drop size distribution using a Bayesian approach. J. Appl. Meteor. Climatol., 49 (5), 973-990, https://doi.org/10.1175/2009JAMC2227.1

Cao, Q., G. Zhang, and M. Xue, 2013: A variational approach for retrieving raindrop size distribution from polarimetric radar measurements in the presence of attenuation. J. Appl. Meteor. Climatol., 52 (1), 169-185, https://doi.org/10.1175/JAMC-D-12-0101.1

Rodgers, C. D., 2000: Inverse Methods for Atmospheric Sounding: Theory and Practice. World Scientific, 238 pp., https://doi.org/10.1142/3171

Examples

>>> post = radarx.retrieve.dsd_bayesian(sweep, kdp="KDP")
>>> post.DM_QUANTILES.sel(quantile=[0.16, 0.84])