def testSunEquation_standardValue_calculateCorrectly(): date = dt.datetime(2019, 1, 1) DEC = -23.03993184124207 EOT = -0.053431595269049836 declination, equationOfTime = algorithms.sunEquation(date) assert DEC == declination, "Declination calculations failed!" assert EOT == equationOfTime, "EoT calculations failed!"
def computeIsha(date, angle, latitude, thuhr): """ Calculates the time of Isha prayer. :param date: datetime.datetime, representing the Gregorian date. :param angle: Number, the angle convention used to calculated Isha. :param latitude: Number, the latitude of the point of interest in degrees. :param thuhr: datetime.datetime, Thuhr prayer on the SAME day. :return: datetime.datetime, the datetime of Isha. """ declination, _ = sunEquation(date) fajr = thuhr + horizonEquation(angle, latitude, declination) return fajr
def computeAsr(date, shadowLength, latitude, thuhr): """ Calculates the time of Asr prayer. :param date: datetime.datetime, representing the Gregorian date. :param shadowLength: Number, the multiplier for the length of an object's shadow. :param latitude: Number, the latitude of the point of interest in degrees. :param thuhr: datetime.datetime, Thuhr prayer on the SAME day. :return: datetime.datetime, the time of Asr prayer. """ declination, _ = sunEquation(date) asr = thuhr + asrEquation(shadowLength, latitude, declination) return asr
def computeThuhr(date, longitude, timeZone): """ Calculates the time of Thuhr prayer. :param date: datetime.datetime, representing the Gregorian date. :param longitude: Number, the longitude of the point of interest in degrees. :param timeZone: Number, the timezone of the point of interest in degrees. :return: datetime.datetime, the time of Thuhr prayer. """ _, equationOfTime = sunEquation(date) t = 12 + timeZone - (longitude/15 + equationOfTime) thuhr = date + dt.timedelta(hours=t) return thuhr