xclim icon indicating copy to clipboard operation
xclim copied to clipboard

[new xclim] Use generics to remove redundant indices

Open aulemahal opened this issue 5 months ago • 0 comments

Pull Request Checklist:

  • [x] This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #744
  • [ ] Tests for the changes have been added (for bug fixes / features)
    • [ ] (If applicable) Documentation has been added / updated (for bug fixes / features)
  • [ ] CHANGELOG.rst has been updated (with summary of main changes)
    • [ ] Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

This is why I wanted #2258.

Use index functions from indices.generic where possible in xclim.indicators and remove explicit function in xclim.indices.

For example : Indicator "wetdays" is only a specific case of count_occurrences. So redefine the indicator to use that function, and remove the xclim.indices._threshold.wetdays function.

Does this PR introduce a breaking change?

Yes. A lot of methods from xclim.indices are being removed.

I try not to break indicators, but some arguments may have different names and the metadata is modified. Mainly, a lot of indicators are loosing their "notes" and "examples". My idea is that for simple indicators, those are not necessary : the abstract, the generic function's docstring and the "injected" parameters should be enough to understand the calculations.

Other information:

A large group of "indices" I can't remove for now are the "percentile" ones like "tg10p". They do not map to a generic function yet as they are in between count_occurrences and count_percentile_occurrences, plus the bootstrap component. I might create a new generic function to take care of that.

aulemahal avatar Oct 31 '25 21:10 aulemahal