A Python wrapper for the NAIF CSPICE Toolkit providing essential tools for spacecraft navigation and planetary science calculations
Advanced geometric computations including surface intersections, illumination analysis, limb finding, and visibility calculations. These functions enable detailed analysis of planetary surfaces and geometric relationships.
Find intersections between rays and planetary surfaces.
def sincpt(method: str, target: str, et: float, fixref: str, abcorr: str, obsrvr: str, dref: str, dvec: ndarray) -> Tuple[ndarray, float, ndarray, bool]:
"""
Find surface intercept point of ray with target body.
Parameters:
- method: str, computation method ("ELLIPSOID", "DSK/UNPRIORITIZED")
- target: str, target body name
- et: float, ephemeris time
- fixref: str, body-fixed reference frame
- abcorr: str, aberration correction
- obsrvr: str, observer body name
- dref: str, reference frame for direction vector
- dvec: ndarray, ray direction vector
Returns:
Tuple[ndarray, float, ndarray, bool]: (spoint, trgepc, srfvec, found)
"""
def subpnt(method: str, target: str, et: float, fixref: str, abcorr: str, obsrvr: str) -> Tuple[ndarray, float, ndarray]:
"""
Find sub-observer point on target body.
Parameters:
- method: str, computation method
- target: str, target body name
- et: float, ephemeris time
- fixref: str, body-fixed reference frame
- abcorr: str, aberration correction
- obsrvr: str, observer body name
Returns:
Tuple[ndarray, float, ndarray]: (spoint, trgepc, srfvec)
"""Compute illumination conditions at surface points.
def illum(target: str, et: float, abcorr: str, obsrvr: str, spoint: ndarray) -> Tuple[float, float, float]:
"""
Compute illumination angles at surface point.
Parameters:
- target: str, target body name
- et: float, ephemeris time
- abcorr: str, aberration correction
- obsrvr: str, observer body name
- spoint: ndarray, surface point vector
Returns:
Tuple[float, float, float]: (phase, incdnc, emissn)
- phase: phase angle in radians
- incdnc: incidence angle in radians
- emissn: emission angle in radians
"""
def illumf(method: str, target: str, ilusrc: str, et: float, fixref: str, abcorr: str, obsrvr: str, spoint: ndarray) -> Tuple[float, float, float, float, float]:
"""
Compute illumination angles with specific illumination source.
Parameters:
- method: str, computation method
- target: str, target body name
- ilusrc: str, illumination source body name
- et: float, ephemeris time
- fixref: str, body-fixed reference frame
- abcorr: str, aberration correction
- obsrvr: str, observer body name
- spoint: ndarray, surface point vector
Returns:
Tuple[float, float, float, float, float]: (trgepc, srfvec, phase, incdnc, emissn)
"""Find limb and terminator points on planetary bodies.
def limbpt(method: str, target: str, et: float, fixref: str, abcorr: str, corloc: str, obsrvr: str, refvec: ndarray, rolstp: float, ncuts: int, schstp: float, soltol: float) -> Tuple[int, ndarray, ndarray, ndarray]:
"""
Find limb points on target body.
Parameters:
- method: str, computation method
- target: str, target body name
- et: float, ephemeris time
- fixref: str, body-fixed reference frame
- abcorr: str, aberration correction
- corloc: str, correction location
- obsrvr: str, observer body name
- refvec: ndarray, reference vector
- rolstp: float, roll step size
- ncuts: int, number of cuts
- schstp: float, search step size
- soltol: float, solution tolerance
Returns:
Tuple[int, ndarray, ndarray, ndarray]: (npts, points, epochs, tangts)
"""import spiceypy as spice
spice.furnsh("metakernel.mk")
et = spice.str2et("2023-01-01T12:00:00")
spoint, trgepc, srfvec = spice.subpnt(
"INTERCEPT/ELLIPSOID",
"MARS",
et,
"IAU_MARS",
"LT+S",
"EARTH"
)
# Convert to lat/lon coordinates
radius, lon, lat = spice.reclat(spoint)
print(f"Sub-Earth point: lat={spice.dpr()*lat:.2f}°, lon={spice.dpr()*lon:.2f}°")
spice.kclear()Install with Tessl CLI
npx tessl i tessl/pypi-spiceypydocs