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
periodsgive a curve; the return period ofdepthis read from it by linear interpolation ofln(period)againstln(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 ofdepths(for example mm).periods (
array_like) – Return periods in years, increasing, at least two.depths (
xarray.DataArrayorarray_like) – Depth for each return period: a DataArray with the dimensionperiod_dim(lengthlen(periods)) and the dimensions ofdepth, or a 1-D array-like for one table that is used everywhere.period_dim (
str, optional) – Name of the return-period dimension ofdepths. Default"period".
- Returns:
xarray.Dataset–return_period(years,float32) andflag(int8: -1 below the table, 0 inside, +1 above) on the dimensions ofdepth.- Raises:
ValueError – If
periodsare not increasing, positive and at least two, ordepthsdoes 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] ... )