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

Heat spells #1885

Merged
merged 20 commits into from
Sep 6, 2024
Merged

Heat spells #1885

merged 20 commits into from
Sep 6, 2024

Conversation

aulemahal
Copy link
Collaborator

@aulemahal aulemahal commented Aug 15, 2024

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)
  • 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?

  • 3 new indicators heat_spell_frequency, heat_spell_max_length and heat_spell_total_length. The "heat_wave" indicators test that a bivariate condition on each day and then find consecutive runs of a minimum length. The new functions adhere to xclim's concept of "spell" : the condition is tested against a rolling N-day window and if it is fulfilled all days of the window are considered part of the spell.
  • New generic function spell_mask that encapsulate the spell notion. It returns a boolean mask of the days part of spells. The code has been added two features:
    • Multivariate : input data can be a list (and so must be the thresholds). The way we check for the conditions across variables is decided by new argument var_reducer ('all' or 'any').
    • Weights : if the spell stat is a mean, weights can be given (used by the INSPQ, but not for the actual PC indicators).
  • Indicator parameters can now be assigned new names. See examples in how the heat spell indicators are created. We could already do something similar with data variables. The internals of Indicator have changed accordingly (sorry).

Does this PR introduce a breaking change?

No.

Other information:

I kinda decided that "heat" meant "tasmax and tasmin".

@github-actions github-actions bot added the indicators Climate indices and indicators label Aug 15, 2024
Copy link
Contributor

@coxipi coxipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@github-actions github-actions bot added the approved Approved for additional tests label Aug 20, 2024
@coveralls
Copy link

Coverage Status

coverage: 89.114% (+0.01%) from 89.1%
when pulling 3d276a0 on heat_spell
into 7acc410 on main.

@aulemahal aulemahal merged commit 3887535 into main Sep 6, 2024
21 checks passed
@aulemahal aulemahal deleted the heat_spell branch September 6, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests indicators Climate indices and indicators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants