Пример #1
0
 def test_bootstrap_tn10p(self, tasmin_series, use_dask):
     self.bootstrap_testor(
         tasmin_series,
         2,
         lambda x, y, z: tn10p(x, y, freq="MS", bootstrap=z),
         use_dask=use_dask,
     )
Пример #2
0
    def test_doy_interpolation(self):
        pytest.importorskip('xarray', '0.11.4')

        # Just a smoke test
        fn_clim = os.path.join(
            TESTS_DATA, 'CanESM2_365day',
            'tasmin_day_CanESM2_rcp85_r1i1p1_na10kgrid_qm-moving-50bins-detrend_2095.nc'
        )
        fn = os.path.join(
            TESTS_DATA, 'HadGEM2-CC_360day',
            'tasmin_day_HadGEM2-CC_rcp85_r1i1p1_na10kgrid_qm-moving-50bins-detrend_2095.nc'
        )

        with xr.open_dataset(fn_clim) as ds:
            t10 = percentile_doy(ds.tasmin.isel(lat=0, lon=0), per=.1)

        with xr.open_dataset(fn) as ds:
            xci.tn10p(ds.tasmin.isel(lat=0, lon=0), t10, freq='MS')
Пример #3
0
    def test_tn10p_simple(self, tas_series):
        i = 366
        tas = np.array(range(i))
        tas = tas_series(tas, start="1/1/2000")
        t10 = percentile_doy(tas, per=0.1)

        # create cold spell in june
        tas[175:180] = 1

        out = xci.tn10p(tas, t10, freq="MS")
        assert out[0] == 1
        assert out[5] == 5