예제 #1
0
def moon_phase(time):
    """
    Input: astropy.time.Time object
    calculates number of days until full moon using pyephem
    """
    Apache = ephem.Observer()
    Apache.lat = APACHE.latitude.value
    Apache.lon = APACHE.longitude.value
    Apache.elevation = APACHE.height
    Apache.date = time.iso

    m = ephem.Moon(Apache)

    #days until next full moon
    full = ephem.next_full_moon(time.iso)
    full = Time(full.datetime())
    time_diff = abs(full - time)
    days_to_full = time_diff.sec / 86400.

    return days_to_full