def add_night_pic(self, pic_loc):
        night_pics = {
            "First Quarter":"moon_firstquarter.png", 
            "Full Moon":"full_moon1.jpg", 
            "Last Quarter":"moon_lastquarter.png", 
            "New Moon":"newmoon.png", 
            "Waning Crescent":"moon_waningcrescent.png",
            "Waning Gibbous":"moon_waninggibbous.png", 
            "Waxing Crescent":"moon_waxingcrescent.png", 
            "Waxing Gibbous":"moon_waxinggibbous.png"
            }

        # Pull tz to avoid error comparing tz value dt to one without
        naive_dt = self.as_of
        moon = moonphase.main(naive_dt)
        print 'add_night, %s' % moon

        if moon in night_pics:
            self.pic = pic_loc + night_pics[moon]
            if moon.endswith("Moon"):
                self.weather_descrip = moon
            else:
                self.weather_descrip = moon + ' Moon'
        else:
            print 'Error finding photo for the time of day'
Exemple #2
0
 def moon(self):
     return moonphase.main(self.as_of)