skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.39k stars 209 forks source link

Moon phase - time finder #790

Closed skynoob-new closed 1 year ago

skynoob-new commented 1 year ago

Hello , Using below code i can find the moon phase between days, given the time,

from skyfield import api
from skyfield import almanac
ts = api.load.timescale()
eph = api.load('de421.bsp')
t = ts.utc(2020,7, range(1,5))
for i in t:
  phase = almanac.moon_phase(eph, i)
  print('Moon phase: {:.1f} degrees'.format(phase.degrees),i)

I was searching for finding the time at which a specific moonphase will occur and i got this https://rhodesmill.org/skyfield/searches.html, i am not really sure how would i combine that here to find the time at which some of the moon phase occur, ex: at what time, the moon phase would be at 20 /40/60 degrees. It seems that i cannot send a list of dates to the function almanac.moon_phase. Any help would be appreciated.

Bernmeister commented 1 year ago

I'm not sure about obtaining when the moon phase is at a particular value, but for the known moon phases, there is an example.

brandon-rhodes commented 1 year ago

@skynoob-new — As you have a discussion #774 already open about this topic, let's focus the conversation over there so that it doesn't wind up being scattered across two different places. Thanks!