diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml index d11e98554..94521e080 100644 --- a/.github/workflows/add-to-project.yml +++ b/.github/workflows/add-to-project.yml @@ -17,7 +17,7 @@ jobs: repository-projects: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 839be542c..e9ff89c2f 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -35,7 +35,7 @@ jobs: contents: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/cache-cleaner.yml b/.github/workflows/cache-cleaner.yml index 0b459592c..f42ad1481 100644 --- a/.github/workflows/cache-cleaner.yml +++ b/.github/workflows/cache-cleaner.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c214c5fe6..8111f2b27 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,7 +37,7 @@ jobs: - 'python' steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 8ba62266d..678950cbc 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/first-pull-request.yml b/.github/workflows/first-pull-request.yml index 925711840..a8c2a29ab 100644 --- a/.github/workflows/first-pull-request.yml +++ b/.github/workflows/first-pull-request.yml @@ -17,7 +17,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/label-on-approval.yml b/.github/workflows/label-on-approval.yml index 16bd7a59c..55750ef58 100644 --- a/.github/workflows/label-on-approval.yml +++ b/.github/workflows/label-on-approval.yml @@ -26,7 +26,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block @@ -56,7 +56,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index a38d7908c..9eb34632a 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -29,7 +29,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 495993390..f8e4dfca0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,7 +44,7 @@ jobs: - "3.9" steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block @@ -80,7 +80,7 @@ jobs: python-version: "3.9" steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block @@ -153,7 +153,7 @@ jobs: os: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: egress-policy: block allowed-endpoints: > @@ -208,7 +208,7 @@ jobs: shell: bash -l {0} steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/publish-mastodon.yml b/.github/workflows/publish-mastodon.yml index a6ee4b22b..ed3d9b7cb 100644 --- a/.github/workflows/publish-mastodon.yml +++ b/.github/workflows/publish-mastodon.yml @@ -25,7 +25,7 @@ jobs: environment: production steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 8746d8775..457b00544 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 7354c9a4a..de8e8afd8 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: egress-policy: audit diff --git a/.github/workflows/tag-testpypi.yml b/.github/workflows/tag-testpypi.yml index fc79e8744..41be041f6 100644 --- a/.github/workflows/tag-testpypi.yml +++ b/.github/workflows/tag-testpypi.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/testdata-version.yml b/.github/workflows/testdata-version.yml index 77b4dfdd6..2f7c729fb 100644 --- a/.github/workflows/testdata-version.yml +++ b/.github/workflows/testdata-version.yml @@ -23,7 +23,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index fc6551d55..661e70683 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -40,7 +40,7 @@ jobs: shell: bash -l {0} steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/workflow-warning.yml b/.github/workflows/workflow-warning.yml index 729cf0142..a4887a7ac 100644 --- a/.github/workflows/workflow-warning.yml +++ b/.github/workflows/workflow-warning.yml @@ -26,7 +26,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 + uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 with: disable-sudo: true egress-policy: block diff --git a/CHANGES.rst b/CHANGES.rst index 17b0bfd16..b3f162f95 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -25,9 +25,11 @@ New indicators Breaking changes ^^^^^^^^^^^^^^^^ * The previously deprecated functions ``xclim.sdba.processing.construct_moving_yearly_window`` and ``xclim.sdba.processing.unpack_moving_yearly_window`` have been removed. These functions have been replaced by ``xclim.core.calendar.stack_periods`` and ``xclim.core.calendar.unstack_periods``. (:pull:`1717`). +* The previously deprecated function ``xclim.ensembles.change_significance`` has been removed. (:pull:`1737`). * Indicators ``snw_season_length`` and ``snd_season_length`` have been modified, see above. * The `hargeaves85`/`hg85` method for the ``potential_evapotranspiration`` indicator and indice has been modified for precision and consistency with recent academic literature. (:issue:`1710`, :pull:`1723`). + Bug fixes ^^^^^^^^^ * Fixed an bug in sdba's ``map_groups`` that prevented passing DataArrays with cftime coordinates if the ``sdba_encode_cf`` option was True. (:issue:`1673`, :pull:`1674`). diff --git a/docs/api.rst b/docs/api.rst index 8c4f5d60e..04e07fb96 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -59,9 +59,6 @@ Ensembles Module .. autofunction:: xclim.ensembles.robustness_categories :noindex: -.. autofunction:: xclim.ensembles.change_significance - :noindex: - .. autofunction:: xclim.ensembles.robustness_coefficient :noindex: diff --git a/pyproject.toml b/pyproject.toml index 3825724d5..cc515b75d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,7 +125,7 @@ target-version = [ ] [tool.bumpversion] -current_version = "0.48.3-dev.13" +current_version = "0.48.3-dev.14" commit = true commit_args = "--no-verify" tag = false diff --git a/xclim/__init__.py b/xclim/__init__.py index db90f1551..97f0a19b4 100644 --- a/xclim/__init__.py +++ b/xclim/__init__.py @@ -16,7 +16,7 @@ __author__ = """Travis Logan""" __email__ = "logan.travis@ouranos.ca" -__version__ = "0.48.3-dev.13" +__version__ = "0.48.3-dev.14" _module_data = _files("xclim.data") diff --git a/xclim/ensembles/__init__.py b/xclim/ensembles/__init__.py index a6a0c1f82..8f6451495 100644 --- a/xclim/ensembles/__init__.py +++ b/xclim/ensembles/__init__.py @@ -19,7 +19,6 @@ plot_rsqprofile, ) from ._robustness import ( - change_significance, robustness_categories, robustness_coefficient, robustness_fractions, diff --git a/xclim/ensembles/_robustness.py b/xclim/ensembles/_robustness.py index 9c1603336..322d85e53 100644 --- a/xclim/ensembles/_robustness.py +++ b/xclim/ensembles/_robustness.py @@ -9,7 +9,6 @@ from __future__ import annotations -import warnings from inspect import Parameter, signature import numpy as np @@ -20,7 +19,6 @@ from xclim.indices.generic import compare, detrend __all__ = [ - "change_significance", "robustness_categories", "robustness_coefficient", "robustness_fractions", @@ -33,7 +31,7 @@ New tests must be decorated with :py:func:`significance_test` and fulfill the following requirements: - Function name should begin by "_", registered test name is the function name without its first character and with _ replaced by -. -- Function must accept 2 positional arguments : fut and ref (see :py:func:`change_significance` for definitions) +- Function must accept 2 positional arguments : fut and ref (see :py:func:`robustness_fractions` for definitions) - Function may accept other keyword-only arguments. - Function must return 2 values : + `changed` : 1D boolean array along `realization`. True for realization with significant change. @@ -42,7 +40,7 @@ def significance_test(func): - """Register a significance test for use in :py:func:`change_significance`. + """Register a significance test for use in :py:func:`robustness_fractions`. See :py:data:`SIGNIFICANCE_TESTS`. """ @@ -294,67 +292,6 @@ def robustness_fractions( # noqa: C901 return out -def change_significance( # noqa: C901 - fut: xr.DataArray | xr.Dataset, - ref: xr.DataArray | xr.Dataset, - test: str | None = "ttest", - weights: xr.DataArray | None = None, - p_vals: bool = False, - **kwargs, -) -> ( - tuple[xr.DataArray | xr.Dataset, xr.DataArray | xr.Dataset] - | tuple[ - xr.DataArray | xr.Dataset, - xr.DataArray | xr.Dataset, - xr.DataArray | xr.Dataset | None, - ] -): - """Backwards-compatible implementation of :py:func:`robustness_fractions`.""" - warnings.warn( - ( - "Function change_significance is deprecated as of xclim 0.47 and will be removed in 0.49. " - "Please use robustness_fractions instead." - ), - FutureWarning, - ) - - if isinstance(fut, xr.Dataset): - outs = { - v: robustness_fractions( - fut[v], - ref[v] if isinstance(ref, xr.Dataset) else ref, - test=test, - weights=weights[v] if isinstance(weights, xr.Dataset) else weights, - **kwargs, - ) - for v in fut.data_vars.keys() - } - change_frac = xr.merge([fracs.changed.rename(v) for v, fracs in outs.items()]) - pos_frac = xr.merge( - [ - (fracs.changed_positive / fracs.changed).rename(v) - for v, fracs in outs.items() - ] - ) - if p_vals: - if "pvals" in list(outs.values())[0]: - pvals = xr.merge([fracs.pvals.rename(v) for v, fracs in outs.items()]) - else: - pvals = None - return change_frac, pos_frac, pvals - return change_frac, pos_frac - - fracs = robustness_fractions(fut, ref, test=test, weights=weights, **kwargs) - # different def. - # Old "pos_frac" is fraction of change_frac that is positive - # New change_pos_frac is fraction of all that is both positive and significant - pos_frac = fracs.changed_positive / fracs.changed - - if p_vals: - return fracs.changed, pos_frac, fracs.pvals if "pvals" in fracs else None - return fracs.changed, pos_frac - - def robustness_categories( changed_or_fractions: xr.Dataset | xr.DataArray, agree: xr.DataArray | None = None, @@ -667,7 +604,7 @@ def _ipcc_ar6_c(fut, ref, *, ref_pi=None): return changed, None -# Add doc of each significance test to the `change_significance` output. +# Add doc of each significance test to `robustness_fractions` output's doc. def _gen_test_entry(namefunc): name, func = namefunc doc = func.__doc__.replace("\n ", "\n\t\t").rstrip()