From 3dce75eb57ff8697f7260e744a93ef7ccfcc3f75 Mon Sep 17 00:00:00 2001 From: Adrien Lamarche Date: Wed, 21 Aug 2024 13:49:49 -0400 Subject: [PATCH 1/3] fix --- xclim/sdba/_adjustment.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xclim/sdba/_adjustment.py b/xclim/sdba/_adjustment.py index 303d4a3e3..8bc9dcd62 100644 --- a/xclim/sdba/_adjustment.py +++ b/xclim/sdba/_adjustment.py @@ -1031,10 +1031,8 @@ def _otc_adjust( rng = np.random.default_rng() # The plan row corresponding to a source bin indicates its probabilities to be transported to every target bin for i, binX_group in enumerate(binX_groups): - # Get the plan row of this bin - pi = np.where((binX[binX_group[0]] == gridX).all(1))[0][0] # Pick as much target bins for this source bin as there are points in the source bin - choice = rng.choice(range(muY.size), p=plan[pi, :], size=binX_count[i]) + choice = rng.choice(range(muY.size), p=plan[i, :], size=binX_count[i]) out[binX_group] = (gridY[choice] + 1 / 2) * bin_width + bin_origin if jitter_inside_bins: From 5b05d2e65ccb7c78bc2f00598a49d5f625fd7d2e Mon Sep 17 00:00:00 2001 From: Adrien Lamarche Date: Wed, 21 Aug 2024 14:17:45 -0400 Subject: [PATCH 2/3] changelog --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5573a3c3e..3b4be51d2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,7 +15,7 @@ New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * ``xclim.sdba.nbutils.quantile`` and its child functions are now faster. If the `fastnanquantile` library is installed, it is used as the backend for the computation of quantiles and yields even faster results. This dependency is now listed in the `xclim[extras]` recipe. (:issue:`1255`, :pull:`1513`). * New multivariate bias adjustment class ``MBCn``, giving a faster and more accurate implementation of the ``MBCn`` algorithm. (:issue:`1551`, :pull:`1580`). -* New multivariate bias adjustment classes ``OTC`` and ``dOTC``. Requires the `POT` library which can be installed via the `xclim[extras]` recipe. (:pull:`1787`). +* New multivariate bias adjustment classes ``OTC`` and ``dOTC``. Requires the `POT` library which can be installed via the `xclim[extras]` recipe. (:pull:`1787`, :pull:`1890`). * `xclim` is now compatible with `pytest` versions `>=8.0.0`. (:pull:`1632`). Breaking changes From e442c194bb32bda0ab4edb1f0052dbeb7dbd7bd0 Mon Sep 17 00:00:00 2001 From: Adrien Lamarche Date: Wed, 21 Aug 2024 14:27:37 -0400 Subject: [PATCH 3/3] change changelog --- CHANGELOG.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3b4be51d2..b5930a36f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,14 @@ Changelog ========= +v0.53.0 +-------------------- +Contributors to this version: Adrien Lamarche (:user:`LamAdr`). + +Bug fixes +^^^^^^^^^ +* Fixed a small inefficiency in ``_otc_adjust`` (:pull:`1890`). + v0.52.0 (2024-08-08) -------------------- Contributors to this version: David Huard (:user:`huard`), Trevor James Smith (:user:`Zeitsperre`), Hui-Min Wang (:user:`Hem-W`), Éric Dupuis (:user:`coxipi`), Sarah Gammon (:user:`SarahG-579462`), Pascal Bourgault (:user:`aulemahal`), Juliette Lavoie (:user:`juliettelavoie`), Adrien Lamarche (:user:`LamAdr`). @@ -15,7 +23,7 @@ New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * ``xclim.sdba.nbutils.quantile`` and its child functions are now faster. If the `fastnanquantile` library is installed, it is used as the backend for the computation of quantiles and yields even faster results. This dependency is now listed in the `xclim[extras]` recipe. (:issue:`1255`, :pull:`1513`). * New multivariate bias adjustment class ``MBCn``, giving a faster and more accurate implementation of the ``MBCn`` algorithm. (:issue:`1551`, :pull:`1580`). -* New multivariate bias adjustment classes ``OTC`` and ``dOTC``. Requires the `POT` library which can be installed via the `xclim[extras]` recipe. (:pull:`1787`, :pull:`1890`). +* New multivariate bias adjustment classes ``OTC`` and ``dOTC``. Requires the `POT` library which can be installed via the `xclim[extras]` recipe. (:pull:`1787`). * `xclim` is now compatible with `pytest` versions `>=8.0.0`. (:pull:`1632`). Breaking changes