Forked from nathanielatom/pdiddy_island_mars_selfie.py
Created
July 14, 2021 20:12
-
-
Save pije76/98c6af4b03135b1ac4b34f67ceb95688 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 hidden or 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