Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finding full moon day #3

Open
saikiran91 opened this issue Dec 21, 2019 · 3 comments
Open

Finding full moon day #3

saikiran91 opened this issue Dec 21, 2019 · 3 comments

Comments

@saikiran91
Copy link

saikiran91 commented Dec 21, 2019

I finding a hard time converting the below code to calculate the last full moon and full moon day. Any help is greatly appreciated. Thanks.

# New moon day: sun and moon have same longitude (0 degrees = 360 degrees difference)
# Full moon day: sun and moon are 180 deg apart

def new_moon(jd, tithi_, opt = -1):
    """Returns JDN, where
       opt = -1:  JDN < jd such that lunar_phase(JDN) = 360 degrees
       opt = +1:  JDN >= jd such that lunar_phase(JDN) = 360 degrees
    """
    if opt == -1:  start = jd - tithi_         # previous new moon
    if opt == +1:  start = jd + (30 - tithi_)  # next new moon
    # Search within a span of (start +- 2) days
    x = [ -2 + offset/4 for offset in range(17) ]
    y = [lunar_phase(start + i) for i in x]
    y = unwrap_angles(y)
    y0 = inverse_lagrange(x, y, 360)
    return start + y0
@dhoomakethu
Copy link
Owner

What are you converting this code in to ? Are you trying to port it to another language?

@saikiran91
Copy link
Author

saikiran91 commented Dec 21, 2019

Firstly thanks for your quick response and sorry my question was different, I am struggling to calculate or find full moon day using the above code. The comment says Full moon day: sun and moon are 180 deg apart but tried this in a multiple-way, but fail to calculate last full moon and next full moon. I update the original question. @dhoomakethu

@saikiran91 saikiran91 changed the title Finding new moon day Finding full moon day Dec 21, 2019
@saikiran91
Copy link
Author

@dhoomakethu Any update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants