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

Add option to remove annual cycle in percentile_doy #1686

Open
1 of 2 tasks
huard opened this issue Mar 22, 2024 · 2 comments
Open
1 of 2 tasks

Add option to remove annual cycle in percentile_doy #1686

huard opened this issue Mar 22, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed indicators Climate indices and indicators

Comments

@huard
Copy link
Collaborator

huard commented Mar 22, 2024

Addressing a Problem?

See https://www.nature.com/articles/s41467-024-46349-x for rationale

Potential Solution

No response

Additional context

No response

Contribution

  • I would be willing/able to open a Pull Request to contribute this feature.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@huard huard added the enhancement New feature or request label Mar 22, 2024
@Zeitsperre Zeitsperre added the help wanted Extra attention is needed label Apr 16, 2024
@bzah
Copy link
Contributor

bzah commented Apr 17, 2024

Interesting read thanks @huard !
In case someone want to start with the implementation here is the paper author's code https://github.com/lukasbrunner/running_window_bias/blob/main/code/pre-processing/calc_threshold_exceedance.py#L235
The function names are a bit confusing, but it looks fairly simple to adapt to percentile_doy and xclim indices.
My understanding is that we must compute the mean of each window (1), then substract this mean to the base array (2), then compute the percentile on this base_minus_mean (3) and compute the exceedance by counting days where base_minus_mean > threshold (4).

One issue for xclim is that steps (1), (2) and (3) should happen on percentile_doy but step (4) happens before or at the beginning of the index computation. However, we can use the same technique as we did for Zhang's bootstrapping algorithm and apply this seasonal bias correction via a decorator.
It could even be integrated in the current @percentile_bootstrap decorator as the logic to get the arguments (climatology_bounds, percentile value, etc) are similar.

As a side note I'm working (again) on the percentile bootstrap algorithm to improve the performances for Cerfacs.
I'm not yet sure if this will result in a PR and I don't think this would clash too much with this seasonal cycle correction, but I prefer to warn before a git conflict pops up.

@huard
Copy link
Collaborator Author

huard commented Apr 17, 2024

Salut @bzah !

Thanks for looking into this and for the heads up.

@Zeitsperre Zeitsperre added the indicators Climate indices and indicators label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed indicators Climate indices and indicators
Projects
None yet
Development

No branches or pull requests

3 participants