Closed stickneyar closed 5 months ago
From the output, it looks like that ephemeris doesn't support Saturn; it's not in the list. Try using Saturn Barycenter instead, since the ephemeris lists it as a supported target — from this distance the difference between a gas giant and its system barycenter isn't significant, fortunately!
This message shows up at Jupiter in the list, when I use the int 5 and catch Jupiter in the for loop the message shows up at Saturn?
Message="kernel 'de421.bsp' is missing 'SATURN' - the targets it supports are: 0 SOLAR SYSTEM BARYCENTER, 1 MERCURY BARYCENTER, 2 VENUS BARYCENTER, 3 EARTH BARYCENTER, 4 MARS BARYCENTER, 5 JUPITER BARYCENTER, 6 SATURN BARYCENTER, 7 URANUS BARYCENTER, 8 NEPTUNE BARYCENTER, 9 PLUTO BARYCENTER, 10 SUN, 199 MERCURY, 399 EARTH, 299 VENUS, 301 MOON, 499 MARS" Source=C:\Users\stick\Documents\Python\WorkArea\SkyPlan\SkyPlan\SkyPlan.py StackTrace: File "C:\Users\stick\Documents\Python\WorkArea\SkyPlan\SkyPlan\SkyPlan.py", line 29, in (Current frame)
f = almanac.risings_and_settings(eph, eph[p], portrowan)
KeyError: "kernel 'de421.bsp' is missing 'SATURN' - the targets it supports are: 0 SOLAR SYSTEM BARYCENTER, 1 MERCURY BARYCENTER, 2 VENUS BARYCENTER, 3 EARTH BARYCENTER, 4 MARS BARYCENTER, 5 JUPITER BARYCENTER, 6 SATURN BARYCENTER, 7 URANUS BARYCENTER, 8 NEPTUNE BARYCENTER, 9 PLUTO BARYCENTER, 10 SUN, 199 MERCURY, 399 EARTH, 299 VENUS, 301 MOON, 499 MARS"
Here is my code
import skyfield import datetime as dt from pytz import timezone from skyfield import almanac from skyfield.api import N, W, wgs84, load import numpy as np
risings and settings
my observatory location
portrowan = wgs84.latlon(42.613 N, 880.463 W,elevation_m=181)
list of sun, moon and planets including Pluto
np.planet = [ 'Sun','Moon', 'Mercury','Venus','Mars','Jupiter','Saturn','Uranus','Neptune','Pluto' ]
not sure what this does
ts = load.timescale()
get current date time utc
curdate = dt.datetime.now() trise = ts.utc(curdate.year,curdate.month,curdate.day) newdate = curdate + dt.timedelta(days=1) tset = ts.utc(newdate.year,newdate.month,newdate.day)
not sure what this does
eph = load('de421.bsp')
let go through planet array , the first
for p in np.planet: if(p == 'Jupiter'): f = almanac.risings_and_settings(eph, eph[5], portrowan) plrise, event = almanac.find_discrete(trise, tset, f) print(p + " Rise = " + str(plrise[0].utc_iso()) + " Set = " + str(plrise[1].utc_iso())) else:
f = almanac.risings_and_settings(eph, eph[p], portrowan) plrise, event = almanac.find_discrete(trise, tset, f) print(p + " Rise = " + str(plrise[0].utc_iso()) + " Set = " + str(plrise[1].utc_iso()))
Here is the output:
Sun Rise = 2024-01-10T03:25:06Z Set = 2024-01-10T18:12:46Z Moon Rise = 2024-01-10T01:24:21Z Set = 2024-01-10T18:07:33Z Mercury Rise = 2024-01-10T01:47:31Z Set = 2024-01-10T16:29:50Z Venus Rise = 2024-01-10T00:57:07Z Set = 2024-01-10T15:35:07Z Mars Rise = 2024-01-10T02:10:10Z Set = 2024-01-10T17:15:55Z Jupiter Rise = 2024-01-10T12:28:54Z Set = 2024-01-10T22:47:39Z