2
$\begingroup$

this is the code i am using for the "Mean Node" even tho even this one is off by a couple of minutes

import datetime
import swisseph as swe

swe.set_ephe_path('/usr/share/ephe')

# Get the current date
current_date = datetime.date.today()

# Calculate the Julian Day
jd = swe.julday(current_date.year, current_date.month, current_date.day)

# Calculate the position of the North Node (10 represents North Node)
pos = swe.calc_ut(jd, 10)

# Extract the ecliptic longitude of the North Node
ecliptic_longitude = pos[0][0]  # Access the correct value within the tuple

# Calculate astrological sign and degrees
zodiac_signs = ['Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo',
                'Libra', 'Scorpio', 'Sagittarius', 'Capricorn', 'Aquarius', 'Pisces']

# Calculate degrees, minutes, and seconds
degrees = int(ecliptic_longitude)
remaining_degrees = (ecliptic_longitude - degrees) * 60
minutes = int(remaining_degrees)
seconds = (remaining_degrees - minutes) * 60

# Calculate astrological sign index
sign_index = (degrees // 30) % 12

print(f"Current Date and Time: {datetime.datetime.now()}")
print(f"Longitude of North Node: {degrees}° {minutes}' {seconds:.2f}\"")
print(f"Astrological Sign: {zodiac_signs[sign_index]}")

swe.close()

I am yet to find any info on how to calculate this thing. The one in the example uses python by any language is fine. Also even tho this code uses "swisseph" skyfield is also fine as long as it works

$\endgroup$
2
  • $\begingroup$ Here's how to ask JPL Horizons to calculate the true node: astronomy.stackexchange.com/a/54466/16685 $\endgroup$
    – PM 2Ring
    Commented Aug 29, 2023 at 21:22
  • $\begingroup$ Thank you Mike, that actually fixed my issue as after posting I found the swe.TRUE_NODE(11) and it was a couple of minutes off even with that.. so problem solved. I spoke too soon .. the first output is before the edit however the second is still off by seconds now, which in node world can be quite a bit `$ python truenodes1.py Current Date and Time: 2023-09-05 16:12:28.545007 Longitude of North Node: 25° 44' 52.47" Astrological Sign: Aries (pipshitz) ethan@astrologyReadings ~/Downloads $ nano truenodes1.py (pipshitz) ethan@astrologyReadings ~/Downloads $ python truenodes1.py Current Date and $\endgroup$
    – dimitri33
    Commented Sep 6, 2023 at 0:39

1 Answer 1

5
$\begingroup$

The short answer is to call swe.calc_ut with body swe.TRUE_NODE (11) instead of swe.MEAN_NODE (10).

The underlying library documentation explains the difference between the two. If I understand correctly, the "true" node is that of an osculating orbit, and the "mean" node uses a semi-analytical expression in the form of ELP 2000-85 but fitted to JPL DE431.

I also suggest passing the current UT hour to swe.julday instead of the default 12:00.

current_date = datetime.datetime.now(datetime.timezone.utc)

jd = swe.julday(current_date.year, current_date.month, current_date.day,
        current_date.hour + current_date.minute / 60)

pos = swe.calc_ut(jd, swe.TRUE_NODE)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .