radarx.retrieve.precip_frequency.return_period#

radarx.retrieve.precip_frequency.return_period(depth, periods, depths, *, period_dim='period')[source]#

Return period of a rainfall depth, from depth-for-return-period estimates.

For each cell the depths of the table at the return periods periods give a curve; the return period of depth is read from it by linear interpolation of ln(period) against ln(depth). A depth below the depth of the shortest period gets that period and the flag -1, a depth above the depth of the longest period gets that period and the flag +1; nothing is extrapolated. A cell is NaN where the depth or any of its table depths is missing or not positive, or where the table depths fall with the return period.

Parameters:
  • depth (xarray.DataArray) – Rainfall depth, in the units of depths (for example mm).

  • periods (array_like) – Return periods in years, increasing, at least two.

  • depths (xarray.DataArray or array_like) – Depth for each return period: a DataArray with the dimension period_dim (length len(periods)) and the dimensions of depth, or a 1-D array-like for one table that is used everywhere.

  • period_dim (str, optional) – Name of the return-period dimension of depths. Default "period".

Returns:

xarray.Dataset – return_period (years, float32) and flag (int8: -1 below the table, 0 inside, +1 above) on the dimensions of depth.

Raises:

ValueError – If periods are not increasing, positive and at least two, or depths does not match them.

Notes

Dask. This function computes the dask array: it looks the depth up in the table of every cell together. The input is loaded into memory and the result is held in memory.

References

Examples

>>> rp = radarx.retrieve.return_period(
...     rain, [2, 10, 100], [40.0, 80.0, 160.0]
... )