From 1beab53ff0882f7da6063b74d8ad0aa54bda1c52 Mon Sep 17 00:00:00 2001 From: Mathieu Dupont <108517594+mathieudpnt@users.noreply.github.com> Date: Fri, 14 Nov 2025 12:00:15 +0100 Subject: [PATCH] bypass astral error on suntimes --- src/post_processing/utils/core_utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/post_processing/utils/core_utils.py b/src/post_processing/utils/core_utils.py index 37f9084..cf14302 100644 --- a/src/post_processing/utils/core_utils.py +++ b/src/post_processing/utils/core_utils.py @@ -129,12 +129,16 @@ def get_sun_times( h_sunrise, h_sunset = [], [] - for date in [ts.date() for ts in date_range(start.normalize(), - stop.normalize(), - freq="D", - )]: - dt_sunrise = sunrise(gps.observer, date=date, tzinfo=tz) - dt_sunset = sunset(gps.observer, date=date, tzinfo=tz) + for date in [ + ts.date() + for ts in date_range( + start.normalize(), + stop.normalize(), + freq="D", + ) + ]: + dt_sunrise = Timestamp(sunrise(gps.observer, date=date)).tz_convert(tz) + dt_sunset = Timestamp(sunset(gps.observer, date=date)).tz_convert(tz) # Convert sunrise and sunset to decimal hours h_sunrise.append(dt_sunrise.hour + dt_sunrise.minute / 60 + dt_sunrise.second / 3600 + dt_sunrise.microsecond / 3_600_000_000)