Beispiel #1
0
 def lunar_altitude(self, tee):
     """Return the geocentric altitude of moon at moment, tee,
     at location, location, as a small positive/negative angle in degrees,
     ignoring parallax and refraction.  Adapted from 'Astronomical
     Algorithms' by Jean Meeus, Willmann_Bell, Inc., 1998."""
     lamb = Lunar.lunar_longitude(tee)
     beta = Lunar.lunar_latitude(tee)
     alpha = Astro.right_ascension(tee, beta, lamb)
     delta = Astro.declination(tee, beta, lamb)
     theta0 = Astro.sidereal_from_moment(tee)
     cap_H = mod(theta0 + self.longitude - alpha, 360)
     altitude = arcsin_degrees(
         (sin_degrees(self.latitude) * sin_degrees(delta)) +
         (cos_degrees(self.latitude) * cos_degrees(delta) * cos_degrees(cap_H)))
     return mod(altitude + 180, 360) - 180
Beispiel #2
0
 def sine_offset(self, local_time, alpha):
     """Return sine of angle between position of sun at 
     local time tee and when its depression is alpha at location, location.
     Out of range when it does not occur."""
     phi = self.latitude
     tee_prime = self.universal_from_local(local_time)
     delta = Astro.declination(tee_prime, mpf(0), Solar.solar_longitude(tee_prime))
     return ((tan_degrees(phi) * tan_degrees(delta)) +
             (sin_degrees(alpha) / (cos_degrees(delta) *
                                    cos_degrees(phi))))
Beispiel #3
0
 def local_from_apparent(self, tee):
     """Return local time from sundial time tee at location, location."""
     return tee - Astro.equation_of_time(self.universal_from_local(tee))
Beispiel #4
0
 def apparent_from_local(self, local_time):
     """Return sundial time from local time at this location."""
     return local_time + Astro.equation_of_time(self.universal_from_local(local_time))
Beispiel #5
0
 def universal_from_local(self, local_time):
     """Return universal time from local time at this location."""
     return local_time - Astro.zone_from_longitude(self.longitude)
Beispiel #6
0
def sidereal_lunar_longitude(tee):
    """Return sidereal lunar longitude at moment, tee."""
    return mod(Lunar.lunar_longitude(tee) - Astro.precession(tee) + SIDEREAL_START, 360)
Beispiel #7
0
    return ifloor(mod((HinduSolarDate.longitude(date) + HinduLunarDate.longitude(date)) / angle(0, 800, 0), 27)) + 1

def sacred_wednesdays(g_year):
    """Return the list of Wednesdays in Gregorian year, g_year,
    that are day 8 of Hindu lunar months."""
    return sacred_wednesdays_in_range(GregorianDate.year_range(g_year))

def sacred_wednesdays_in_range(range):
    """Return the list of Wednesdays within range of dates
    that are day 8 of Hindu lunar months."""
    a      = range[0]
    b      = range[1]
    wed    = DayOfWeek.Wednesday.on_or_after(a)
    h_date = HinduLunarDate.from_fixed(wed)
    ell  = [wed] if (h_date.day == 8) else []
    if is_in_range(wed, range):
        ell[:0] = sacred_wednesdays_in_range([wed + 1, b])
        return ell
    else:
        return []

SIDEREAL_START = Astro.precession(HinduDate.UJJAIN.universal_from_local(mesha_samkranti(JulianDate.ce(285))))

def sidereal_solar_longitude(tee):
    """Return sidereal solar longitude at moment, tee."""
    return mod(Solar.solar_longitude(tee) - Astro.precession(tee) + SIDEREAL_START, 360)

def sidereal_lunar_longitude(tee):
    """Return sidereal lunar longitude at moment, tee."""
    return mod(Lunar.lunar_longitude(tee) - Astro.precession(tee) + SIDEREAL_START, 360)