我无法解决为什么我在 PyEphem 和 Skyfield 之间的彗星计算中得到不同的方位角/高度,但赤经和赤纬匹配。
代码示例:
#!/usr/bin/env python3
# External verification:
# https://in-the-sky.org/data/object.php?id=0088P
# https://theskylive.com/88p-info
# https://heavens-above.com/comet.aspx?cid=88P
# https://www.calsky.com/cs.cgi/Comets/3?
import datetime, ephem, io, skyfield.api, skyfield.constants, skyfield.data.mpc
now = datetime.datetime.strptime( "2020-07-22", "%Y-%m-%d" )
latitude = -33
longitude = 151
cometName = "88P/Howell"
# https://minorplanetcenter.net/iau/Ephemerides/Comets/Soft03Cmt.txt
cometDataPyEphem = "88P/Howell,e,4.3838,56.6855,235.9159,3.105737,0.1800765,0.56433120,347.8225,07/21.0/2020,2000,g 11.0,6.0"
# https://minorplanetcenter.net/iau/Ephemerides/Comets/Soft00Cmt.txt
cometDataSkyfield = "0088P 2020 09 26.6241 1.353073 0.564331 235.9159 56.6855 4.3838 20200721 11.0 6.0 88P/Howell MPEC 2019-JE2"
print( "PyEphem:", ephem.__version__ )
print( "Skyfield:", skyfield.__version__ )
# PyEphem
observer = ephem.Observer()
observer.date = ephem.Date( now )
observer.lat = latitude
observer.lon = longitude
body = ephem.readdb( cometDataPyEphem )
body.compute( observer )
print( "PyEphem comet", cometName,
"\n\tLat:", observer.lat,
"\n\tLon:", observer.lon,
"\n\tAlt:", body.alt,
"\n\tRA:", body.ra,
"\n\tDec:", body.dec )
# Skyfield
timeScale = skyfield.api.load.timescale( builtin = True )
topos = skyfield.api.Topos( latitude_degrees = latitude, longitude_degrees = longitude )
ephemeris = skyfield.api.load( "de421.bsp" )
with io.BytesIO( cometDataSkyfield.encode() ) as f:
dataframe = skyfield.data.mpc.load_comets_dataframe( f ).set_index( "designation", drop = False )
sun = ephemeris[ "sun" ]
earth = ephemeris[ "earth" ]
body = sun + skyfield.data.mpc.comet_orbit( dataframe.loc[ cometName ], timeScale, skyfield.constants.GM_SUN_Pitjeva_2005_km3_s2 )
t = timeScale.utc( now.year, now.month, now.day, now.hour, now.minute, now.second )
alt, az, bodyDistanceToEarth = ( earth + topos ).at( t ).observe( body ).apparent().altaz()
ra, dec, bodyDistanceToEarth = ( earth + topos ).at( t ).observe( body ).radec()
print( "Skyfield comet", cometName,
"\n\tAz:", az,
"\n\tAlt:", alt,
"\n\tRA:", ra,
"\n\tDec:", dec )
PyEphem 和 Skfield 以及几个网站之间的 RA/Dec 匹配(请参阅顶部的评论部分)。虽然 Az/Alt 的 Skyfield 值有点接近Heavens Above给出的值,但我无法确定为什么 PyEphem 和 Skyfield 之间的 Az/Alt 存在差异。
编辑:修改脚本以打印出纬度/经度和样本(正确)结果:
PyEphem: 3.7.6.0
Skyfield: 1.24
PyEphem comet 88P/Howell
Lat: -33:00:00.0
Lon: 151:00:00.0
Az: 109:52:54.6
Alt: -11:19:11.4
RA: 13:27:08.32
Dec: -9:56:54.6
Skyfield comet 88P/Howell
Lat: -33deg 00' 00.0"
Lon: 151deg 00' 00.0"
Az: 109deg 53' 03.4"
Alt: -11deg 19' 23.4"
RA: 13h 26m 04.51s
Dec: -09deg 50' 37.9"