Reputation: 149
Skyfield has the functionality to compute the phases of the moon. but What if I wanted to know when would the moon be 20 degrees from the sun or 25 degrees from the sun.
How can I get the exact date and time when the sun and moon would be at a certain degree longitude?
Edit(for clarification): Is it possible to know the next (or previous) date and time the sun or moon would be at a certain position? Like skyfield provides a function to find when sun and moon are at 0 degrees or 180 degrees (new moon, full moon).
Upvotes: 2
Views: 588
Reputation: 89415
Yes, Skyfield supports a possible approach. Look at its almanac.py
module and you will find there are two steps:
Create a function that, given a date, returns 0
if the Moon is <20° from the Sun or 1
if the Moon is ≥20°. You can either create this function directly and simply, or be more complicated like Skyfield is, and return a function from inside another function that holds the references to things like the ephemeris that the function will need to generate its answer.
Pass that function to the find_discrete()
routine to tell you the moments at which the function flips from 0
to 1
or back again during a particular time period.
Hopefully the examples there will help you get started!
Upvotes: 1