I cannot get SPICE to produce accurate sunrise times for topocentric frames I specify.
I'm using spiceypy to interface with SPICE. As a first test, I set up topo coordinates for the MARE landing site, mare.tf
:
KPL/FK
\begindata
NAIF_BODY_CODE += ( 3010001 )
NAIF_BODY_NAME += ( 'MARE-LS' )
FRAME_MARE-LS_TOPO = 13010001
FRAME_13010001_NAME = 'MARE-LS_TOPO'
FRAME_13010001_CLASS = 4
FRAME_13010001_CLASS_ID = 13010001
FRAME_13010001_CENTER = 3010001
OBJECT_301001_FRAME = 'MARE-LS_TOPO'
TKFRAME_13010001_RELATIVE = 'MOON_ME'
TKFRAME_13010001_SPEC = 'ANGLES'
TKFRAME_13010001_UNITS = 'DEGREES'
TKFRAME_13010001_AXES = ( 3, 2, 3 )
TKFRAME_13010001_ANGLES = ( 300, 66.6, 180.0 )
\begintext
...
and used pinpoint on the following definition, mare.def
,
SPK/FK
\begindata
SITES = ('MARE-LS')
MARE-LS_FRAME = 'MOON_ME'
MARE-LS_CENTER = 301
MARE-LS_IDCODE = 3010001
MARE-LS_BOUNDS = ( @1950-JAN-01/00:00, @2050-JAN-01/00:00 )
MARE-LS_LATLON = (
23.4
-60.0
0.0
)
MARE-LS_UP = 'Z'
MARE-LS_NORTH = 'X'
\begintext
...
with the command
./pinpoint -def mare.def -spk mare.bsp -pck mykernels.bsp
and mykernels.bsp
set to
KPL/MK
\begindata
KERNELS_TO_LOAD = (
'pck00010.tpc'
'de432s.bsp'
'earth_070425_370426_predict.bpc'
'naif0012.tls'
'de-403-masses.tpc'
'moon_pa_de421_1900-2050.bpc'
'moon_080317.tf'
'moon_assoc_me.tf'
)
\begintext
...
I've checked and re-checked this, but the sunrise times it gives me for 2021 are clearly wrong:
- 2021 JAN 02 03:45:06
- 2021 JAN 31 18:55:28
- 2021 MAR 02 09:18:43
- 2021 MAR 31 22:28:38
- 2021 APR 30 10:20:47
- 2021 MAY 29 21:11:41
- 2021 JUN 28 07:31:53
- 2021 JUL 27 17:57:18
- 2021 AUG 26 05:01:20
- 2021 SEP 24 17:08:23
- 2021 OCT 24 06:28:44
- 2021 NOV 22 20:55:05
- 2021 DEC 22 12:02:05
My code is here:
from spiceypy import spiceypy as spice
import spiceypy.utils.support_types as stypes
import numpy as np
spice.furnsh(['mykernels.bsp', 'mare.bsp', 'mare.tf'])
max_intervals = 1500
window = year_interval(2021)
adjust = 0.0
step_size = 300.0
min_elevation = 10.0 * np.pi/180.0
landing_site_frame = 'MARE-LS_TOPO'
abcorr = 'LT'
landing_site = 'MARE-LS'
inc_constraint = np.pi - 2.0 * min_elevation
daytime_windows = stypes.SPICEDOUBLE_CELL(max_intervals * 2)
spice.gfposc('SUN', landing_site_frame, abcorr, landing_site,
'LATITUDINAL', 'LATITUDE', '>', min_elevation,
adjust, step_size, max_intervals, window,
daytime_windows)
for ii in range(spice.wncard(daytime_windows)):
b, e = spice.wnfetd(daytime_windows, ii)
print(spice.et2utc(b, 'C', 0, 51))
I've also tried calculating sunrises for Cape Canaveral using the same strategy. For January 1, 2021, I get 13:34:40 UTC, which is 8:34:40 AM local time in Florida. But Google tells me the correct answer is 7:15 AM.
Does anyone know what I might be doing wrong? It must be something relating to the coordinates I'm providing in the home-rolled kernels, but I can't figure out what. Is this just the wrong GF* function to be using? If so, which one should I be using?