コード例 #1
0
ファイル: test_checks.py プロジェクト: cehbrecht/xclim
 def test_bad_frequency(self, date_range):
     with pytest.raises(ValidationError):
         n = 365
         times = date_range("2000-01-01", freq="12H", periods=n)
         da = xr.DataArray(np.arange(n), [("time", times)],
                           attrs=self.tas_attrs)
         tg_mean(da)
コード例 #2
0
ファイル: test_checks.py プロジェクト: cehbrecht/xclim
 def test_decreasing_index(self, date_range):
     with pytest.raises(ValidationError):
         n = 365
         times = date_range("2000-01-01", freq="12H", periods=n)
         da = xr.DataArray(np.arange(n), [("time", times[::-1])],
                           attrs=self.tas_attrs)
         tg_mean(da)
コード例 #3
0
ファイル: test_checks.py プロジェクト: thomasremke/xclim
 def test_bad_frequency(self):
     with pytest.raises(ValueError):
         n = 365
         times = pd.date_range("2000-01-01", freq="12H", periods=n)
         da = xr.DataArray(np.arange(n), [("time", times)],
                           attrs={"units": "K"})
         tg_mean(da)
コード例 #4
0
ファイル: test_checks.py プロジェクト: cehbrecht/xclim
 def test_duplicate_dates(self, date_range):
     with pytest.raises(ValidationError):
         n = 365
         times = date_range("2000-01-01", freq="1D", periods=n)
         times = times.append(date_range("2000-12-29", freq="1D",
                                         periods=n))
         da = xr.DataArray(np.arange(2 * n), [("time", times)],
                           attrs=self.tas_attrs)
         tg_mean(da)
コード例 #5
0
ファイル: test_checks.py プロジェクト: cehbrecht/xclim
 def test_missing_one_day_between_two_years(self, date_range):
     with pytest.raises(ValidationError):
         n = 365
         times = date_range("2000-01-01", freq="1D", periods=n)
         times = times.append(date_range("2001-01-01", freq="1D",
                                         periods=n))
         da = xr.DataArray(np.arange(2 * n), [("time", times)],
                           attrs=self.tas_attrs)
         tg_mean(da)
コード例 #6
0
ファイル: test_checks.py プロジェクト: thomasremke/xclim
 def test_duplicate_dates(self):
     with pytest.raises(ValueError):
         n = 365
         times = pd.date_range("2000-01-01", freq="1D", periods=n)
         times = times.append(
             pd.date_range("2000-12-29", freq="1D", periods=n))
         da = xr.DataArray(np.arange(2 * n), [("time", times)],
                           attrs={"units": "K"})
         tg_mean(da)
コード例 #7
0
ファイル: test_checks.py プロジェクト: thomasremke/xclim
 def test_missing_one_day_between_two_years(self):
     with pytest.raises(ValueError):
         n = 365
         times = pd.date_range("2000-01-01", freq="1D", periods=n)
         times = times.append(
             pd.date_range("2001-01-01", freq="1D", periods=n))
         da = xr.DataArray(np.arange(2 * n), [("time", times)],
                           attrs={"units": "K"})
         tg_mean(da)
コード例 #8
0
ファイル: test_checks.py プロジェクト: cehbrecht/xclim
 def test_assert_daily(self, date_range):
     n = 365  # one day short of a full year
     times = date_range("2000-01-01", freq="1D", periods=n)
     da = xr.DataArray(np.arange(n), [("time", times)],
                       attrs=self.tas_attrs)
     tg_mean(da)
コード例 #9
0
ファイル: test_checks.py プロジェクト: thomasremke/xclim
 def test_assert_daily(self):
     n = 365  # one day short of a full year
     times = pd.date_range("2000-01-01", freq="1D", periods=n)
     da = xr.DataArray(np.arange(n), [("time", times)],
                       attrs={"units": "K"})
     tg_mean(da)