diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9ce8ae9cf..2e752ba33 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,8 +20,8 @@ Bug fixes Internal changes ^^^^^^^^^^^^^^^^ * Changed french translations with word "pluvieux" to "avec précipitations". (:issue:`1960`, :pull:`1994`). -* Using different time for `ref` and `hist` is now explicitly forbidden in many bias adjustment methods (e.g. `EmpiricalQuantileMapping`). Methods that combine `ref,hist,sim` in a same `map_groups` also require the time arrays to be equal in size. (:issue:`1903`, :pull:`1995`) -* Nans in `OTC` and `dOTC` are only dropped and put back in place at the lowest level so that the size of time array never changes on xarray levels. (:pull:`1995`) +* Using different time for `ref` and `hist` is now explicitly forbidden in many bias adjustment methods (e.g. `EmpiricalQuantileMapping`). Methods that combine `ref,hist,sim` in a same `map_groups` also require the time arrays to be equal in size. (:issue:`1903`, :pull:`1995`, :pull:`2013`) +* Nans in `OTC` and `dOTC` are only dropped and put back in place at the lowest level so that the size of time array never changes on xarray levels. (:pull:`1995`, :pull:`2013`) * `streamflow` entry replaced with `q` in ``variables.yml``. (:issue:`1912`, :pull:`1996`) * In order to address 403 (forbidden) request errors when retrieving data from GitHub via ReadTheDocs, the ``nimbus`` class has been modified to use an overloaded `fetch` method that appends a User-Agent header to the request. (:pull:`2001`). * Addressed a very rare race condition that can happen if `pytest` is tearing down the test environment when running across multiple workers. (:pull:`1863`). diff --git a/tests/test_sdba/test_adjustment.py b/tests/test_sdba/test_adjustment.py index efc024de2..f1670e613 100644 --- a/tests/test_sdba/test_adjustment.py +++ b/tests/test_sdba/test_adjustment.py @@ -616,6 +616,19 @@ def test_add_dims(self, use_dask, open_dataset): scen2 = EQM2.adjust(sim).load() assert scen2.sel(location=["Kugluktuk", "Vancouver"]).isnull().all() + def test_different_times_training(self, series, random): + n = 10 + u = random.random(n) + ref = series(u, "tas", start="2000-01-01") + u2 = random.random(n) + hist = series(u2, "tas", start="2000-01-01") + hist_fut = series(u2, "tas", start="2001-01-01") + ds = EmpiricalQuantileMapping.train(ref, hist).ds + EmpiricalQuantileMapping._allow_diff_training_times = True + ds_fut = EmpiricalQuantileMapping.train(ref, hist_fut).ds + EmpiricalQuantileMapping._allow_diff_training_times = False + assert (ds.af == ds_fut.af).all() + @pytest.mark.slow class TestMBCn: