From 9bd0c5ddc37c2739f1a1c0ddf80d4bdd749251e0 Mon Sep 17 00:00:00 2001 From: Greg Starr Date: Sat, 25 Jun 2022 00:29:34 -0400 Subject: [PATCH] fixing issue with duplicate times at day boundaries --- test/test_trough.py | 2 +- trough/_trough.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_trough.py b/test/test_trough.py index 6899eeb..60a5063 100644 --- a/test/test_trough.py +++ b/test/test_trough.py @@ -248,7 +248,7 @@ def test_script_multiple_config(): @pytest.mark.slow def test_date_error(): - start_date = datetime(2015, 3, 17) + start_date = datetime(2015, 3, 15) end_date = datetime(2015, 3, 18) n_times = 1 + ((end_date - start_date) / timedelta(minutes=30)) with TemporaryDirectory() as tempdir: diff --git a/trough/_trough.py b/trough/_trough.py index 9241aab..f83f987 100644 --- a/trough/_trough.py +++ b/trough/_trough.py @@ -292,7 +292,7 @@ def label_trough_dataset(start_date, end_date, params=None, tec_dir=None, arb_di start = max(start_date, start) end = min(end_date, end) data = label_trough_interval(start, end, params, hemisphere, tec_dir, arb_dir, omni_file) - if end.year == start.year + 1: + if end != end_date: data = data.isel(time=slice(0, -1)) labels.append(data['labels']) scores.append(data['score'])