SPICE with planetarypy HOWTO

Several useful SPICE related HOWTOs posssible to do with planetarypy

Surface calculations on the Moon

from astropy import units as u
from numpy.linalg import norm

from planetarypy.spice.spicer import MoonSpicer, MarsSpicer
moon = MoonSpicer("2022-02-22")
moon.time.isoformat()
'2022-02-22T00:00:00'
moon.solar_constant

\(1388.4482 \; \mathrm{\frac{W}{m^{2}}}\)

moon.set_spoint_by(lat=0, lon=0)
moon.aspect = 180
moon.tilt = 30
moon.F_flat

\(497.68762 \; \mathrm{\frac{W}{m^{2}}}\)

moon.F_aspect

\(449.48514 \; \mathrm{\frac{W}{m^{2}}}\)

moon.F_tilt

\(412.53511 \; \mathrm{\frac{W}{m^{2}}}\)

moon.subsolar
array([  622.78676959, -1621.28270346,   -46.23629622])
moon.local_soltime
'16:35:58'
# MoonSpicer returns km (as all calculations in SPICE do)
# use astropy.units to convert to other values
norm(moon.body_to_object("EARTH")[0]) * u.km

\(375365.92 \; \mathrm{km}\)

(norm(moon.body_to_object("MARS")[0]) * u.km).to(u.AU)

\(2.0379563 \; \mathrm{AU}\)

mars = MarsSpicer()
mars.utc
'2023-06-27T18:37:50.876055'
mars.l_s
83.31658188802474
mars.goto('inca')
mars.spoint
(220.09830399469547, -440.60853011059214, -3340.5081261541495)
mars.aspect=180
mars.tilt=30
mars.F_flat

\(0 \; \mathrm{\frac{W}{m^{2}}}\)

mars.F_aspect

\(0 \; \mathrm{\frac{W}{m^{2}}}\)

mars.set_spoint_by(lat=0, lon=0)
mars.F_flat

\(339.2043 \; \mathrm{\frac{W}{m^{2}}}\)

mars.F_tilt

\(397.92501 \; \mathrm{\frac{W}{m^{2}}}\)