def test_bootstrap_warm_spell_duration_index(self, tasmax_series, use_dask): self.bootstrap_testor( tasmax_series, 98, lambda x, y, z: warm_spell_duration_index( x, y, window=6, freq="MS", bootstrap=z), use_dask=use_dask, )
def test_simple(self, tasmax_series): i = 3650 A = 10.0 tx = (np.zeros(i) + A * np.sin(np.arange(i) / 365.0 * 2 * np.pi) + 0.1 * np.random.rand(i)) tx[10:20] += 2 tx = tasmax_series(tx) tx90 = percentile_doy(tx, per=0.9) out = xci.warm_spell_duration_index(tx, tx90, freq="YS") assert out[0] == 10