Skip to content

Sun

The satkit.sun module provides functions for computing the sun's position and related quantities such as sunrise/sunset times and satellite shadow status.

sun

Astrodynamic calculations related to the sun

rise_set(time, coord, sigma=90.0 + 50.0 / 60.0)

Sunrise and sunset times on the day given by input time and at the given location.

Time is a "date" at location, and should have hours, minutes, and seconds set to zero

Vallado Algorithm 30

Parameters:

Name Type Description Default
time time

date for which to compute sunrise & sunset

required
coord itrfcoord

location for which to compute sunrise & sunset

required
sigma float

angle in degrees between noon & rise/set. Common Values: "Standard": 90 deg, 50 arcmin (90.0+50.0/60.0) "Civil Twilight": 96 deg "Nautical Twilight": 102 deg "Astronomical Twilight": 108 deg

If not passed in, "Standard" is used (90.0 + 50.0/60.0)

90.0 + 50.0 / 60.0

Returns:

Type Description
tuple[time, time]

tuple[satkit.time, satkit.time]: (sunrise, sunset)

Example
coord = satkit.itrfcoord(latitude_deg=42.36, longitude_deg=-71.06, altitude=0)
t = satkit.time.from_date(2024, 6, 21)
sunrise, sunset = satkit.sun.rise_set(t, coord)
print(f"Sunrise: {sunrise}")
print(f"Sunset:  {sunset}")

shadowfunc(sunpos, satpos)

Is satellite in Earth shadow given sun position

Parameters:

Name Type Description Default
sunpos NDArray[float64]

geocentric Sun position, meters

required
satpos NDArray[float64]

geocentric satellite position, meters

required
Notes
  • See algorithm in Section 3.4.2 of Montenbruck and Gill for calculation

Returns:

Name Type Description
float float

number in range [0,1] indicating no sun or full sun (no occlusion) hitting satellite

Example
t = satkit.time(2024, 1, 1)
sun = satkit.sun.pos_gcrf(t)
sat_pos = np.array([6.781e6, 0, 0])  # satellite position, GCRF, meters
shadow = satkit.sun.shadowfunc(sun, sat_pos)
if shadow < 0.01:
    print("Satellite is in Earth shadow")
else:
    print(f"Illumination fraction: {shadow:.2f}")