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

Enable select_resample_op for unitless data #2060

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ 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 (: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`).
Expand Down
3 changes: 3 additions & 0 deletions src/xclim/core/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,9 @@ def to_agg_units(
>>> degdays.units
'd K'
"""
if "units" not in orig.attrs:
return out
Comment on lines +669 to +670
Copy link
Collaborator

Choose a reason for hiding this comment

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

@aulemahal Would it make sense to emit a UserWarning if the data doesn't have units, so that users know that nothing will happen here?


is_difference = True if op in ["std", "var"] else None

if op in ["amin", "min", "amax", "max", "mean", "sum", "std"]:
Expand Down
Loading