SPICE for Python The SPICE TOOLKIT provided by NAIF is a tool for calculating the geometric information of the spacecraft from the SPICE kernel. So far, it has been developed in FORTRAN and C, but it seems that you can use Liplari to read functions from Python!
NAIF HP http://naif.jpl.nasa.gov/naif/
The python riplary is below. https://github.com/AndrewAnnex/SpiceyPy
pip install spiceypy
You can install it with. A simple document is here
import spiceypy as spice
spice.tkvrsn('TOOLKIT')
If you run, you should see the version name. If cspice is (function name) _c, spice. (function name) is basically OK. Input variables etc. are the same as cspice.
An example by the Cassini spacecraft.
import numpy as np
import spiceypy as spice
#Kernel loading
spice.furnsh('./spice/sclk/cas00084.tsc')
spice.furnsh('./spice/lsk/naif0009.tls')
utctim='2005-06-20T19:00:00'
#Convert from UTC to ET
et_ex=spice.str2et(utctim)
print 'ET:',et_ex
ti_0='0x58C448C2'#Hexadecimal
ti=int(ti_0,16)
print "TI (Decimal number): ",ti
scid=-90 #Spacecraft ID
#Convert from TI to ET
et= spice.sct2e(scid,ti)
#Convert from ET to UTC
time=spice.et2utc(et,"ISOC",6)
print "UTC: ",time
help(spice.str2et)
Note that you got caught
et2utc https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/et2utc.html A function that converts to UTC when you enter ET. On the other hand etcal https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/etcal.html Is a function that converts to calendar time when you enter ET.
The calculation result is different! What's the difference? Leap seconds are not taken into consideration in etcal, and it is unclear when to use it, but ** Generally, it seems better to use et2utc. ** **
Recommended Posts