radarx.retrieve.qpe_ensemble.qpe_error_ensemble#

radarx.retrieve.qpe_ensemble.qpe_error_ensemble(accumulation, *, sigma_ln, correlation_length, shares=(0.3, 0.5, 0.2), members=30, seed=0, scale=None)[source]#

Ensemble of a rainfall accumulation under a multiplicative lognormal error.

Member k is accumulation * exp(s w z_k - s**2 w**2 / 2) (see the module description), so the mean of the members is the accumulation and the variance of one member of a constant field A is A**2 (exp(s**2 w**2) - 1). The members are reproducible: member k is drawn from numpy.random.SeedSequence(seed).spawn(members)[k], so the same seed gives the same members and more members do not change the first ones.

Parameters:
  • accumulation (xarray.DataArray) – Depth in mm (or any positive quantity that adds up in time) on a regular grid with 2-D dimensions and coordinates in metres (the last two dimensions are taken as y and x).

  • sigma_ln (float) – Standard deviation s of ln(truth / estimate) (0.3 is about 30 %), between 0 and 3.

  • correlation_length (float) – Correlation length L of the spatially correlated part, in metres.

  • shares (sequence of three floats, optional) – Shares of the variance of z in (common, spatial, nugget): non-negative and adding up to 1. Default (0.3, 0.5, 0.2), an assumption, not a measurement; take them from qpe_error_model() when gauges are available.

  • members (int, optional) – Number of members, 2 or more. Default 30.

  • seed (int, optional) – Seed of the random numbers. Default 0.

  • scale (xarray.DataArray or array_like, optional) – w: scales the error cell by cell (for example the relative uncertainty of the estimate divided by its median). Default 1.

Returns:

xarray.DataArray – float32 members on the dimension member followed by the dimensions of accumulation, in the units of accumulation.

Raises:

ValueError – For wrong sigma_ln, shares, members, correlation_length or an irregular grid.

Notes

Dask. This function computes the dask array: it simulates correlated fields over the whole grid. The input is loaded into memory and the result is held in memory.

See also

qpe_error_model, exceedance_probability, reliability

References

Examples

>>> ens = radarx.retrieve.qpe_error_ensemble(
...     acc, sigma_ln=0.35, correlation_length=25e3, members=100
... )
>>> p = radarx.retrieve.exceedance_probability(ens, 25.0)