-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Hi,
I'm trying to get the J2000 equatorial coordinates of the Moon and the Sun.
I'm checking my results with Stellarium and the astronomia node library.
I hava noticed some discrepancies when using SwiftAA.
My understanding of celestial coordinates is limited, so I'm unsure whether I'm using the library incorrectly or if there might be a bug in SwiftAA.
J2000 vs Date
When I use sun.apparentEquatorialCoordinates or moon.apparentEquatorialCoordinates, I get a coordinate object such as:
α=+23h31m31.729s, δ=-3°4'28.376" (epoch JD 2460747.09, equinox J2000.0)
I expected these coordinates to be in the J2000 frame, but they seem to match the equatorial coordinates of date in Stellarium. Is this the expected behavior?
Calling this method does not change the result, which suggests the coordinates are already supposed to be in J2000:
sun.apparentEquatorialCoordinates.precessedCoordinates(to: .standardJ2000)
To get results that match Stellarium, I had to do the following:
var equatorialCoordinates = sun.apparentEquatorialCoordinates
//"fix" the equinox of the coords
equatorialCoordinates = EquatorialCoordinates(
rightAscension: equatorialCoordinates.rightAscension, declination: equatorialCoordinates.declination,
epoch: equatorialCoordinates.epoch, equinox: .meanEquinoxOfTheDate(jd)
)
equatorialCoordinates = equatorialCoordinates.precessedCoordinates(to: .standardJ2000)
I expected apparentEquatorialCoordinates to already be in J2000, so this workaround seems unnecessary. Is this a known issue, or am I misunderstanding how the coordinate system is handled in SwiftAA?
Topocentric coords
For the Moon, the difference between geocentric and topocentric coordinates is significant. I didn't find a direct method in SwiftAA for obtaining topocentric coordinates - am I missing something?
For now, I’ve used the following approach, which seems to give reasonable results:
let components = KPCAAParallax_Equatorial2Topocentric(
equatorialCoordinates.alpha.value, equatorialCoordinates.delta.value,
moon.distance.inMeters.inAstronomicalUnits.value,
-location.coordinate.longitude, location.coordinate.latitude,
location.altitude,
jd.value
)
equatorialCoordinates = EquatorialCoordinates(
rightAscension: Hour(components.X),
declination: Degree(components.Y),
epoch: equatorialCoordinates.epoch,
equinox: equatorialCoordinates.equinox
)
Is there a built-in way to compute topocentric coordinates in SwiftAA, or is manually applying KPCAAParallax_Equatorial2Topocentric the correct approach?
Thanks!