diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 15dd45bfe..aed32045a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,7 @@ Bug fixes ^^^^^^^^^ * Fixed pickling issue with ``xclim.sdba.Grouper`` and other classes for usage with `dask>=2024.11`. (:issue:`1992`, :pull:`1993`). * Fixed an issue with ``nimbus`` that was causing URL path components to be improperly joined. (:pull:`1997`). +* `base_kws_vars` in `MBCn` is now copied inside the `adjust` function so that in-place changes do not change the dict globally. (:pull:`1999`). Internal changes ^^^^^^^^^^^^^^^^ diff --git a/xclim/sdba/adjustment.py b/xclim/sdba/adjustment.py index 5c8506071..da5ab54fe 100644 --- a/xclim/sdba/adjustment.py +++ b/xclim/sdba/adjustment.py @@ -5,6 +5,7 @@ """ from __future__ import annotations +from copy import deepcopy from importlib.util import find_spec from inspect import signature from typing import Any @@ -1818,7 +1819,7 @@ def _adjust( period_dim=None, ): # set default values for non-specified parameters - base_kws_vars = base_kws_vars or {} + base_kws_vars = {} if base_kws_vars is None else deepcopy(base_kws_vars) pts_dim = self.pts_dims[0] for v in sim[pts_dim].values: base_kws_vars.setdefault(v, {})