0

I am trying to find out the longitude of ascending/descending moon nodes using Skyfield but unable to find any reference in documentation. Is it possible? Also do any of the JPL Files provide this data already?

Prabhash
  • 73
  • 9
  • Could you give an example of an ascending node that's provided in a specific JPL file, and the Skyfield code for accessing it? That might help folks have a better start on answering the question. Thanks! – Brandon Rhodes Aug 28 '17 at 02:45
  • @BrandonRhodes thanks for replying back. However I don't have a example code or JPL file yet. In fact that is what I am seeking through this question. That said, I did find mention on moon nodes skyfield's [nutationlib.py](https://github.com/skyfielders/python-skyfield/blob/master/skyfield/nutationlib.py). – Prabhash Aug 28 '17 at 06:58
  • When you say “as they do for all other planets”, do you have an example, of a JPL file that provides this for another planet? If not then you might want to edit the question to clarify that phrase a little, because it makes it sound like you have found a JPL file with ascending and descending nodes inside. – Brandon Rhodes Aug 28 '17 at 12:08
  • @BrandonRhodes no sorry I did not mean that. I have edited the question to make it clear now. – Prabhash Aug 28 '17 at 18:35
  • off site stuff recommendation is off topic here so +Close. Sadly to get correct Moon data is really a big deal. The best you can do is take some ephemeris of Moon and fit the ellipse through it ... but that will work just for a time ... – Spektre Aug 29 '17 at 08:05
  • @Spektre You can do better than ellipse fitting using JPL DE files (or HORIZONS/geomfinder/similar). Migrate this to astronomy.SE just for fun, though I agree it needs more details to be a good question. –  Aug 29 '17 at 14:12

1 Answers1

2

Update:

Skyfield’s almanac module now supports this computation directly! See: Lunar Nodes

Original answer, for those wanting these details:

It is easy to at least find them relative to the J2000 ecliptic — which might be fine for dates far from the year 2000 as well, since I think that only the definition of ecliptic longitude changes with the passing years, but not latitude (which is what the nodes care about)?

In any case, you'd precede like this. Let's say you want the ascending node. It must happen within the next 30 days, because that's more than a full orbit of the Moon, so let's look for the day on which the latitude of the Moon passes from negative to positive:

from skyfield.api import load
ts = load.timescale()
eph = load('de421.bsp')
earth = eph['earth']
moon = eph['moon']

t = ts.utc(2018, 1, range(14, 14 + 30))
lat, lon, distance = earth.at(t).observe(moon).ecliptic_latlon()
angle = lat.radians

for i in range(len(angle)):
    if angle[i] < 0 and angle[i+1] > 0:
        break

print(t[i].utc_jpl(), angle[i])
print(t[i+1].utc_jpl(), angle[i+1])

The result is the discovery that the ascending node must happen sometime on January 31st:

A.D. 2018-Jan-31 00:00:00.0000 UT -0.0188679292421
A.D. 2018-Feb-01 00:00:00.0000 UT 0.00522392011676

To find the exact time, install the SciPy library, and ask one of its solvers to find the exact time at which the value reaches zero. You just have to create a little function that takes a number and returns a number, by converting the number to a Skyfield time and then the angle back to a plain number:

from scipy.optimize import brentq

def f(jd):
    t = ts.tt(jd=jd)
    angle, lon, distance = earth.at(t).observe(moon).ecliptic_latlon()
    return angle.radians

node_t = brentq(f, t[i].tt, t[i+1].tt)
print(ts.tt(jd=node_t).utc_jpl())

The result should be the exact moment of the node:

A.D. 2018-Jan-31 18:47:54.5856 UT
Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
  • This is technically incorrect. The wiki has a page "Longitude of the ascending node" which gives a formula for how to calculate the lunar node for a given date. The formula is based on the relative position and velocity vectors of the moon with respect to Earth. – Tyler Gannon Feb 08 '23 at 04:46