From fa18daffb246fd8f48963ebdc0f791b91c88d08e Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 11 Jan 2020 15:57:20 +0100 Subject: Fix noon-dependent sun direction sign conversion --- sun.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sun.py') diff --git a/sun.py b/sun.py index 87bc8a9..379ad64 100644 --- a/sun.py +++ b/sun.py @@ -26,7 +26,7 @@ def sun_direction(lat, lon, time, time_diff, summertime_shift = 0): altitude = np.arcsin(np.cos(l) * np.cos(h) * np.cos(d) + np.sin(l) * np.sin(d)) azimuth = np.arccos((np.cos(d) * np.sin(l) * np.cos(h) - np.sin(d) * np.cos(l)) / np.cos(altitude)) - if (time.timetuple().tm_hour <= 12): + if h < 0: return (altitude, -azimuth) else: return (altitude, azimuth) -- cgit v1.2.3