From 04787cbd3a6198171aa97757af2f56d32597bee9 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:42:22 -0500 Subject: [PATCH] fix units Signed-off-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> --- src/xclim/indices/_threshold.py | 4 ++-- tests/test_snow.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xclim/indices/_threshold.py b/src/xclim/indices/_threshold.py index 6e30b311d..4404461c7 100644 --- a/src/xclim/indices/_threshold.py +++ b/src/xclim/indices/_threshold.py @@ -3690,7 +3690,7 @@ def holiday_snow_days( xmas_days = (snow_depth_constrained >= snow_depth_thresh).resample(time=freq).sum() - xmas_days = xmas_days.assign_attrs({"units": "1"}) + xmas_days = xmas_days.assign_attrs({"units": "days"}) return xmas_days @@ -3769,5 +3769,5 @@ def holiday_snow_and_snowfall_days( .sum() ) - perfect_xmas_days = perfect_xmas_days.assign_attrs({"units": "1"}) + perfect_xmas_days = perfect_xmas_days.assign_attrs({"units": "days"}) return perfect_xmas_days diff --git a/tests/test_snow.py b/tests/test_snow.py index 505aca50e..7158c58d8 100644 --- a/tests/test_snow.py +++ b/tests/test_snow.py @@ -135,7 +135,7 @@ def test_xmas_days_simple(self, nimbus): out = land.holiday_snow_days(snd) - assert out.units == "1" + assert out.units == "days" assert out.long_name == "Number of holiday days with snow" np.testing.assert_array_equal( out.sum(dim="time"), @@ -166,7 +166,7 @@ def test_perfect_xmas_days_simple(self, nimbus): out = land.holiday_snow_and_snowfall_days(snd, prsn) - assert out.units == "1" + assert out.units == "days" assert out.long_name == "Number of holiday days with snow and snowfall" np.testing.assert_array_equal( out.sum(dim="time"),