satellite ground track does not depend on epoch?

237 Views Asked by At

The code shown below generates a plot showing a satellite ground track (black dots) superimposed on a map of the Earth. The red dot is the start of the ground track, corresponding to the epoch time. To my surprise, changing the epoch does not change the location of the red dot on the map. Something must be wrong because the orbit plane is fixed with respect to the stars, but the Earth is not. Any advice will be appreciated.

# Section 1: Preliminaries.

# Section 1.1: Import from Python standard library.

import os, pickle, sys
from datetime import datetime
from numpy import arange, pi


# Section 1.2: Import from packages in the Anaconda distribution.

import matplotlib.pyplot as plt

from pytz import timezone, utc

import cartopy.crs as ccrs

from astropy import coordinates, time, units as u
from poliastro.bodies import Earth, Moon, Sun
from poliastro.twobody import Orbit, propagation


# Section 1.3: Global variables and constants.

RAD2DEG= 180 / pi

tz= utc


# Section 2:

epoch= [2020, 12, 7, 20, 38]

# Naive datetime is datetime with no timezone information.  Here we 'localize' the naive
# datetime, i.e., convert it to a timezone-specific time:
datetime_local= tz.localize(datetime(*epoch))

# Convert localized datetime to UTC:
datetime_UTC= datetime_local.astimezone(utc)

# Convert to Astropy time on UTC scale:
t= time.Time(datetime_UTC, scale='utc')


# Section 3: Simulate orbit.

a  = 26600       * u.km  # semi-major axis
ecc= 0.74        * u.one # eccentricity
inc= 63.4        * u.deg # inclination of the orbit plane

raan= 49.562     * u.deg # right ascension of the ascending node
argp= 270        * u.deg # argument of perigee
nu  = 0          * u.deg # true anomaly at epoch

T_sim_hrs= 24
T_step_min= 3

orbit= Orbit.from_classical(Earth, a, ecc, inc, raan, argp, nu, epoch=t)

print(f"Orbit period: {orbit.period.to(u.min):.3f}")

# Create time steps covering the duration of the simulation:
times= arange(0, 60*T_sim_hrs+1, T_step_min) * u.min

xyz= propagation.propagate(
  orbit,
  time.TimeDelta(times),
  method=propagation.cowell,
  rtol=1e-10,
)

# Convert positions from Cartesian to spherical coordinates:
d_lat_lon= coordinates.cartesian_to_spherical(xyz.z, xyz.y, xyz.z)


# Section 4: Generate plot.

fig= plt.figure(figsize=(12, 7))
ax= fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())

ax.stock_img()

                      # longitude             # latitude
plt.scatter(x=RAD2DEG*d_lat_lon[2], y=RAD2DEG*d_lat_lon[1],
  color="black", s=12, alpha=0.5, transform=ccrs.PlateCarree())

# Mark the first point, corresponding to epoch, with a special symbol:
plt.scatter(x=RAD2DEG*d_lat_lon[2][:1], y=RAD2DEG*d_lat_lon[1][:1],
  color="red", s=160, marker='o', alpha=1.0, transform=ccrs.PlateCarree())

plt.tight_layout()
plt.show()
0

There are 0 best solutions below