Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_next_date_special(self, date_tuple, utc_offset=0):
"""
Returns next ephemeris date the given time.
The date tuple should be in the local time.
return date tupple
"""
cpm = None;
if self.string_tab == '@fullmoon':
cpm = ephem.next_full_moon(date_tuple)
elif self.string_tab == '@newmoon':
cpm = ephem.next_new_moon(date_tuple)
elif self.string_tab == '@firstquarter':
cpm = ephem.next_first_quarter_moon(date_tuple)
elif self.string_tab == '@lastquarter':
cpm = ephem.next_last_quarter_moon(date_tuple)
elif self.string_tab == '@equinox':
cpm = ephem.next_equinox(date_tuple)
elif self.string_tab == '@solstice':
cpm = ephem.next_solstice(date_tuple)
elif self.string_tab in ['@dawn', '@dusk']:
bobs = ephem.Sun()
date = "{0}/{1}/{2} 00:00".format(date_tuple[0], date_tuple[1], date_tuple[2])
self._observer.date = date
# print date
if self.string_tab == '@dawn':
def _getNextFullMoon(self):
"""
Return the date and time of the next full moon
@return : the next full moon daytime
"""
now=datetime.datetime.today()
nextfullmoon=ephem.next_full_moon(now)
return nextfullmoon
def get_next_full_moon(self, time: Node.clock):
"""Gets the date of the next full moon"""
new_time = datetime.datetime(*time.time_obj[:7])
rtn_time = ephem.next_full_moon(new_time).datetime()
return TypeTime.parse_struct_time(rtn_time.timetuple())
def run():
''' Get the first fall sub 29 and when the nearest full moon was that year
'''
cursor.execute(''' SELECT year, min(day), min(extract(doy from day))
from alldata_ia where
station = 'IA0200' and low < 29 and month > 6 GROUP by year ORDER
by year ASC''')
juliandays = []
moondiff = []
for row in cursor:
juliandays.append(row[2])
myloc.date = "%s/%s/%s" % (row[1].year, row[1].month, row[1].day)
lastd = s2dt(ephem.previous_full_moon(myloc.date)).date()
today = row[1]
nextd = s2dt(ephem.next_full_moon(myloc.date)).date()
forward = (nextd - today).days
backward = (today - lastd).days
if backward == forward:
moondiff.append(backward)
elif backward < forward:
moondiff.append(backward)
elif forward < backward:
moondiff.append(0 - forward)
return moondiff, juliandays