コード例 #1
0
 def test_bootstrap_cold_spell_duration_index(self, tasmin_series,
                                              use_dask):
     self.bootstrap_testor(
         tasmin_series,
         2,
         lambda x, y, z: cold_spell_duration_index(
             x, y, window=6, freq="MS", bootstrap=z),
         use_dask=use_dask,
     )
コード例 #2
0
ファイル: test_indices.py プロジェクト: thomasremke/xclim
    def test_simple(self, tasmin_series):
        i = 3650
        A = 10.0
        tn = (np.zeros(i) + A * np.sin(np.arange(i) / 365.0 * 2 * np.pi) +
              0.1 * np.random.rand(i))
        tn[10:20] -= 2
        tn = tasmin_series(tn)
        tn10 = percentile_doy(tn, per=0.1)

        out = xci.cold_spell_duration_index(tn, tn10, freq="YS")
        assert out[0] == 10
        assert out.units == "days"