Skip to content
Snippets Groups Projects
Commit ed1a52fa authored by tomrink's avatar tomrink
Browse files

minor...

parent 7aa4639b
No related branches found
No related tags found
No related merge requests found
...@@ -2,27 +2,32 @@ from skyfield import api ...@@ -2,27 +2,32 @@ from skyfield import api
from skyfield import almanac from skyfield import almanac
from util.util import get_time_tuple_utc from util.util import get_time_tuple_utc
ts = api.load.timescale() time_scale = api.load.timescale()
eph = api.load('de421.bsp') eph = api.load('de421.bsp')
def convert_time(epoch_time): def convert_time(epoch_time):
dt_obj, dt_tup = get_time_tuple_utc(epoch_time) dt_obj, dt_tup = get_time_tuple_utc(epoch_time)
t = ts.from_datetime(dt_obj) t = time_scale.from_datetime(dt_obj)
t = ts.utc(dt_tup[0], dt_tup[1], dt_tup[2], dt_tup[3]) t = time_scale.utc(dt_tup[0], dt_tup[1], dt_tup[2], dt_tup[3])
return t return t
def moon_phase(epoch_time, phs_deg=70):
phase = almanac.moon_phase(eph, convert_time(epoch_time))
return (phase.degrees > phs_deg) & (phase.degrees < 360 - phs_deg)
def convert_times(epoch_time_s): def convert_times(epoch_time_s):
dt_obj_s = [] dt_obj_s = []
for et in epoch_time_s: for et in epoch_time_s:
dt_obj_s.append(get_time_tuple_utc(et)[0]) dt_obj_s.append(get_time_tuple_utc(et)[0])
t = ts.from_datetimes(dt_obj_s) t = time_scale.from_datetimes(dt_obj_s)
return t return t
def moon_phase(dt_obj_s, phs_deg=70): def moon_phases(dt_obj_s, phs_deg=70):
t = ts.from_datetimes(dt_obj_s) t = time_scale.from_datetimes(dt_obj_s)
phase = almanac.moon_phase(eph, t) phase = almanac.moon_phase(eph, t)
return (phase.degrees > phs_deg) & (phase.degrees < 360-phs_deg) return (phase.degrees > phs_deg) & (phase.degrees < 360-phs_deg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment