Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jul 15, 2024
1 parent 35de627 commit ed9aa22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions tests/test_generated_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_txx__season_slice_mode() -> None:
res = icclim.txx(tas, slice_mode=["season", [11, 12, 1, 2]]).compute()
# THEN
# missing values for nov, dec of first period
np.testing.assert_array_equal(res.TXx.isel(time=0), np.NAN)
np.testing.assert_array_equal(res.TXx.isel(time=0), np.nan)
np.testing.assert_array_equal(res.TXx.isel(time=1), 30.0)
np.testing.assert_array_equal(
res.time_bounds.isel(time=0),
Expand All @@ -151,7 +151,7 @@ def test_txx__months_slice_mode() -> None:
tas.loc[{"time": "2042-01-01"}] = 303.15 # 30°C 273.15
res = icclim.txx(tas, slice_mode=["months", [11, 1]]).compute()
np.testing.assert_array_equal(res.TXx.isel(time=0), 30)
np.testing.assert_array_equal(res.TXx.isel(time=1), np.NAN)
np.testing.assert_array_equal(res.TXx.isel(time=1), np.nan)
np.testing.assert_almost_equal(res.TXx.sel(time="2042-11"), 21.85)
np.testing.assert_array_equal(
res.time_bounds.isel(time=0),
Expand Down Expand Up @@ -192,8 +192,8 @@ def test_custom_index__season_slice_mode(
},
).compute()
# missing values algo applied for first and last years
np.testing.assert_almost_equal(res.pouet.isel(time=0), np.NAN)
np.testing.assert_almost_equal(res.pouet.isel(time=-1), np.NAN)
np.testing.assert_almost_equal(res.pouet.isel(time=0), np.nan)
np.testing.assert_almost_equal(res.pouet.isel(time=-1), np.nan)
np.testing.assert_almost_equal(res.pouet.isel(time=1), expectation_year_1)
np.testing.assert_almost_equal(res.pouet.isel(time=2), expectation_year_2)

Expand Down Expand Up @@ -225,8 +225,8 @@ def test_custom_index_run_algos__season_slice_mode(
},
)
# missing values algo applied for first and last years
np.testing.assert_almost_equal(res.pouet.isel(time=0), np.NAN)
np.testing.assert_almost_equal(res.pouet.isel(time=-1), np.NAN)
np.testing.assert_almost_equal(res.pouet.isel(time=0), np.nan)
np.testing.assert_almost_equal(res.pouet.isel(time=-1), np.nan)
np.testing.assert_almost_equal(res.pouet.isel(time=1), expectation_year_1)
np.testing.assert_almost_equal(res.pouet.isel(time=2), expectation_year_2)

Expand Down Expand Up @@ -280,12 +280,12 @@ def test_custom_index_anomaly__datetime_ref_period() -> None:
},
).compute()
# missing values algo applied for first and last years
np.testing.assert_almost_equal(res.anomaly.sel(time="2041"), np.NAN)
np.testing.assert_almost_equal(res.anomaly.sel(time="2041"), np.nan)
np.testing.assert_almost_equal(res.anomaly.sel(time="2042"), 0)
np.testing.assert_almost_equal(res.anomaly.sel(time="2043"), 0)
np.testing.assert_almost_equal(res.anomaly.sel(time="2044"), 4.80645161)
np.testing.assert_almost_equal(res.anomaly.sel(time="2045"), 0)
np.testing.assert_almost_equal(res.anomaly.sel(time="2046"), np.NAN)
np.testing.assert_almost_equal(res.anomaly.sel(time="2046"), np.nan)


def test_custom_index_anomaly__groupby_and_resample_month() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_index_su__djf_cf_time(self) -> None:
out_file=self.OUTPUT_FILE,
slice_mode=FrequencyRegistry.DJF,
)
np.testing.assert_array_equal(res.SU.isel(time=0), np.NAN)
np.testing.assert_array_equal(res.SU.isel(time=0), np.nan)
np.testing.assert_array_equal(res.SU.isel(time=1), 0)
# "+ 1" because DJF sampling create a december month with nans before first year
np.testing.assert_array_equal(
Expand Down

0 comments on commit ed9aa22

Please sign in to comment.