xskillscore.core.resampling.resample_iterations

xskillscore.core.resampling.resample_iterations(forecast, iterations, dim='member', dim_max=None, replace=True)

Resample over dim by index iterations times.

Note

This gives the same result as resample_iterations_idx() but slower. When using dask, the number of tasks in resample_iterations() will scale with iterations but constant chunksize, whereas the tasks in resample_iterations_idx() will stay constant with increasing chunksize.

Parameters
  • forecast (xr.DataArray, xr.Dataset) – Forecast.

  • iterations (int) – Number of resampling iterations.

  • dim (str) – Dimension name to resample over. Defaults to 'member'.

  • dim_max (int) – Number of items to select in dim.

  • replace (bool) – Resampling with or without replacement. Defaults to True.

Returns

forecast_smp – data resampled along dimension dim with additional dim='iteration'.

Return type

xr.DataArray, xr.Dataset

Examples

>>> a = xr.DataArray(np.random.rand(1000, 3, 3), dims=['time', 'x', 'y'])
>>> xs.resample_iterations(a, 500, 'time')  
<xarray.DataArray (time: 1000, x: 3, y: 3, iteration: 500)>

See also

resample_iterations_idx()

References

  • Mason, S. J., & Mimmack, G. M. (1992). The use of bootstrap confidence intervals for the correlation coefficient in climatology. Theoretical and Applied Climatology, 45(4), 229–233. https://doi.org/10/b6fnsv

  • Mason, S. J. (2008). Understanding forecast verification statistics. Meteorological Applications, 15(1), 31–40. https://doi.org/10/bgvgnz

  • Goddard, L., Kumar, A., Solomon, A., Smith, D., Boer, G., Gonzalez, P., Kharin, V., Merryfield, W., Deser, C., Mason, S. J., Kirtman, B. P., Msadek, R., Sutton, R., Hawkins, E., Fricker, T., Hegerl, G., Ferro, C. a. T., Stephenson, D. B., Meehl, G. A., … Delworth, T. (2013). A verification framework for interannual-to-decadal predictions experiments. Climate Dynamics, 40(1–2), 245–272. https://doi.org/10/f4jjvf