Skip to content

Commit

Permalink
Merge branch 'main' into deprecate-calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Jun 11, 2024
2 parents f80a53a + fb82a46 commit 3fd6889
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog

v0.50.0 (unreleased)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`).
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Éric Dupuis (:user:`coxipi`).

Breaking changes
^^^^^^^^^^^^^^^^
Expand All @@ -28,6 +28,10 @@ Internal changes
* Fixed some previously uncaught errors raised from recent versions of `pylint` and `codespell`. (:pull:`1772`).
* Set the `doctest` examples to all use `h5netcdf` with worker-separated caches to load datasets. (:pull:`1772`).

Bug fixes
^^^^^^^^^
* ``xclim.indices.{cold|hot}_spell_total_length`` now properly uses the argument `window` to only count spells with at least `window` time steps. (:issue:`1765`, :pull:`1777`).

v0.49.0 (2024-05-02)
--------------------
Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`), Juliette Lavoie (:user:`juliettelavoie`), David Huard (:user:`huard`), Gabriel Rondeau-Genesse (:user:`RondeauG`), Javier Diez-Sierra (:user:`JavierDiezSierra`), Sarah Gammon (:user:`SarahG-579462`), Éric Dupuis (:user:`coxipi`).
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ target-version = [
]

[tool.bumpversion]
current_version = "0.49.1-dev.1"
current_version = "0.49.1-dev.2"
commit = true
commit_args = "--no-verify"
tag = false
Expand Down
2 changes: 1 addition & 1 deletion tests/test_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ class TestHotSpellTotalLength:
("29 C", 3, ">", 8), # Two HS
("29 C", 3, ">=", 9), # One long HS, minus a day
("40 C", 3, ">", 0), # No HS
("30 C", 5, ">", 8), # Windowed
("30 C", 5, ">", 5), # Windowed
],
)
def test_1d(self, tasmax_series, thresh, window, op, expected):
Expand Down
2 changes: 1 addition & 1 deletion xclim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

__author__ = """Travis Logan"""
__email__ = "logan.travis@ouranos.ca"
__version__ = "0.49.1-dev.1"
__version__ = "0.49.1-dev.2"


with _resources.as_file(_resources.files("xclim.data")) as _module_data:
Expand Down
10 changes: 4 additions & 6 deletions xclim/indices/_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,13 @@ def cold_spell_total_length(
thresh = convert_units_to(thresh, tas)

cond = compare(tas, op, thresh, constrain=("<", "<="))
max_l = rl.resample_and_rl(
out = rl.resample_and_rl(
cond,
resample_before_rl,
rl.windowed_run_count,
window=1,
window=window,
freq=freq,
)
out = max_l.where(max_l >= window, 0)
return to_agg_units(out, tas, "count")


Expand Down Expand Up @@ -2112,14 +2111,13 @@ def hot_spell_total_length(
thresh = convert_units_to(thresh, tasmax)

cond = compare(tasmax, op, thresh, constrain=(">", ">="))
max_l = rl.resample_and_rl(
out = rl.resample_and_rl(
cond,
resample_before_rl,
rl.windowed_run_count,
window=1,
window=window,
freq=freq,
)
out = max_l.where(max_l >= window, 0)
return to_agg_units(out, tasmax, "count")


Expand Down

0 comments on commit 3fd6889

Please sign in to comment.