astral
astral copied to clipboard
Sun rise and set cal error
Sunset and sunrise calculations occurred error
The code are below:
day = datetime.date(2024, 3, 22)
lat = 38.41129869
lon = 90.137575
city = LocationInfo('name', 'region', 'timezone/name', lat, lon)
try:
s = sun(city.observer, day, tzinfo=timezone(timedelta(hours=8)))
r = {}
r.update({'sunset': s['sunset'].replace(tzinfo=None),
'sunrise': s['sunrise'].replace(tzinfo=None), })
except ValueError as e:
logger.exception(e)
The error
ValueError: Unable to find a sunrise time on the date specified
Other parameters also have this error, like:
day,lat,lon
2028-04-07,44.6072919,82.894195
2013-03-05,36.38176111,96.44025556
2010-04-16,41.17189303,80.25687664
2011-04-29,39.714734,76.167327
2018-01-20,39.16666666,109.05