Skip to content

Commit

Permalink
add missing robustness functions in docs (#1630)
Browse files Browse the repository at this point in the history
<!--Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [ ] This PR addresses an already opened issue (for bug fixes /
features)
    - This PR fixes #xyz
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] (If applicable) Documentation has been added / updated (for bug
fixes / features)
- [x] CHANGES.rst has been updated (with summary of main changes)
- [x] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added

### What kind of change does this PR introduce?

* The new robustness functions are added to the api doc section.

### Does this PR introduce a breaking change?


### Other information:
  • Loading branch information
juliettelavoie authored Jan 29, 2024
2 parents 3ab182e + e00b372 commit 3432dd8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Bug fixes
* Fix wrong `window` attributes in ``xclim.indices.standardized_precipitation_index``, ``xclim.indices.standardized_precipitation_evapotranspiration_index``. (:issue:`1552` :pull:`1554`).
* Fix the daily case `freq='D'` of ``xclim.stats.preprocess_standardized_index`` (:issue:`1602` :pull:`1607`).
* Several spelling mistakes have been corrected within the documentation and codebase. (:pull:`1576`).
* Added missing ``xclim.ensembles.robustness_fractions`` and ``xclim.ensembles.robistness_categoris`` in api doc section. (:pull:`1630`).

Internal changes
^^^^^^^^^^^^^^^^
Expand Down
6 changes: 6 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ Ensembles Module
.. automodule:: xclim.ensembles._robustness
:noindex:

.. autofunction:: xclim.ensembles.robustness_fractions
:noindex:

.. autofunction:: xclim.ensembles.robustness_categories
:noindex:

.. autofunction:: xclim.ensembles.change_significance
:noindex:

Expand Down
10 changes: 5 additions & 5 deletions xclim/ensembles/_robustness.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
===========================
Robustness metrics are used to estimate the confidence of the climate change signal of an ensemble.
This submodule is inspired by and tries to follow the guidelines of the IPCC, more specifically
the 12th chapter of the Working Group 1's contribution to the AR5 :cite:p:`collins_long-term_2013` (see box 12.1).
This submodule is inspired by and tries to follow the guidelines of the IPCC,
more specifically :cite:p:`collins_long-term_2013` (AR5) and :cite:cts:`ipccatlas_ar6wg1` (AR6).
"""

from __future__ import annotations
Expand Down Expand Up @@ -101,6 +101,8 @@ def robustness_fractions( # noqa: C901
pvals :
The p-values estimated by the significance tests. Only returned if the test uses `pvals`. Has the `realization` dimension.
Notes
-----
The table below shows the coefficient needed to retrieve the number of members
that have the indicated characteristics, by multiplying it by the total
number of members (`fut.realization.size`) and by `valid_frac`, assuming uniform weights.
Expand All @@ -116,8 +118,6 @@ def robustness_fractions( # noqa: C901
| Negative change | (cf - cpf) | 1 - pf - (cf -cpf) | 1 - pf |
+-----------------+--------------------+------------------------+------------+
Notes
-----
Available statistical tests are :
{tests_doc}
Expand Down Expand Up @@ -649,7 +649,7 @@ def _gen_test_entry(namefunc):
return f"\t{name}:\n\t\t{doc}"


change_significance.__doc__ = change_significance.__doc__.format(
robustness_fractions.__doc__ = robustness_fractions.__doc__.format(
tests_list="{" + ", ".join(list(SIGNIFICANCE_TESTS.keys()) + ["threshold"]) + "}",
tests_doc="\n".join(map(_gen_test_entry, SIGNIFICANCE_TESTS.items())),
)

0 comments on commit 3432dd8

Please sign in to comment.