Replies: 1 comment 5 replies
-
Try editing your answer to triple-backtick your code; it should fix the formatting problems, which make it a little difficult to wade into right now. But at first glance: it looks like you're determining declination from the astrometric position, whereas I think the Naval Observatory uses the apparent position? Try https://rhodesmill.org/skyfield/positions.html#barycentric-astrometric-apparent Let us know if that makes a difference in your results. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The times of the seasons using find_minima/maxima for the sun declination don't match what comes from the skyfield almanac.
I used Skyfield almanac to find the earth seasons and find_minima/maxima to find the earth apsides. The results match what's on the US Naval Observatory site for 2022 [https://aa.usno.navy.mil/calculated/seasons?year=2022&tz=0&tz_sign=-1&tz_label=false&dst=false&submit=Get+Data].
I looked up the sun declination for the time skyfield almanac gives for equinoxes and was surprised that the angles weren't exactly 0 degrees. I proceeded to find the equinoxes and solstices using find_minima/maxima of the sun declination via radec() and found a discrepancy.
I must be doing something wrong. I've read through the skyfield documentation and tried a bunch of things, but I can't get the two approaches to finding the seasons to match. Any help is appreciated.
Thanks!
Here's my code:
`
"""
Given a year, find the earth seasons and apsides.
Check the seasons against min/max sun declination
"""
import sys
import skyfield
from skyfield.api import load
from skyfield import almanac
from skyfield.searchlib import find_minima, find_maxima
print('Python Version:', sys.version)
print('Skyfield Version:', skyfield.VERSION)
print('\n\n')
ephemeris = load('de440s.bsp')
def earth_distance(time):
earth = ephemeris['earth']
sun = ephemeris['sun']
e = earth.at(time)
s = e.observe(sun)
return s.distance().km
earth_distance.step_days = 1
def sun_declination(time):
earth = ephemeris['earth']
sun = ephemeris['sun']
e = earth.at(time)
s = e.observe(sun)
ra, declin, dist = s.radec(time)
return abs(declin.degrees)
sun_declination.step_days = 1
def seasons(year):
"""
Find the earth seasons and apsides.
Use the Skyfield almanac and check against the
min/max sun declinations which define the seasons
"""
### Set up Skyview and initialize data ###
event_time = 0
dist = angle = 1
timescale = load.timescale()
start_time = timescale.utc(year, 1, 1)
end_time = timescale.utc(year+1, 1, 1)
`
And, here's the output:
`
Python Version: 3.9.12 (main, May 8 2022, 17:57:49)
[Clang 13.1.6 (clang-1316.0.21.2)]
Skyfield Version: (1, 42)
SEASONS
Vernal Equinox 2022-03-20 15:33:24.902557+00:00 0.00228°
Summer Solstice 2022-06-21 09:13:51.057466+00:00 23.43780°
Autumnal Equinox 2022-09-23 01:03:42.256731+00:00 0.00206°
Winter Solstice 2022-12-21 21:48:13.006813+00:00 23.43814°
APSIDES
Aphelion 2022-07-04 07:10:39.145961+00:00 152098463 km
Perihelion 2022-01-04 06:54:25.954538+00:00 147105046 km
MIN/MAX DECLINATIONS
2022-03-20 15:25:06.501680+00:00 0.00000°
2022-06-21 09:10:39.667275+00:00 23.43780°
2022-09-23 00:56:05.255710+00:00 0.00000°
2022-12-21 21:44:23.066157+00:00 23.43814°
`
Beta Was this translation helpful? Give feedback.
All reactions