import numpy as np
from skyfield.api import EarthSatellite, load, wgs84
from skyfield.nutationlib import iau2000b
from skyfield.timelib import Time
from api.common import error_messages
from api.common.exceptions import ValidationError
from api.utils.time_utils import calculate_lst, jd_to_gst
# TODO: Verify if teme_to_ecef is correct
# The results of this function in combination with the other coordinate system updates
# for SGP4 give results similar to, but not identical to, the Skyfield results, so each
# new conversion needs to be individually verified
def teme_to_ecef(r_teme: list[float], theta_gst: float) -> np.ndarray:
"""
Convert TEME (True Equator, Mean Equinox) coordinates to ECEF (Earth-Centered,
The results of this function in combination with the other coordinate system updates
for SGP4 give results similar to, but not identical to, the Skyfield results, so each
new conversion needs to be individually verified
https://github.com/iausathub/satchecker/blob/c5a9a3b0fbe274986a361d37c20d86114d8fddba/src/api/utils/coordinate_systems.py#L14