radarx.retrieve.ensemble.ensemble_retrieval#
- radarx.retrieve.ensemble.ensemble_retrieval(obj, retrieval, *, dbz=None, zdr=None, phidp=None, rhohv=None, field=None, members=32, seed=0, calibration=(1.0, 0.1), noise=True, prior=True, percentiles=(5, 95), variables=None, categorical=None, keep_members=False, min_fraction=0.5, band=None, attenuation=None, options=None, n_threads=None, engine='auto')[source]#
Run a retrieval on an ensemble of perturbed radar data.
Every member is a copy of the radar fields with random calibration offsets and measurement noise (
perturb_radar()) and, ifprioris set, with a random change of the DSD prior of the retrieval. The retrievals of radarx run on each member, and the result holds the statistics of the products over the members, seeradarx.retrieve.ensemble.- Parameters:
obj (
xarray.DataArray,xarray.Datasetorxarray.DataTree) – A sweep, a grid or a volume withsweep_*groups (sweeps without a radar field are skipped), or a named field (DataArray). The fields are the raw measurements: the reflectivity and differential reflectivity as measured (they are corrected for attenuation inside the ensemble ifattenuationis set), the differential phase before any processing and the correlation coefficient.retrieval (
strorcallable()) – What runs on each member. One of"kdp"(estimate_kdp()from the perturbed phase, productKDP),"attenuation"(correct_attenuation():DBZH_corrected,ZDR_corrected,AH),"rain_rate_z","rain_rate_kdp"(withKDPestimated from the member’s phase),"rain_rate_z_zdr","rain_rate_a"(withAHfrom the attenuation correction),"dsd"(dsd():DM,LOG10_NW,MU,RAIN_RATE,LWC),"dsd_bayesian"(the posterior means ofdsd_bayesian()) and"hid"(hid(): class codesHID). Or a functionf(dataset, **options)that takes a sweep with the perturbed fields under the namesDBZH,ZDR,PHIDP,RHOHVandVRADHand returns a Dataset or DataArray.dbz, zdr, phidp, rhohv, field (
str, optional) – Names of the fields, as forperturb_radar().members (
int, optional) – Number of members. Default 32.seed (
int, optional) – Seed of the random numbers. Default 0.calibration (
(float,float)orNone, optional) – Standard deviations (dB) of the calibration offsets of the reflectivity and the differential reflectivity. Default(1.0, 0.1).noise (
boolordict, optional) – Add the measurement noise. A dict setsn_samples,snr,spectrum_widthandnyquistas forperturb_radar(). Default True.prior (
boolordict, optional) – Change the DSD prior of the retrieval for each member. True uses the defaults, a dict overrides the standard deviationsrelation(the log of the rain rate prefactor, fromrelation_scatter()),alpha(the log of the attenuation coefficients, fromrelation_scatter()),mu(shape of the"dsd"retrieval; the standard deviation of \(\mu\) under the generic prior),tilt(0.5; tilt of the prior of"dsd_bayesian"in standard deviations of \(D_m\) and \(\mu\)) andlog10_nw(0.3; shift of the prior mean of \(\log_{10} N_w\)); the last two are radarx choices. False or None for no change. Only the entries that belong to the retrieval act. The draws are common to all gates of a sweep. Not used by"kdp","hid"or a function.percentiles (sequence of
float, optional) – Percentiles (0-100, exclusive) besides the median. Default(5, 95).variables (sequence of
str, optional) – Variables of the retrieval to keep. Default: those listed forretrieval(the data variables of the result for a function).categorical (sequence of
str, optional) – Variables that hold class codes (integers from 0): they get the mode and the agreement. Default:("HID",)for"hid", none otherwise.keep_members (
bool, optional) – Also return every member of every product as<name>_memberswith the dimensionmember. Default False.min_fraction (
float, optional) – Gates where fewer than this fraction of the members is finite are NaN. Default 0.5.band (
{"S", "C", "X"}, optional) – Radar band for the retrieval and for the attenuation correction. By default as the retrieval finds it ("S"for the rain rates).attenuation (
strordict, optional) – Correct the reflectivity and differential reflectivity of each member for attenuation before the retrieval, with the method ("zphi"or"linear") or a dict of options ofcorrect_attenuation(). Always on for"attenuation"and"rain_rate_a"("zphi").options (
dict, optional) – Options of the retrieval function (for"kdp"those ofestimate_kdp();kdp_optionsfor the phase processing of the others; for"dsd","dsd_bayesian"and"hid"kdp="estimate"uses the phase of each member). Do not give the names of the fields.n_threads (
int, optional) – Threads of the kernels. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use. Default"auto".
- Returns:
xarray.Datasetorxarray.DataTree– For each productX:X_mean,X_median,X_std,X_p05andX_p95(orX_modeandX_agreement), float32 on the coordinates of the product, andX_memberswithkeep_members. The attributesensemble_members,ensemble_seedandensemble_methoddescribe the ensemble. For a volume, a DataTree with one such node per sweep and the root of the input. The input is not changed.- Raises:
KeyError – If no sweep has a radar field, or a requested variable is not returned by the retrieval.
ValueError – For an unknown retrieval, option or engine, or
membersbelow 2.ImportError – If
engine="compiled"and the compiled kernel is not available.
Notes
The members run one after the other; each runs threaded in C++ over its gates or rays. The error model, the draws and their limits are in
radarx.retrieve.ensemble."dsd_bayesian"models errors of its own (errors) inside the posterior: the spread of its posterior means over the ensemble comes on top of the posterior standard deviation and is not a replacement for it.References
Melnikov, V. M., and D. S. Zrnic, 2004: Simultaneous transmission mode for the polarimetric WSR-88D: Statistical biases and standard deviations of polarimetric variables. NOAA/NSSL report, 84 pp., https://www.nssl.noaa.gov/publications/wsr88d_reports/SHV_statistics.pdf
Giangrande, S. E., A. V. Ryzhkov, V. M. Melnikov, and J. Krause, 2004: Calibration of the polarimetric NEXRAD radar using meteorological signals. Preprints, 11th Conf. on Aviation, Range, and Aerospace Meteorology, paper P5.15, https://ams.confex.com/ams/11aram22sls/techprogram/paper_81811.htm
Ryzhkov, A., M. Diederich, P. Zhang, and C. Simmer, 2014: Potential utilization of specific attenuation for rainfall estimation, mitigation of partial beam blockage, and radar networking. J. Atmos. Oceanic Technol., 31 (3), 599-619, https://doi.org/10.1175/JTECH-D-13-00038.1
Salmon, J. K., M. A. Moraes, R. O. Dror, and D. E. Shaw, 2011: Parallel random numbers: as easy as 1, 2, 3. Proc. 2011 Int. Conf. for High Performance Computing, Networking, Storage and Analysis, 1-12, https://doi.org/10.1145/2063384.2063405
Examples
>>> ens = radarx.retrieve.ensemble_retrieval( ... sweep, "rain_rate_kdp", members=32, seed=1 ... ) >>> ens.RAIN_RATE_KDP_std