Closed jorjun closed 2 years ago
What you are running into is that the precession of the Earth's axis over a span of 22 years is significant. In the documentation for the Ecliptic function, it says "returns J2000 ecliptic latitude, longitude, and cartesian coordinates". The J2000 means that the coordinate system uses the Earth's equinox (where the equatorial plane and ecliptic plane intersect) on January 1, 2000. This equinox point is always moving. This year's equinox is no longer in the same place along the Earth's orbital path.
If you are trying to find the date of the equinox, the Seasons function will give you the correct answer:
const Astronomy = require('./astronomy.js');
const seasons = Astronomy.Seasons(2022);
console.log(seasons.mar_equinox.date);
$ node ecliptic_longitude.js
2022-03-20T15:33:24.790Z
If you are trying to do something else, I can help suggest an approach. Just let me know and I'll do my best...
Thanks so much, I think I do need a bit more help. I am making an interactive astrology tool, it's here: https://greenwichmeantime.com/articles/calendars/natal-chart/
If you set the date to March 20, you can see when Aries (Sun) kicks in (March equinox) but too soon by a few hours.
Would be great if I could apply a reliable correction to Ecliptic calc.. to close this 5 hour or so gap..
I was going to suggest using the Constellation
function. Unfortunately, I discovered astrology uses conventions that are not based on the actual current positions of bodies in the sky. For example, on March 20, the Sun will be in the constellation of Pisces.
const Astronomy = require('./astronomy.js');
function SunConstellation(date) {
// Calculate the apparent position of the Sun from the Earth's perspective.
// Correct for light travel time and aberration.
// The result is a vector in J2000 equatorial coordinates.
const vec = Astronomy.GeoVector(Astronomy.Body.Sun, date, true);
// Convert the vector to equatorial angles:
// equ.ra = right ascension in sidereal hours
// equ.dec = declination in degrees
const equ = Astronomy.EquatorFromVector(vec);
// Find the constellation that contains the given point in the sky.
const con = Astronomy.Constellation(equ.ra, equ.dec);
return con;
}
function Print(date) {
const time = Astronomy.MakeTime(date);
const con = SunConstellation(time);
console.log(time.date, con.name);
}
Print(new Date('2022-03-20T15:33:00Z'));
$ node sun_constellation.js
2022-03-20T15:33:00.000Z Pisces
You can confirm this using the Sun calculator from Heaven's Above. This inconsistency is because astrology was devised many centuries ago, when the Earth's axis was oriented much differently. It looks like astrology uses the convention that the Sun "enters Aries" on the equinox, even though this not really true any more. In that case, the code I showed above is your best bet for finding the exact moment of the March equinox.
I'm not sure how you would calculate the other zodiac signs, but maybe you can find a definition that can be translated to current astronomical calculations? If so, I can help with those too.
Here is a link that explains more about how astrology zodiac signs have drifted over time: https://usm.maine.edu/planet/why-vernal-equinox-called-first-point-aries-when-sun-actually-pisces-date
I am an amateur astrologer. In the West we use tropical astrology, the Hindu system is sidereal.
It doesn't matter to us which constellations are in the sky , the tropical system is used for precise measurement of seasons, originally for agricultural purposes, so e.g. zero degrees cancer is always meant to be the precise moment of mid-summer solstice, and zero Aries is precise moment of vernal equinox. The system was devised using observation of a shadow stick.
So, each zodiac sign in the tropical system is defined by 30 degrees of ecliptic longitude starting with Aries at precisely zero, but as you say seems I need a way to quantify the delay in hours due to precession since 2000? No idea how to do that if you can help.
Oh, that is easy then. Try this:
const Astronomy = require('./astronomy.js');
function TropicalZodiac(year) {
let startTime = Astronomy.MakeTime(new Date(year, 2, 15));
for (let lon = 0; lon < 360; lon += 30) {
let time = Astronomy.SearchSunLongitude(lon, startTime, 15.0);
console.log(`${time.date.toUTCString()}: Sun at longitude ${lon}`);
startTime = time.AddDays(25.0);
}
}
TropicalZodiac(2022);
Output looks like:
Sun, 20 Mar 2022 15:33:24 GMT: Sun at longitude 0
Wed, 20 Apr 2022 02:24:14 GMT: Sun at longitude 30
Sat, 21 May 2022 01:22:25 GMT: Sun at longitude 60
Tue, 21 Jun 2022 09:13:42 GMT: Sun at longitude 90
Fri, 22 Jul 2022 20:07:00 GMT: Sun at longitude 120
Tue, 23 Aug 2022 03:16:21 GMT: Sun at longitude 150
Fri, 23 Sep 2022 01:04:04 GMT: Sun at longitude 180
Sun, 23 Oct 2022 10:36:06 GMT: Sun at longitude 210
Tue, 22 Nov 2022 08:20:35 GMT: Sun at longitude 240
Wed, 21 Dec 2022 21:47:58 GMT: Sun at longitude 270
Fri, 20 Jan 2023 08:29:15 GMT: Sun at longitude 300
Sat, 18 Feb 2023 22:34:11 GMT: Sun at longitude 330
Oh, please disregard the function name. I see I got Hindu and tropical mixed up!
Never mind... I updated the function name to be TropicalZodiac
instead of HinduZodiac
.
Thanks so much.. so I could use this code to calibrate the time difference between ecliptic longitude in 2000 and what it is for this year..
Yes, this code works for any year, because SearchSunLongitude
is measuring the Sun's longitude using the Earth's equator as it actually is on a given date, taking into account precession and nutation of the Earth's axis. This is called "equator of date" coordinates. It does that for the exact reason you mention: of-date is necessary for calculating equinoxes and solstices. SearchSunLongitude
is a more generalized version of the Seasons
function that allows searching for when the Sun reaches any of-date ecliptic longitude.
The Ecliptic
function you started with uses the J2000 equator, which is useful for other purposes.
It is possible to convert back and forth between all of the coordinate systems. Please let me know if you can use some assistance with that or anything else astronomy related.
I tried an implementation that seemed to work fine for all future dates, but when I try year: 1968 I am a few hours out again.
const marchEq = Seasons(year).mar_equinox.date,
marchEq_vec = GeoVector(Body.Sun, marchEq, false),
elon = Ecliptic(marchEq_vec).elon
const diffDeg = elon <= 180 ? elon : 360 - elon // <-- Degrees of precession since 2000
I think the problem here is that the correction needs to be negative.. will the rule be as simple as: year before 2000, make it negative, otherwise positive?
Aha! Sorry, think I have it now. I am using the rotation matrix EQJ_EQD to give me the corrected value, and it seems to work great for all dates. Thanks so much for improving my understanding. Will put the improved tool live soon.
Yes, you got it! It seems like half the job of doing any astronomy calculation is dealing with all the different coordinate systems!
My next challenge is finding "local sidereal time" so I can determine an observer's ascendant (from a celestial longitude value I can get the zodiac sign). I can see a sidereal_time function in the AE codebase but it's not exported.. can you give me another pointer please?
It looks like the best thing would be for me to expose sidereal_time
for outside callers. I just created #165 to track this. I can probably get to this in the next day or two.
@cosinekitty seems like you exposed it the very same day, thanks for such awesome support!
@jorjun do you mind to share some of your code with me? I'm back into this hobby of mine and I will build an open-source mobile/web apps to have kind of a diary and be able to track/identify some transits in our lifes. I see that you use Angular and that's awesome because I'm a specialist, I guess we can trade a lot of knowledge :) What do you think? Best regards!
@matheo I will take a look at your project, if you open issues on there. My client work is not open sourced, but I might still be able to help with some astrology specifics.
@jorjun great! I haven't studied enough astronomy so I need help using this library to calc the constellations/signs, if you can teach me how you did that I'd appreciate it :)
Hi can anyone help me fix accuracy? The official date time for March Equinox 2022 is 20 March 2022, 15:33 (GMT) https://greenwichmeantime.com/timepiece/clock-astro/
Using the code below:
I get very near to longitude 0 (which I thought was the same as spring equinox) before 11:00 GMT. What am I doing wrong?