-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeWarning: invalid value encountered in arccos #13
Comments
Hi ! Got the exact same error today when using these data: Was thinking it was due to float precision, because |
import suncalc
paris = lat, lon = 48.862725, 2.287592
dates = pd.date_range("2022-01-01", "2022-12-31", freq="D")
lons, lats = [lon] * len(dates), [lat] * len(dates)
times = suncalc.get_times(dates, lons, lats)
night = times["night"]
dates[night[night.isna()].index]
>> DatetimeIndex(['2022-06-12', '2022-06-13', '2022-06-14', '2022-06-15',
'2022-06-16', '2022-06-17', '2022-06-18', '2022-06-19',
'2022-06-20', '2022-06-21', '2022-06-22', '2022-06-23',
'2022-06-24', '2022-06-25', '2022-06-26', '2022-06-27',
'2022-06-28', '2022-06-29', '2022-06-30'],
dtype='datetime64[ns]', freq=None) Seems to occur near the summer solstice. |
A PR is welcome, but I'm not using this package myself. You might want to check in the JS implementation if they do something different or if the same error occurs there |
This seems a little strange; presumably some calculation is ending up trying to take arccos of a number greater than 1 (or less than -1), which might indicate a more significant issue.
Running this (with suncalc 0.1.3 from PyPI) gives:
The text was updated successfully, but these errors were encountered: