radarx.retrieve.ensemble.perturb_radar#
- radarx.retrieve.ensemble.perturb_radar(obj, *, dbz=None, zdr=None, phidp=None, rhohv=None, field=None, members=32, seed=0, calibration=(1.0, 0.1), noise=True, n_samples=64, snr=None, spectrum_width=3.0, nyquist=None, n_threads=None, engine='auto')[source]#
Copies of the radar fields with random calibration and measurement errors.
- Parameters:
obj (
xarray.DataArray,xarray.Datasetorxarray.DataTree) – A named field (DataArray), a sweep or grid, or a volume withsweep_*groups (sweeps without any of the fields are skipped).dbz, zdr, phidp, rhohv, field (
str, optional) – Names of the reflectivity (dBZ), the differential reflectivity (dB), the differential phase (degrees), the copolar correlation coefficient and the radial velocity (m s-1). By default the first name found ofDBZH,DBZ,reflectivity,corrected_reflectivity;ZDR,differential_reflectivity,corrected_differential_reflectivity;PHIDP,differential_phase,UPHIDP;RHOHV,cross_correlation_ratio,RHO;VRADH,VRAD,velocity,corrected_velocity. A field that is not found is left out; at least one is needed.members (
int, optional) – Number of members. Default 32.seed (
int, optional) – Seed of the random numbers, an integer in [0, 2**64). Default 0.calibration (
(float,float)orNone, optional) – Standard deviations (dB) of the offsets of the reflectivity and the differential reflectivity; one offset per member and field, the same for every gate. Default(1.0, 0.1);Nonefor no offsets.noise (
bool, optional) – Add the measurement noise ofmeasurement_error(). Default True.n_samples (
float, optional) – Number of pulse pairs \(M\) of an estimate (or the number of independent estimates averaged). Default 64, the value of the figures of Melnikov and Zrnic (2004). At least 4.snr (
float,str,xarray.DataArrayor"estimate", optional) – Signal-to-noise ratio (dB) of the horizontal channel: a number, the name of a field, a DataArray, or"estimate"to compute it withradarx.retrieve.snr(). Default: the fieldSNR(orSNRH,signal_to_noise_ratio) if there is one, else no noise from the receiver (only the variance of the signal). Gates where it is NaN give NaN.spectrum_width (
float,strorxarray.DataArray, optional) – Spectrum width \(\sigma_v\) (m s-1) as a number, a field name or a DataArray. Default 3, the value of Figs. 2.7 and 3.6 of Melnikov and Zrnic (2004).nyquist (
float, optional) – Nyquist velocity (m s-1). Default: the mediannyquist_velocityof the data, else 25.n_threads (
int, optional) – Threads for the compiled kernel. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use."auto"(default) prefers the compiled kernel and falls back to NumPy.
- Returns:
xarray.DataArray,xarray.Datasetorxarray.DataTree– The perturbed fields under their own names, with the extra dimensionmember(a DataArray for a DataArray input). For a volume a DataTree with one such node per sweep. The input is not changed.- Raises:
KeyError – If no field is found.
ValueError – For unknown options,
membersbelow 2,n_samplesbelow 4 or aseedoutside the range.ImportError – If
engine="compiled"and the compiled kernel is not available.
Notes
The error model, the random numbers and the limits of the formulas are in
radarx.retrieve.ensemble. Membermof a sweep depends only onseed, the sweep number andm, so that any member can be recomputed alone, and more members extend the ensemble.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
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.perturb_radar(sweep, members=16, seed=1) >>> ens.DBZH.std("member")