From 36ab382d9ef15a723ae03fa821ecdb4ecac4aa74 Mon Sep 17 00:00:00 2001 From: Lene Wasskog <lene.wasskog@nibio.no> Date: Wed, 26 Feb 2025 14:52:05 +0100 Subject: [PATCH] chore: Clear logging config, fix date extraction --- SEPTREFHUM.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SEPTREFHUM.py b/SEPTREFHUM.py index 7bd9083..cbf2ebe 100755 --- a/SEPTREFHUM.py +++ b/SEPTREFHUM.py @@ -66,6 +66,7 @@ tmpfile_path = f"tmp/{year}/" TEMPERATURE_THRESHOLD = 8.0 DEBUG = False if os.getenv("DEBUG") is None or os.getenv("DEBUG").lower() == "false" else True +logging.getLogger().handlers.clear() logging.basicConfig( level=logging.DEBUG if DEBUG else logging.INFO, format="%(asctime)s - %(levelname).4s - (%(filename)s:%(lineno)d) - %(message)s", @@ -78,7 +79,7 @@ start_date = None last_wh_date = None #""" for wh_file in glob.glob(f"{tmpfile_path}wh_2[0-9][0-9][0-9]-[01][0-9]-[0123][0-9].nc"): - current_wh_file_date = local_timezone.localize(datetime.strptime(f"{wh_file[7:17]}", "%Y-%m-%d")) + current_wh_file_date = local_timezone.localize(datetime.strptime(f"{wh_file[12:22]}", "%Y-%m-%d")) if last_wh_date is None or last_wh_date < current_wh_file_date: last_wh_date = current_wh_file_date if last_wh_date is not None: -- GitLab