From 26b6a31c5d8d1cc784702ffa96c6177f7c3c5ba3 Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Mon, 27 Jan 2025 13:53:40 +0100 Subject: [PATCH 1/3] Return aggregated values without units if original data doesnt have units --- src/xclim/core/units.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/xclim/core/units.py b/src/xclim/core/units.py index 036835d3e..c4613cca9 100644 --- a/src/xclim/core/units.py +++ b/src/xclim/core/units.py @@ -666,6 +666,9 @@ def to_agg_units( >>> degdays.units 'd K' """ + if "units" not in orig.attrs: + return out + is_difference = True if op in ["std", "var"] else None if op in ["amin", "min", "amax", "max", "mean", "sum", "std"]: From 3a0d450c652c5daa1be7ef1720b0e8de8cce9984 Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Mon, 27 Jan 2025 13:55:24 +0100 Subject: [PATCH 2/3] Add to changelog --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index abfc83ece..2138d2267 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -23,6 +23,9 @@ Internal changes * Adjusted the ``TestOfficialYaml`` test to use a dynamic method for finding the installed location of `xclim`. (:pull:`2028`). * Adjusted two tests for better handling when running in Windows environments. (:pull:`2057`). +Bug fixes +^^^^^^^^^ +* Fixed an issue in ``xclim.core.units.to_agg_units`` that broke the resampling when computing on unitless data v0.54.0 (2024-12-16) -------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`), Éric Dupuis (:user:`coxipi`), Sascha Hofmann (:user:`saschahofmann`). From 4bc1309da200415fbb032f6744855a6033200ea7 Mon Sep 17 00:00:00 2001 From: saschahofmann Date: Mon, 27 Jan 2025 13:58:40 +0100 Subject: [PATCH 3/3] Add pull number to changelog line --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2138d2267..b0d5df57b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -25,7 +25,8 @@ Internal changes Bug fixes ^^^^^^^^^ -* Fixed an issue in ``xclim.core.units.to_agg_units`` that broke the resampling when computing on unitless data +* Fixed an issue in ``xclim.core.units.to_agg_units`` that broke the resampling when computing on unitless data (:pull:`2060`). + v0.54.0 (2024-12-16) -------------------- Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Pascal Bourgault (:user:`aulemahal`), Éric Dupuis (:user:`coxipi`), Sascha Hofmann (:user:`saschahofmann`).