Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FutureWarning for sdba migration to xsdba #2073

Merged
merged 10 commits into from
Feb 18, 2025
81 changes: 81 additions & 0 deletions .github/workflows/sdba-warning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: SDBA Changes Warnings

on:
# Note: potential security risk from this action using pull_request_target.
# Do not add actions in here which need a checkout of the repo, and do not use any caching in here.
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
pull_request_target:
types:
- opened
- reopened
- synchronize
paths:
- src/xclim/sdba/*.py

permissions:
contents: read

jobs:
comment-concerning-workflow-changes:
name: Comment Concerning Changes to SDBA module
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
- name: Find Warning Comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc_warning
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: |
This Pull Request modifies the SDBA module.
- name: Create Warning Comment
if: |
(steps.fc_warning.outputs.comment-id == '') &&
(!contains(github.event.pull_request.labels.*.name, 'approved'))
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc_warning.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
> [!WARNING]
> This Pull Request modifies the SDBA module.
**The SDBA module is gradually being deprecated in favour of the `xsdba` package.**
**Any changes to `xclim.sdba` should be made in https://github.com/Ouranosinc/xsdba**
edit-mode: replace
- name: Fail Workflow
if: (!contains(github.event.pull_request.labels.*.name, 'approved'))
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
core.setFailed('Changes were made to `xclim.sdba`.')
- name: Find Note Comment
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: fc_note
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This Pull Request modifies the SDBA module.
- name: Update Comment
if: |
contains(github.event.pull_request.labels.*.name, 'approved')
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.fc_note.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
> [!NOTE]
> This Pull Request modifies the SDBA module.
**The changes made here have been approved. Be sure to port any relevant changes to `xsdba`.**
reactions: |
hooray
edit-mode: append
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Announcements
^^^^^^^^^^^^^
* `xclim` now officially supports Python 3.13 (using `numba` v0.61.0). (:issue:`2022`, :pull:`2054`).
* `xclim` version 0.55.0 will be the last version to support Python 3.10. The next version will require Python 3.11 or higher. (:pull:`2054`).
* `xclim.sdba` is in the process of being split into a separate package (`xsdba <https://github.com/Ouranosinc/xsdba>`_) to help with the maintenance of the codebase as well as better support new SDBA functionality. Feature additions to the `xclim.sdba` module will no longer be accepted and should be made instead to `xsdba`. The developers aim to ensure a high level of interoperability between `xclim` and `xsdba` so that users are minimally impacted; A migration guide will be made available in a future release. (:issue:`1948`, :issue:`2074`, :pull:`2073`).

New indicators
^^^^^^^^^^^^^^
Expand Down Expand Up @@ -50,6 +51,7 @@ Internal changes
- ``MissingWMO`` now uses ``xclim.indices.helpers.resample_map`` which should greatly improve performance in a dask context.
* There is now a warning stating that `fitkwargs` are not employed when using the `lmoments3` distribution. One exception is the use of `'floc'` which is allowed with the gamma distribution. `'floc'` is used to shift the distribution before computing fitting parameters with the `lmoments3` distribution since ``loc=0`` is always assumed in the library. (:issue:`2043`, :pull:`2045`).
* `xclim` now tracks energy usage and carbon emissions ("last run", "average", and "total") during CI workflows using the `eco-ci-energy-estimation` GitHub Action. (:pull:`2046`).
* `xclim.sdba` now emits a `FutureWarning` on import to inform users that the submodule is being deprecated. (:pull:`2073`).

v0.54.0 (2024-12-16)
--------------------
Expand Down
12 changes: 12 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ Units Handling Submodule
SDBA Module
===========

.. warning::

The SDBA submodule is in the process of being split from `xclim` in order to facilitate development and effective
maintenance of the SDBA utilities. The `xclim.sdba` functionality will change in the future.
For more information, please visit https://xsdba.readthedocs.io/en/latest/.

.. automodule:: xclim.sdba.adjustment
:members:
:exclude-members: BaseAdjustment
Expand Down Expand Up @@ -215,6 +221,12 @@ Bootstrapping Algorithms for Indicators Submodule
SDBA Utilities
--------------

.. warning::

The SDBA submodule is in the process of being split from `xclim` in order to facilitate development and effective
maintenance of the SDBA utilities. The `xclim.sdba` functionality will change in the future.
For more information, please visit https://xsdba.readthedocs.io/en/latest/.

.. automodule:: xclim.sdba.base
:members:
:show-inheritance:
Expand Down
15 changes: 15 additions & 0 deletions src/xclim/sdba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@
==============
SDBA submodule
==============

.. warning::

The SDBA submodule is in the process of being split from `xclim` in order to facilitate development and effective
maintenance of the SDBA utilities. The `xclim.sdba` functionality will change in the future.
For more information, please visit https://xsdba.readthedocs.io/en/latest/.
"""

from __future__ import annotations

import warnings

from . import adjustment, detrending, measures, processing, properties, utils
from .adjustment import *
from .base import Grouper
from .processing import stack_variables, unstack_variables

warnings.warn(
"The SDBA submodule is in the process of being split from `xclim` in order to facilitate development and effective "
"maintenance of the SDBA utilities. The `xclim.sdba` functionality will change in the future. "
"For more information, please visit https://xsdba.readthedocs.io/en/latest/.",
FutureWarning,
)

# TODO: ISIMIP ? Used for precip freq adjustment in biasCorrection.R
# Hempel, S., Frieler, K., Warszawski, L., Schewe, J., & Piontek, F. (2013). A trend-preserving bias correction &ndash;
# The ISI-MIP approach. Earth System Dynamics, 4(2), 219–236. https://doi.org/10.5194/esd-4-219-2013
Expand Down
Loading