Skip to content

Instantly share code, notes, and snippets.

@translunar
Created April 25, 2019 17:35
Show Gist options
  • Save translunar/401a9489c8575aad99f498fcc40f8ee4 to your computer and use it in GitHub Desktop.
Save translunar/401a9489c8575aad99f498fcc40f8ee4 to your computer and use it in GitHub Desktop.
import numpy as np
from spiceypy import spiceypy as spice
r_lclf = spice.georec(lon, lat, 0.0, r_eq, f)
normal = spice.latrec(1.0, lon, lat)
topo_xform = spice.twovec(normal, 3, np.array([0.0, 0.0, 1.0]), 1)
# Get sun state relative to topo frame
x_sun, lt = spice.spkcpo('SUN', et, 'MOON_ME', 'OBSERVER', 'NONE', r_lclf, 'MOON', 'MOON_ME')
r_sun_topo = spice.mxv(topo_xform, x_sun[0:3])
rho, lon, el = spice.reclat(r_sun_topo)
az = -lon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment