From 425c92d996d6f7f30165632373f85aead4d16cc0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 21:46:17 +0000 Subject: [PATCH 1/2] Initial plan From ceb41f16545a553fa723b8c48abcaa082a41db07 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 23:22:45 +0000 Subject: [PATCH 2/2] Replace broad except ValueError with explicit duplicate-index check in degradation_timeseries_plot Co-authored-by: cdeline <23244088+cdeline@users.noreply.github.com> --- rdtools/plotting.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rdtools/plotting.py b/rdtools/plotting.py index 2191ac04..7cd4ef47 100644 --- a/rdtools/plotting.py +++ b/rdtools/plotting.py @@ -487,10 +487,8 @@ def _bootstrap(x, percentile, reps): if ci_color is None: ci_color = 'C0' - try: - roller = results_values.rolling(f'{rolling_days}d', min_periods=rolling_days//4, - center=True) - except ValueError: + results_values = results_values.sort_index() + if results_values.index.has_duplicates: # this occurs with degradation_year_on_year(multi_yoy=True). resample to daily mean warnings.warn( "Input `yoy_info['YoY_values']` appears to have multiple annual " @@ -503,6 +501,9 @@ def _bootstrap(x, percentile, reps): roller = results_values.resample('D').mean().rolling(f'{rolling_days}d', min_periods=rolling_days//4, center=True) + else: + roller = results_values.rolling(f'{rolling_days}d', min_periods=rolling_days//4, + center=True) # unfortunately it seems that you can't return multiple values in the rolling.apply() kernel. # TODO: figure out some workaround to return both percentiles in a single pass if include_ci: