Closed
Description
The value passed to arccos()
can end up being greater than 1 due to numerical imprecision. When this happens, nan is returned.
return np.sign(hour_angle) * np.abs(np.arccos((np.cos(zenith) * np.sin(
latitude) - np.sin(declination)) / (np.sin(zenith) * np.cos(
latitude)))) + np.pi
My solution would be to put in a clip(-1,1)
(and also do some reformatting).
A search for arccos
and arcsin
turns up a few other code locations that could be susceptible to this.