Created
October 3, 2020 05:13
-
-
Save nathanielatom/e194b6cddeea3455dd95c37c5b0846ba to your computer and use it in GitHub Desktop.
Find out where Mars is, in the sky at P'diddy Island, PEI, ON, Canada.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Find out where Mars is, in the sky at P'diddy Island, PEI, ON, Canada. | |
""" | |
import datetime | |
# ! pip install skyfield | |
from skyfield.api import load, Topos | |
planets = load('de421.bsp') | |
earth, mars = planets['earth'], planets['mars'] | |
# define spacetime coordinates | |
latitude, longitude = 45.964946, -81.340623 # deg | |
elevation = 200 # m | |
pdiddy = earth + Topos(latitude_degrees=latitude, longitude_degrees=longitude, elevation_m=elevation) | |
ts = load.timescale() | |
night = datetime.datetime.fromisoformat('2020-09-05T22:41:19').astimezone(datetime.timezone.utc) | |
nightime = ts.from_datetime(night) # ts.now() | |
right_ascension, declination, equatorial_distance = earth.at(nightime).observe(mars).radec() | |
our_observation = pdiddy.at(nightime).observe(mars) | |
altitude, azimuth, distance = our_observation.apparent().altaz() | |
velocity = our_observation.velocity.km_per_s | |
speed = our_observation.speed().km_per_s | |
print(f'Look up {altitude}, and use a real compass to point to {azimuth} clockwise of North') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment