pingswept / pysolar

Pysolar is a collection of Python libraries for simulating the irradiation of any point on earth by the sun. It includes code for extremely precise ephemeris calculations.
http://pysolar.org
GNU General Public License v3.0
376 stars 125 forks source link

problem with get_azimuth_fast #75

Closed fsteinmetz closed 6 years ago

fsteinmetz commented 6 years ago

The values returned by get_azimuth_fast are completely different from those returned by get_azimuth. After verification it seems that get_azimuth_fast is the culprit. Offset of 180 ?

from pysolar import solar
import numpy as np
from datetime import datetime
import pytz

lat = 50.
lon = 3.
time = datetime(2018, 5, 8, 12, 0, 0, tzinfo=pytz.UTC)

print(solar.get_azimuth(lat, lon, time))        # returns 186.8391776928919
print(solar.get_azimuth_fast(lat, lon, time))   # returns 6.8545786939043`
pingswept commented 6 years ago

Yes, I bet you have diagnosed the problem correctly. I'm not sure exactly where to fix the error. This line looks suspicious: https://github.com/pingswept/pysolar/blob/master/pysolar/solar.py#L174

AmitAronovitch commented 6 years ago

fix available in PR #83