radarx.retrieve.ensemble.ensemble_statistics#
- radarx.retrieve.ensemble.ensemble_statistics(obj, *, dim='member', percentiles=(5, 95), categorical=(), min_fraction=0.5, n_threads=None, engine='auto')[source]#
Mean, spread and percentiles over the members of an ensemble.
- Parameters:
obj (
xarray.DataArray,xarray.Datasetorxarray.DataTree) – Members alongdim, for example the output ofperturb_radar(), or<name>_membersofensemble_retrieval()(a DataArray needs a name). For a volume the sweeps that have the dimension are used. Dask arrays are loaded.dim (
str, optional) – Name of the member dimension. Default"member".percentiles (sequence of
float, optional) – Percentiles (0-100, exclusive) in addition to the median. Default(5, 95).categorical (sequence of
str, optional) – Names of variables that hold class codes (integers from 0): they get the mode and the agreement instead of the statistics.min_fraction (
float, optional) – Gates where fewer than this fraction of the members is finite are NaN. Default 0.5.n_threads (
int, optional) – Threads for the compiled kernel. Default: all cores.engine (
{"auto", "compiled", "numpy"}, optional) – Implementation to use. Default"auto".
- Returns:
xarray.Datasetorxarray.DataTree– For each variableXwith the dimension:X_mean,X_median,X_std(standard deviation withn - 1) andX_p05,X_p95for the default percentiles (seeradarx.retrieve.ensemble), orX_modeandX_agreementfor class codes, as float32 on the coordinates ofXwithoutdim. The percentiles interpolate linearly between the members (the default ofnumpy.percentile()). The input is not changed.- Raises:
KeyError – If no variable has the dimension.
ValueError – For percentiles outside (0, 100),
min_fractionoutside [0, 1] or an unknown engine.ImportError – If
engine="compiled"and the compiled kernel is not available.
Examples
>>> ens = radarx.retrieve.perturb_radar(sweep, members=16) >>> stats = radarx.retrieve.ensemble_statistics(ens)