sunset_simulator/astropy_test.py
2024-10-15 22:48:16 -04:00

21 lines
681 B
Python

from astropy.time import Time
from astropy.coordinates import solar_system_ephemeris, EarthLocation , AltAz
from astropy.coordinates import get_body_barycentric, get_body
def get_location(long,lat):
return EarthLocation.from_geodetic(long,lat)
loc = get_location(45.508,-73.561)
t = Time("2024-10-07 18:16",location=loc)
with solar_system_ephemeris.set('builtin'):
sun = get_body('sun', t, loc)
moon = get_body('moon', t, loc)
saturn = get_body('saturn', t, loc)
new_sun = sun.transform_to(AltAz(obstime=t,location=loc))
new_moon = moon.transform_to(AltAz(obstime=t,location=loc))
new_saturn = saturn.transform_to(AltAz(obstime=t,location=loc))
print(saturn)